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,
217 #define GPIO_MASK 0x03
220 /* codec parameterization */
221 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
222 unsigned int num_mixers;
224 const struct hda_verb *init_verbs[5]; /* initialization verbs
228 unsigned int num_init_verbs;
230 char *stream_name_analog; /* analog PCM stream */
231 struct hda_pcm_stream *stream_analog_playback;
232 struct hda_pcm_stream *stream_analog_capture;
233 struct hda_pcm_stream *stream_analog_alt_playback;
234 struct hda_pcm_stream *stream_analog_alt_capture;
236 char *stream_name_digital; /* digital PCM stream */
237 struct hda_pcm_stream *stream_digital_playback;
238 struct hda_pcm_stream *stream_digital_capture;
241 struct hda_multi_out multiout; /* playback set-up
242 * max_channels, dacs must be set
243 * dig_out_nid and hp_nid are optional
245 hda_nid_t alt_dac_nid;
248 unsigned int num_adc_nids;
250 hda_nid_t *capsrc_nids;
251 hda_nid_t dig_in_nid; /* digital-in NID; optional */
254 unsigned int num_mux_defs;
255 const struct hda_input_mux *input_mux;
256 unsigned int cur_mux[3];
259 const struct hda_channel_mode *channel_mode;
260 int num_channel_mode;
263 /* PCM information */
264 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
266 /* dynamic controls, init_verbs and input_mux */
267 struct auto_pin_cfg autocfg;
268 unsigned int num_kctl_alloc, num_kctl_used;
269 struct snd_kcontrol_new *kctl_alloc;
270 struct hda_input_mux private_imux;
271 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
274 void (*init_hook)(struct hda_codec *codec);
275 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
277 /* for pin sensing */
278 unsigned int sense_updated: 1;
279 unsigned int jack_present: 1;
280 unsigned int master_sw: 1;
282 /* for virtual master */
283 hda_nid_t vmaster_nid;
284 #ifdef CONFIG_SND_HDA_POWER_SAVE
285 struct hda_loopback_check loopback;
290 * configuration template - to be copied to the spec instance
292 struct alc_config_preset {
293 struct snd_kcontrol_new *mixers[5]; /* should be identical size
296 const struct hda_verb *init_verbs[5];
297 unsigned int num_dacs;
299 hda_nid_t dig_out_nid; /* optional */
300 hda_nid_t hp_nid; /* optional */
301 unsigned int num_adc_nids;
303 hda_nid_t *capsrc_nids;
304 hda_nid_t dig_in_nid;
305 unsigned int num_channel_mode;
306 const struct hda_channel_mode *channel_mode;
308 unsigned int num_mux_defs;
309 const struct hda_input_mux *input_mux;
310 void (*unsol_event)(struct hda_codec *, unsigned int);
311 void (*init_hook)(struct hda_codec *);
312 #ifdef CONFIG_SND_HDA_POWER_SAVE
313 struct hda_amp_list *loopbacks;
321 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
322 struct snd_ctl_elem_info *uinfo)
324 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
325 struct alc_spec *spec = codec->spec;
326 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
327 if (mux_idx >= spec->num_mux_defs)
329 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
332 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
333 struct snd_ctl_elem_value *ucontrol)
335 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
336 struct alc_spec *spec = codec->spec;
337 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
339 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
343 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
344 struct snd_ctl_elem_value *ucontrol)
346 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
347 struct alc_spec *spec = codec->spec;
348 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
349 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
350 hda_nid_t nid = spec->capsrc_nids ?
351 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
352 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
353 nid, &spec->cur_mux[adc_idx]);
358 * channel mode setting
360 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
361 struct snd_ctl_elem_info *uinfo)
363 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
364 struct alc_spec *spec = codec->spec;
365 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
366 spec->num_channel_mode);
369 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
370 struct snd_ctl_elem_value *ucontrol)
372 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
373 struct alc_spec *spec = codec->spec;
374 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
375 spec->num_channel_mode,
376 spec->multiout.max_channels);
379 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
380 struct snd_ctl_elem_value *ucontrol)
382 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
383 struct alc_spec *spec = codec->spec;
384 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
385 spec->num_channel_mode,
386 &spec->multiout.max_channels);
387 if (err >= 0 && spec->need_dac_fix)
388 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
393 * Control the mode of pin widget settings via the mixer. "pc" is used
394 * instead of "%" to avoid consequences of accidently treating the % as
395 * being part of a format specifier. Maximum allowed length of a value is
396 * 63 characters plus NULL terminator.
398 * Note: some retasking pin complexes seem to ignore requests for input
399 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
400 * are requested. Therefore order this list so that this behaviour will not
401 * cause problems when mixer clients move through the enum sequentially.
402 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
405 static char *alc_pin_mode_names[] = {
406 "Mic 50pc bias", "Mic 80pc bias",
407 "Line in", "Line out", "Headphone out",
409 static unsigned char alc_pin_mode_values[] = {
410 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
412 /* The control can present all 5 options, or it can limit the options based
413 * in the pin being assumed to be exclusively an input or an output pin. In
414 * addition, "input" pins may or may not process the mic bias option
415 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
416 * accept requests for bias as of chip versions up to March 2006) and/or
417 * wiring in the computer.
419 #define ALC_PIN_DIR_IN 0x00
420 #define ALC_PIN_DIR_OUT 0x01
421 #define ALC_PIN_DIR_INOUT 0x02
422 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
423 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
425 /* Info about the pin modes supported by the different pin direction modes.
426 * For each direction the minimum and maximum values are given.
428 static signed char alc_pin_mode_dir_info[5][2] = {
429 { 0, 2 }, /* ALC_PIN_DIR_IN */
430 { 3, 4 }, /* ALC_PIN_DIR_OUT */
431 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
432 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
433 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
435 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
436 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
437 #define alc_pin_mode_n_items(_dir) \
438 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
440 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
441 struct snd_ctl_elem_info *uinfo)
443 unsigned int item_num = uinfo->value.enumerated.item;
444 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
446 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
448 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
450 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
451 item_num = alc_pin_mode_min(dir);
452 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
456 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
457 struct snd_ctl_elem_value *ucontrol)
460 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
461 hda_nid_t nid = kcontrol->private_value & 0xffff;
462 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
463 long *valp = ucontrol->value.integer.value;
464 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
465 AC_VERB_GET_PIN_WIDGET_CONTROL,
468 /* Find enumerated value for current pinctl setting */
469 i = alc_pin_mode_min(dir);
470 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
472 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
476 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
477 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 hda_nid_t nid = kcontrol->private_value & 0xffff;
482 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
483 long val = *ucontrol->value.integer.value;
484 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
485 AC_VERB_GET_PIN_WIDGET_CONTROL,
488 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
489 val = alc_pin_mode_min(dir);
491 change = pinctl != alc_pin_mode_values[val];
493 /* Set pin mode to that requested */
494 snd_hda_codec_write_cache(codec, nid, 0,
495 AC_VERB_SET_PIN_WIDGET_CONTROL,
496 alc_pin_mode_values[val]);
498 /* Also enable the retasking pin's input/output as required
499 * for the requested pin mode. Enum values of 2 or less are
502 * Dynamically switching the input/output buffers probably
503 * reduces noise slightly (particularly on input) so we'll
504 * do it. However, having both input and output buffers
505 * enabled simultaneously doesn't seem to be problematic if
506 * this turns out to be necessary in the future.
509 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
510 HDA_AMP_MUTE, HDA_AMP_MUTE);
511 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
514 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
515 HDA_AMP_MUTE, HDA_AMP_MUTE);
516 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
523 #define ALC_PIN_MODE(xname, nid, dir) \
524 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
525 .info = alc_pin_mode_info, \
526 .get = alc_pin_mode_get, \
527 .put = alc_pin_mode_put, \
528 .private_value = nid | (dir<<16) }
530 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
531 * together using a mask with more than one bit set. This control is
532 * currently used only by the ALC260 test model. At this stage they are not
533 * needed for any "production" models.
535 #ifdef CONFIG_SND_DEBUG
536 #define alc_gpio_data_info snd_ctl_boolean_mono_info
538 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
539 struct snd_ctl_elem_value *ucontrol)
541 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
542 hda_nid_t nid = kcontrol->private_value & 0xffff;
543 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
544 long *valp = ucontrol->value.integer.value;
545 unsigned int val = snd_hda_codec_read(codec, nid, 0,
546 AC_VERB_GET_GPIO_DATA, 0x00);
548 *valp = (val & mask) != 0;
551 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_value *ucontrol)
555 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
556 hda_nid_t nid = kcontrol->private_value & 0xffff;
557 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
558 long val = *ucontrol->value.integer.value;
559 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
560 AC_VERB_GET_GPIO_DATA,
563 /* Set/unset the masked GPIO bit(s) as needed */
564 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
569 snd_hda_codec_write_cache(codec, nid, 0,
570 AC_VERB_SET_GPIO_DATA, gpio_data);
574 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
575 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
576 .info = alc_gpio_data_info, \
577 .get = alc_gpio_data_get, \
578 .put = alc_gpio_data_put, \
579 .private_value = nid | (mask<<16) }
580 #endif /* CONFIG_SND_DEBUG */
582 /* A switch control to allow the enabling of the digital IO pins on the
583 * ALC260. This is incredibly simplistic; the intention of this control is
584 * to provide something in the test model allowing digital outputs to be
585 * identified if present. If models are found which can utilise these
586 * outputs a more complete mixer control can be devised for those models if
589 #ifdef CONFIG_SND_DEBUG
590 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
592 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
593 struct snd_ctl_elem_value *ucontrol)
595 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
596 hda_nid_t nid = kcontrol->private_value & 0xffff;
597 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
598 long *valp = ucontrol->value.integer.value;
599 unsigned int val = snd_hda_codec_read(codec, nid, 0,
600 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
602 *valp = (val & mask) != 0;
605 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
606 struct snd_ctl_elem_value *ucontrol)
609 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
610 hda_nid_t nid = kcontrol->private_value & 0xffff;
611 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
612 long val = *ucontrol->value.integer.value;
613 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
614 AC_VERB_GET_DIGI_CONVERT_1,
617 /* Set/unset the masked control bit(s) as needed */
618 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
623 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
628 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
629 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
630 .info = alc_spdif_ctrl_info, \
631 .get = alc_spdif_ctrl_get, \
632 .put = alc_spdif_ctrl_put, \
633 .private_value = nid | (mask<<16) }
634 #endif /* CONFIG_SND_DEBUG */
636 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
637 * Again, this is only used in the ALC26x test models to help identify when
638 * the EAPD line must be asserted for features to work.
640 #ifdef CONFIG_SND_DEBUG
641 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
643 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
644 struct snd_ctl_elem_value *ucontrol)
646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
647 hda_nid_t nid = kcontrol->private_value & 0xffff;
648 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
649 long *valp = ucontrol->value.integer.value;
650 unsigned int val = snd_hda_codec_read(codec, nid, 0,
651 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
653 *valp = (val & mask) != 0;
657 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
658 struct snd_ctl_elem_value *ucontrol)
661 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
662 hda_nid_t nid = kcontrol->private_value & 0xffff;
663 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
664 long val = *ucontrol->value.integer.value;
665 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
666 AC_VERB_GET_EAPD_BTLENABLE,
669 /* Set/unset the masked control bit(s) as needed */
670 change = (!val ? 0 : mask) != (ctrl_data & mask);
675 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
681 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
682 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
683 .info = alc_eapd_ctrl_info, \
684 .get = alc_eapd_ctrl_get, \
685 .put = alc_eapd_ctrl_put, \
686 .private_value = nid | (mask<<16) }
687 #endif /* CONFIG_SND_DEBUG */
690 * set up from the preset table
692 static void setup_preset(struct alc_spec *spec,
693 const struct alc_config_preset *preset)
697 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
698 spec->mixers[spec->num_mixers++] = preset->mixers[i];
699 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
701 spec->init_verbs[spec->num_init_verbs++] =
702 preset->init_verbs[i];
704 spec->channel_mode = preset->channel_mode;
705 spec->num_channel_mode = preset->num_channel_mode;
706 spec->need_dac_fix = preset->need_dac_fix;
708 spec->multiout.max_channels = spec->channel_mode[0].channels;
710 spec->multiout.num_dacs = preset->num_dacs;
711 spec->multiout.dac_nids = preset->dac_nids;
712 spec->multiout.dig_out_nid = preset->dig_out_nid;
713 spec->multiout.hp_nid = preset->hp_nid;
715 spec->num_mux_defs = preset->num_mux_defs;
716 if (!spec->num_mux_defs)
717 spec->num_mux_defs = 1;
718 spec->input_mux = preset->input_mux;
720 spec->num_adc_nids = preset->num_adc_nids;
721 spec->adc_nids = preset->adc_nids;
722 spec->capsrc_nids = preset->capsrc_nids;
723 spec->dig_in_nid = preset->dig_in_nid;
725 spec->unsol_event = preset->unsol_event;
726 spec->init_hook = preset->init_hook;
727 #ifdef CONFIG_SND_HDA_POWER_SAVE
728 spec->loopback.amplist = preset->loopbacks;
732 /* Enable GPIO mask and set output */
733 static struct hda_verb alc_gpio1_init_verbs[] = {
734 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
735 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
736 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
740 static struct hda_verb alc_gpio2_init_verbs[] = {
741 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
742 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
743 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
747 static struct hda_verb alc_gpio3_init_verbs[] = {
748 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
749 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
750 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
754 static void alc_sku_automute(struct hda_codec *codec)
756 struct alc_spec *spec = codec->spec;
757 unsigned int present;
758 unsigned int hp_nid = spec->autocfg.hp_pins[0];
759 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
761 /* need to execute and sync at first */
762 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
763 present = snd_hda_codec_read(codec, hp_nid, 0,
764 AC_VERB_GET_PIN_SENSE, 0);
765 spec->jack_present = (present & 0x80000000) != 0;
766 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
767 spec->jack_present ? 0 : PIN_OUT);
770 /* unsolicited event for HP jack sensing */
771 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
773 if (codec->vendor_id == 0x10ec0880)
777 if (res != ALC880_HP_EVENT)
780 alc_sku_automute(codec);
783 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
784 * 31 ~ 16 : Manufacture ID
786 * 7 ~ 0 : Assembly ID
787 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
789 static void alc_subsystem_id(struct hda_codec *codec,
790 unsigned int porta, unsigned int porte,
793 unsigned int ass, tmp, i;
795 struct alc_spec *spec = codec->spec;
797 ass = codec->subsystem_id & 0xffff;
798 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
802 * 31~30 : port conetcivity
805 * 19~16 : Check sum (15:1)
810 if (codec->vendor_id == 0x10ec0260)
812 ass = snd_hda_codec_read(codec, nid, 0,
813 AC_VERB_GET_CONFIG_DEFAULT, 0);
814 if (!(ass & 1) && !(ass & 0x100000))
816 if ((ass >> 30) != 1) /* no physical connection */
821 for (i = 1; i < 16; i++) {
825 if (((ass >> 16) & 0xf) != tmp)
831 * 2 : 0 --> Desktop, 1 --> Laptop
832 * 3~5 : External Amplifier control
835 tmp = (ass & 0x38) >> 3; /* external Amp control */
838 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
841 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
844 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
846 case 5: /* set EAPD output high */
847 switch (codec->vendor_id) {
849 snd_hda_codec_write(codec, 0x0f, 0,
850 AC_VERB_SET_EAPD_BTLENABLE, 2);
851 snd_hda_codec_write(codec, 0x10, 0,
852 AC_VERB_SET_EAPD_BTLENABLE, 2);
861 snd_hda_codec_write(codec, 0x14, 0,
862 AC_VERB_SET_EAPD_BTLENABLE, 2);
863 snd_hda_codec_write(codec, 0x15, 0,
864 AC_VERB_SET_EAPD_BTLENABLE, 2);
867 switch (codec->vendor_id) {
869 snd_hda_codec_write(codec, 0x1a, 0,
870 AC_VERB_SET_COEF_INDEX, 7);
871 tmp = snd_hda_codec_read(codec, 0x1a, 0,
872 AC_VERB_GET_PROC_COEF, 0);
873 snd_hda_codec_write(codec, 0x1a, 0,
874 AC_VERB_SET_COEF_INDEX, 7);
875 snd_hda_codec_write(codec, 0x1a, 0,
876 AC_VERB_SET_PROC_COEF,
886 snd_hda_codec_write(codec, 0x20, 0,
887 AC_VERB_SET_COEF_INDEX, 7);
888 tmp = snd_hda_codec_read(codec, 0x20, 0,
889 AC_VERB_GET_PROC_COEF, 0);
890 snd_hda_codec_write(codec, 0x20, 0,
891 AC_VERB_SET_COEF_INDEX, 7);
892 snd_hda_codec_write(codec, 0x20, 0,
893 AC_VERB_SET_PROC_COEF,
898 snd_hda_codec_write(codec, 0x20, 0,
899 AC_VERB_SET_COEF_INDEX, 7);
900 tmp = snd_hda_codec_read(codec, 0x20, 0,
901 AC_VERB_GET_PROC_COEF, 0);
902 snd_hda_codec_write(codec, 0x20, 0,
903 AC_VERB_SET_COEF_INDEX, 7);
904 snd_hda_codec_write(codec, 0x20, 0,
905 AC_VERB_SET_PROC_COEF,
913 /* is laptop or Desktop and enable the function "Mute internal speaker
914 * when the external headphone out jack is plugged"
919 * 10~8 : Jack location
920 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
922 * 15 : 1 --> enable the function "Mute internal speaker
923 * when the external headphone out jack is plugged"
925 if (!spec->autocfg.speaker_pins[0]) {
926 if (spec->autocfg.line_out_pins[0])
927 spec->autocfg.speaker_pins[0] =
928 spec->autocfg.line_out_pins[0];
933 if (!spec->autocfg.hp_pins[0]) {
934 tmp = (ass >> 11) & 0x3; /* HP to chassis */
936 spec->autocfg.hp_pins[0] = porta;
938 spec->autocfg.hp_pins[0] = porte;
940 spec->autocfg.hp_pins[0] = portd;
945 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
946 AC_VERB_SET_UNSOLICITED_ENABLE,
947 AC_USRSP_EN | ALC880_HP_EVENT);
948 spec->unsol_event = alc_sku_unsol_event;
952 * Fix-up pin default configurations
960 static void alc_fix_pincfg(struct hda_codec *codec,
961 const struct snd_pci_quirk *quirk,
962 const struct alc_pincfg **pinfix)
964 const struct alc_pincfg *cfg;
966 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
970 cfg = pinfix[quirk->value];
971 for (; cfg->nid; cfg++) {
974 for (i = 0; i < 4; i++) {
975 snd_hda_codec_write(codec, cfg->nid, 0,
976 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
984 * ALC880 3-stack model
986 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
987 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
988 * F-Mic = 0x1b, HP = 0x19
991 static hda_nid_t alc880_dac_nids[4] = {
992 /* front, rear, clfe, rear_surr */
993 0x02, 0x05, 0x04, 0x03
996 static hda_nid_t alc880_adc_nids[3] = {
1001 /* The datasheet says the node 0x07 is connected from inputs,
1002 * but it shows zero connection in the real implementation on some devices.
1003 * Note: this is a 915GAV bug, fixed on 915GLV
1005 static hda_nid_t alc880_adc_nids_alt[2] = {
1010 #define ALC880_DIGOUT_NID 0x06
1011 #define ALC880_DIGIN_NID 0x0a
1013 static struct hda_input_mux alc880_capture_source = {
1017 { "Front Mic", 0x3 },
1023 /* channel source setting (2/6 channel selection for 3-stack) */
1025 static struct hda_verb alc880_threestack_ch2_init[] = {
1026 /* set line-in to input, mute it */
1027 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1028 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1029 /* set mic-in to input vref 80%, mute it */
1030 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1031 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1036 static struct hda_verb alc880_threestack_ch6_init[] = {
1037 /* set line-in to output, unmute it */
1038 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1039 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1040 /* set mic-in to output, unmute it */
1041 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1042 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1046 static struct hda_channel_mode alc880_threestack_modes[2] = {
1047 { 2, alc880_threestack_ch2_init },
1048 { 6, alc880_threestack_ch6_init },
1051 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1054 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1055 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1056 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1057 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1058 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1059 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1060 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1061 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1066 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1068 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1069 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1070 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1072 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1073 .name = "Channel Mode",
1074 .info = alc_ch_mode_info,
1075 .get = alc_ch_mode_get,
1076 .put = alc_ch_mode_put,
1081 /* capture mixer elements */
1082 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1083 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1084 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1085 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1086 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1087 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1088 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1090 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1091 /* The multiple "Capture Source" controls confuse alsamixer
1092 * So call somewhat different..
1094 /* .name = "Capture Source", */
1095 .name = "Input Source",
1097 .info = alc_mux_enum_info,
1098 .get = alc_mux_enum_get,
1099 .put = alc_mux_enum_put,
1104 /* capture mixer elements (in case NID 0x07 not available) */
1105 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1106 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1107 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1108 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1109 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1112 /* The multiple "Capture Source" controls confuse alsamixer
1113 * So call somewhat different..
1115 /* .name = "Capture Source", */
1116 .name = "Input Source",
1118 .info = alc_mux_enum_info,
1119 .get = alc_mux_enum_get,
1120 .put = alc_mux_enum_put,
1128 * ALC880 5-stack model
1130 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1132 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1133 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1136 /* additional mixers to alc880_three_stack_mixer */
1137 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1138 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1139 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1143 /* channel source setting (6/8 channel selection for 5-stack) */
1145 static struct hda_verb alc880_fivestack_ch6_init[] = {
1146 /* set line-in to input, mute it */
1147 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1148 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1153 static struct hda_verb alc880_fivestack_ch8_init[] = {
1154 /* set line-in to output, unmute it */
1155 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1156 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1160 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1161 { 6, alc880_fivestack_ch6_init },
1162 { 8, alc880_fivestack_ch8_init },
1167 * ALC880 6-stack model
1169 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1170 * Side = 0x05 (0x0f)
1171 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1172 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1175 static hda_nid_t alc880_6st_dac_nids[4] = {
1176 /* front, rear, clfe, rear_surr */
1177 0x02, 0x03, 0x04, 0x05
1180 static struct hda_input_mux alc880_6stack_capture_source = {
1184 { "Front Mic", 0x1 },
1190 /* fixed 8-channels */
1191 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1195 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1198 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1199 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1200 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1201 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1202 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1203 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1204 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1205 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1206 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1207 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1208 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1209 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1212 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1213 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1214 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1215 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1217 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1218 .name = "Channel Mode",
1219 .info = alc_ch_mode_info,
1220 .get = alc_ch_mode_get,
1221 .put = alc_ch_mode_put,
1230 * W810 has rear IO for:
1233 * Center/LFE (DAC 04)
1236 * The system also has a pair of internal speakers, and a headphone jack.
1237 * These are both connected to Line2 on the codec, hence to DAC 02.
1239 * There is a variable resistor to control the speaker or headphone
1240 * volume. This is a hardware-only device without a software API.
1242 * Plugging headphones in will disable the internal speakers. This is
1243 * implemented in hardware, not via the driver using jack sense. In
1244 * a similar fashion, plugging into the rear socket marked "front" will
1245 * disable both the speakers and headphones.
1247 * For input, there's a microphone jack, and an "audio in" jack.
1248 * These may not do anything useful with this driver yet, because I
1249 * haven't setup any initialization verbs for these yet...
1252 static hda_nid_t alc880_w810_dac_nids[3] = {
1253 /* front, rear/surround, clfe */
1257 /* fixed 6 channels */
1258 static struct hda_channel_mode alc880_w810_modes[1] = {
1262 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1263 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1265 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1266 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1267 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1268 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1269 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1270 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1271 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1280 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1281 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1285 static hda_nid_t alc880_z71v_dac_nids[1] = {
1288 #define ALC880_Z71V_HP_DAC 0x03
1290 /* fixed 2 channels */
1291 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1295 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1296 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1297 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1298 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1299 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1300 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1301 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1303 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1309 * ALC880 F1734 model
1311 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1312 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1315 static hda_nid_t alc880_f1734_dac_nids[1] = {
1318 #define ALC880_F1734_HP_DAC 0x02
1320 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1321 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1322 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1323 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1324 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1325 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1326 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1332 static struct hda_input_mux alc880_f1734_capture_source = {
1344 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1345 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1346 * Mic = 0x18, Line = 0x1a
1349 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1350 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1352 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1353 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1354 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1355 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1356 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1357 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1358 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1359 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1360 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1361 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1362 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1363 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1364 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1368 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1369 .name = "Channel Mode",
1370 .info = alc_ch_mode_info,
1371 .get = alc_ch_mode_get,
1372 .put = alc_ch_mode_put,
1378 * ALC880 ASUS W1V model
1380 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1381 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1382 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1385 /* additional mixers to alc880_asus_mixer */
1386 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1387 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1388 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1392 /* additional mixers to alc880_asus_mixer */
1393 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1394 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1395 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1400 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1401 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1402 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1404 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1405 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1407 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1408 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1409 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1411 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1412 /* The multiple "Capture Source" controls confuse alsamixer
1413 * So call somewhat different..
1415 /* .name = "Capture Source", */
1416 .name = "Input Source",
1418 .info = alc_mux_enum_info,
1419 .get = alc_mux_enum_get,
1420 .put = alc_mux_enum_put,
1426 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1427 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1428 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1429 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1430 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1431 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1432 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1433 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1434 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1437 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1438 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1441 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1442 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1443 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1444 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1447 .name = "Channel Mode",
1448 .info = alc_ch_mode_info,
1449 .get = alc_ch_mode_get,
1450 .put = alc_ch_mode_put,
1455 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1456 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1457 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1459 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1460 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1461 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1462 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1463 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1464 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1465 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1469 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1470 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1471 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1472 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1473 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1480 * virtual master controls
1484 * slave controls for virtual master
1486 static const char *alc_slave_vols[] = {
1487 "Front Playback Volume",
1488 "Surround Playback Volume",
1489 "Center Playback Volume",
1490 "LFE Playback Volume",
1491 "Side Playback Volume",
1492 "Headphone Playback Volume",
1493 "Speaker Playback Volume",
1494 "Mono Playback Volume",
1495 "Line-Out Playback Volume",
1499 static const char *alc_slave_sws[] = {
1500 "Front Playback Switch",
1501 "Surround Playback Switch",
1502 "Center Playback Switch",
1503 "LFE Playback Switch",
1504 "Side Playback Switch",
1505 "Headphone Playback Switch",
1506 "Speaker Playback Switch",
1507 "Mono Playback Switch",
1508 "IEC958 Playback Switch",
1513 * build control elements
1515 static int alc_build_controls(struct hda_codec *codec)
1517 struct alc_spec *spec = codec->spec;
1521 for (i = 0; i < spec->num_mixers; i++) {
1522 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1527 if (spec->multiout.dig_out_nid) {
1528 err = snd_hda_create_spdif_out_ctls(codec,
1529 spec->multiout.dig_out_nid);
1532 err = snd_hda_create_spdif_share_sw(codec,
1536 spec->multiout.share_spdif = 1;
1538 if (spec->dig_in_nid) {
1539 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1544 /* if we have no master control, let's create it */
1545 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1546 unsigned int vmaster_tlv[4];
1547 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1548 HDA_OUTPUT, vmaster_tlv);
1549 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1550 vmaster_tlv, alc_slave_vols);
1554 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1555 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1556 NULL, alc_slave_sws);
1566 * initialize the codec volumes, etc
1570 * generic initialization of ADC, input mixers and output mixers
1572 static struct hda_verb alc880_volume_init_verbs[] = {
1574 * Unmute ADC0-2 and set the default input to mic-in
1576 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1578 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1579 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1580 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1581 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1583 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1585 * Note: PASD motherboards uses the Line In 2 as the input for front
1588 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1591 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1593 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1598 * Set up output mixers (0x0c - 0x0f)
1600 /* set vol=0 to output mixers */
1601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1603 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1604 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1605 /* set up input amps for analog loopback */
1606 /* Amp Indices: DAC = 0, mixer = 1 */
1607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1610 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1611 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1613 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1614 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1620 * 3-stack pin configuration:
1621 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1623 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1625 * preset connection lists of input pins
1626 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1628 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1629 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1630 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1633 * Set pin mode and muting
1635 /* set front pin widgets 0x14 for output */
1636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1637 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1638 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1639 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1640 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1641 /* Mic2 (as headphone out) for HP output */
1642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1643 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1644 /* Line In pin widget for input */
1645 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1647 /* Line2 (as front mic) pin widget for input and vref at 80% */
1648 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1650 /* CD pin widget for input */
1651 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1657 * 5-stack pin configuration:
1658 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1659 * line-in/side = 0x1a, f-mic = 0x1b
1661 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1663 * preset connection lists of input pins
1664 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1666 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1667 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1670 * Set pin mode and muting
1672 /* set pin widgets 0x14-0x17 for output */
1673 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1675 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1676 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1677 /* unmute pins for output (no gain on this amp) */
1678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1680 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1681 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1683 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1684 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1686 /* Mic2 (as headphone out) for HP output */
1687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1689 /* Line In pin widget for input */
1690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1692 /* Line2 (as front mic) pin widget for input and vref at 80% */
1693 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1694 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1695 /* CD pin widget for input */
1696 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1702 * W810 pin configuration:
1703 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1705 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1706 /* hphone/speaker input selector: front DAC */
1707 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1709 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1710 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1713 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1714 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1716 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1717 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1723 * Z71V pin configuration:
1724 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1726 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1728 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1732 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1733 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1734 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1741 * 6-stack pin configuration:
1742 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1743 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1745 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1746 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1748 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1749 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1752 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1753 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1754 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1755 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1757 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1758 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1759 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1760 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1761 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1763 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1764 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1765 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1771 * Uniwill pin configuration:
1772 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1775 static struct hda_verb alc880_uniwill_init_verbs[] = {
1776 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1779 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1781 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1782 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1783 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1784 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1785 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1788 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1789 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1790 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1791 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1793 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1794 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1795 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1796 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1797 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1798 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1799 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1800 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1801 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1803 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1804 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1811 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1813 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1814 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1816 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1817 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1818 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1820 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1821 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1827 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1830 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1831 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1832 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1833 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1834 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1836 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1837 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1842 static struct hda_verb alc880_beep_init_verbs[] = {
1843 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1847 /* toggle speaker-output according to the hp-jack state */
1848 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1850 unsigned int present;
1853 present = snd_hda_codec_read(codec, 0x14, 0,
1854 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1855 bits = present ? HDA_AMP_MUTE : 0;
1856 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1857 HDA_AMP_MUTE, bits);
1858 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1859 HDA_AMP_MUTE, bits);
1862 /* auto-toggle front mic */
1863 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1865 unsigned int present;
1868 present = snd_hda_codec_read(codec, 0x18, 0,
1869 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1870 bits = present ? HDA_AMP_MUTE : 0;
1871 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1874 static void alc880_uniwill_automute(struct hda_codec *codec)
1876 alc880_uniwill_hp_automute(codec);
1877 alc880_uniwill_mic_automute(codec);
1880 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1883 /* Looks like the unsol event is incompatible with the standard
1884 * definition. 4bit tag is placed at 28 bit!
1886 switch (res >> 28) {
1887 case ALC880_HP_EVENT:
1888 alc880_uniwill_hp_automute(codec);
1890 case ALC880_MIC_EVENT:
1891 alc880_uniwill_mic_automute(codec);
1896 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1898 unsigned int present;
1901 present = snd_hda_codec_read(codec, 0x14, 0,
1902 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1903 bits = present ? HDA_AMP_MUTE : 0;
1904 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1907 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1909 unsigned int present;
1911 present = snd_hda_codec_read(codec, 0x21, 0,
1912 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1913 present &= HDA_AMP_VOLMASK;
1914 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1915 HDA_AMP_VOLMASK, present);
1916 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1917 HDA_AMP_VOLMASK, present);
1920 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1923 /* Looks like the unsol event is incompatible with the standard
1924 * definition. 4bit tag is placed at 28 bit!
1926 if ((res >> 28) == ALC880_HP_EVENT)
1927 alc880_uniwill_p53_hp_automute(codec);
1928 if ((res >> 28) == ALC880_DCVOL_EVENT)
1929 alc880_uniwill_p53_dcvol_automute(codec);
1933 * F1734 pin configuration:
1934 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1936 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1937 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
1938 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1939 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1940 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1941 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1944 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1945 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1948 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1949 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1950 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1951 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1952 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1953 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1954 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1955 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1956 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1958 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
1959 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
1965 * ASUS pin configuration:
1966 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1968 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1969 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1970 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1971 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1972 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1978 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1979 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1980 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1981 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1983 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1984 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1985 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1986 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1987 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1988 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1989 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1990 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1991 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1996 /* Enable GPIO mask and set output */
1997 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1998 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2000 /* Clevo m520g init */
2001 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2002 /* headphone output */
2003 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2008 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2009 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2011 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2012 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2013 /* Mic1 (rear panel) */
2014 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2016 /* Mic2 (front panel) */
2017 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2018 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2020 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2021 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2022 /* change to EAPD mode */
2023 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2024 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2029 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2030 /* change to EAPD mode */
2031 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2032 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2034 /* Headphone output */
2035 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2038 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2040 /* Line In pin widget for input */
2041 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2042 /* CD pin widget for input */
2043 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2044 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2045 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2047 /* change to EAPD mode */
2048 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2049 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2055 * LG m1 express dual
2058 * Rear Line-In/Out (blue): 0x14
2059 * Build-in Mic-In: 0x15
2061 * HP-Out (green): 0x1b
2062 * Mic-In/Out (red): 0x19
2066 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2067 static hda_nid_t alc880_lg_dac_nids[3] = {
2071 /* seems analog CD is not working */
2072 static struct hda_input_mux alc880_lg_capture_source = {
2077 { "Internal Mic", 0x6 },
2081 /* 2,4,6 channel modes */
2082 static struct hda_verb alc880_lg_ch2_init[] = {
2083 /* set line-in and mic-in to input */
2084 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2085 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2089 static struct hda_verb alc880_lg_ch4_init[] = {
2090 /* set line-in to out and mic-in to input */
2091 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2092 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2096 static struct hda_verb alc880_lg_ch6_init[] = {
2097 /* set line-in and mic-in to output */
2098 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2099 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2103 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2104 { 2, alc880_lg_ch2_init },
2105 { 4, alc880_lg_ch4_init },
2106 { 6, alc880_lg_ch6_init },
2109 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2110 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2111 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2112 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2113 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2114 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2115 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2116 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2117 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2120 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2121 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2122 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2123 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2125 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2126 .name = "Channel Mode",
2127 .info = alc_ch_mode_info,
2128 .get = alc_ch_mode_get,
2129 .put = alc_ch_mode_put,
2134 static struct hda_verb alc880_lg_init_verbs[] = {
2135 /* set capture source to mic-in */
2136 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2137 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2138 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2139 /* mute all amp mixer inputs */
2140 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2143 /* line-in to input */
2144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2145 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2147 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2148 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2150 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2151 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2152 /* mic-in to input */
2153 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2154 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2155 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2157 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2159 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2161 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2165 /* toggle speaker-output according to the hp-jack state */
2166 static void alc880_lg_automute(struct hda_codec *codec)
2168 unsigned int present;
2171 present = snd_hda_codec_read(codec, 0x1b, 0,
2172 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2173 bits = present ? HDA_AMP_MUTE : 0;
2174 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2175 HDA_AMP_MUTE, bits);
2178 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2180 /* Looks like the unsol event is incompatible with the standard
2181 * definition. 4bit tag is placed at 28 bit!
2183 if ((res >> 28) == 0x01)
2184 alc880_lg_automute(codec);
2193 * Built-in Mic-In: 0x19
2199 static struct hda_input_mux alc880_lg_lw_capture_source = {
2203 { "Internal Mic", 0x1 },
2208 #define alc880_lg_lw_modes alc880_threestack_modes
2210 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2211 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2212 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2214 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2215 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2216 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2217 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2218 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2220 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2223 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2224 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2227 .name = "Channel Mode",
2228 .info = alc_ch_mode_info,
2229 .get = alc_ch_mode_get,
2230 .put = alc_ch_mode_put,
2235 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2236 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2237 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2238 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2240 /* set capture source to mic-in */
2241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2244 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2246 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2247 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2249 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2250 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2251 /* mic-in to input */
2252 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2253 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2255 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2256 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2258 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2262 /* toggle speaker-output according to the hp-jack state */
2263 static void alc880_lg_lw_automute(struct hda_codec *codec)
2265 unsigned int present;
2268 present = snd_hda_codec_read(codec, 0x1b, 0,
2269 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2270 bits = present ? HDA_AMP_MUTE : 0;
2271 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2272 HDA_AMP_MUTE, bits);
2275 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2277 /* Looks like the unsol event is incompatible with the standard
2278 * definition. 4bit tag is placed at 28 bit!
2280 if ((res >> 28) == 0x01)
2281 alc880_lg_lw_automute(codec);
2284 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2285 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2286 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2289 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2290 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2294 static struct hda_input_mux alc880_medion_rim_capture_source = {
2298 { "Internal Mic", 0x1 },
2302 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2303 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2308 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2309 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2310 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2311 /* Mic2 (as headphone out) for HP output */
2312 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2313 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2314 /* Internal Speaker */
2315 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2316 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2318 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2319 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2321 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2325 /* toggle speaker-output according to the hp-jack state */
2326 static void alc880_medion_rim_automute(struct hda_codec *codec)
2328 unsigned int present;
2331 present = snd_hda_codec_read(codec, 0x14, 0,
2332 AC_VERB_GET_PIN_SENSE, 0)
2333 & AC_PINSENSE_PRESENCE;
2334 bits = present ? HDA_AMP_MUTE : 0;
2335 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2336 HDA_AMP_MUTE, bits);
2338 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2340 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2343 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2346 /* Looks like the unsol event is incompatible with the standard
2347 * definition. 4bit tag is placed at 28 bit!
2349 if ((res >> 28) == ALC880_HP_EVENT)
2350 alc880_medion_rim_automute(codec);
2353 #ifdef CONFIG_SND_HDA_POWER_SAVE
2354 static struct hda_amp_list alc880_loopbacks[] = {
2355 { 0x0b, HDA_INPUT, 0 },
2356 { 0x0b, HDA_INPUT, 1 },
2357 { 0x0b, HDA_INPUT, 2 },
2358 { 0x0b, HDA_INPUT, 3 },
2359 { 0x0b, HDA_INPUT, 4 },
2363 static struct hda_amp_list alc880_lg_loopbacks[] = {
2364 { 0x0b, HDA_INPUT, 1 },
2365 { 0x0b, HDA_INPUT, 6 },
2366 { 0x0b, HDA_INPUT, 7 },
2375 static int alc_init(struct hda_codec *codec)
2377 struct alc_spec *spec = codec->spec;
2380 for (i = 0; i < spec->num_init_verbs; i++)
2381 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2383 if (spec->init_hook)
2384 spec->init_hook(codec);
2389 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2391 struct alc_spec *spec = codec->spec;
2393 if (spec->unsol_event)
2394 spec->unsol_event(codec, res);
2397 #ifdef CONFIG_SND_HDA_POWER_SAVE
2398 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2400 struct alc_spec *spec = codec->spec;
2401 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2406 * Analog playback callbacks
2408 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2409 struct hda_codec *codec,
2410 struct snd_pcm_substream *substream)
2412 struct alc_spec *spec = codec->spec;
2413 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2417 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2418 struct hda_codec *codec,
2419 unsigned int stream_tag,
2420 unsigned int format,
2421 struct snd_pcm_substream *substream)
2423 struct alc_spec *spec = codec->spec;
2424 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2425 stream_tag, format, substream);
2428 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2429 struct hda_codec *codec,
2430 struct snd_pcm_substream *substream)
2432 struct alc_spec *spec = codec->spec;
2433 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2439 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2440 struct hda_codec *codec,
2441 struct snd_pcm_substream *substream)
2443 struct alc_spec *spec = codec->spec;
2444 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2447 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2448 struct hda_codec *codec,
2449 unsigned int stream_tag,
2450 unsigned int format,
2451 struct snd_pcm_substream *substream)
2453 struct alc_spec *spec = codec->spec;
2454 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2455 stream_tag, format, substream);
2458 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2459 struct hda_codec *codec,
2460 struct snd_pcm_substream *substream)
2462 struct alc_spec *spec = codec->spec;
2463 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2469 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2470 struct hda_codec *codec,
2471 unsigned int stream_tag,
2472 unsigned int format,
2473 struct snd_pcm_substream *substream)
2475 struct alc_spec *spec = codec->spec;
2477 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2478 stream_tag, 0, format);
2482 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2483 struct hda_codec *codec,
2484 struct snd_pcm_substream *substream)
2486 struct alc_spec *spec = codec->spec;
2488 snd_hda_codec_cleanup_stream(codec,
2489 spec->adc_nids[substream->number + 1]);
2496 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2500 /* NID is set in alc_build_pcms */
2502 .open = alc880_playback_pcm_open,
2503 .prepare = alc880_playback_pcm_prepare,
2504 .cleanup = alc880_playback_pcm_cleanup
2508 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2512 /* NID is set in alc_build_pcms */
2515 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2519 /* NID is set in alc_build_pcms */
2522 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2523 .substreams = 2, /* can be overridden */
2526 /* NID is set in alc_build_pcms */
2528 .prepare = alc880_alt_capture_pcm_prepare,
2529 .cleanup = alc880_alt_capture_pcm_cleanup
2533 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2537 /* NID is set in alc_build_pcms */
2539 .open = alc880_dig_playback_pcm_open,
2540 .close = alc880_dig_playback_pcm_close,
2541 .prepare = alc880_dig_playback_pcm_prepare
2545 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2549 /* NID is set in alc_build_pcms */
2552 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2553 static struct hda_pcm_stream alc_pcm_null_stream = {
2559 static int alc_build_pcms(struct hda_codec *codec)
2561 struct alc_spec *spec = codec->spec;
2562 struct hda_pcm *info = spec->pcm_rec;
2565 codec->num_pcms = 1;
2566 codec->pcm_info = info;
2568 info->name = spec->stream_name_analog;
2569 if (spec->stream_analog_playback) {
2570 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2571 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2572 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2574 if (spec->stream_analog_capture) {
2575 snd_assert(spec->adc_nids, return -EINVAL);
2576 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2577 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2580 if (spec->channel_mode) {
2581 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2582 for (i = 0; i < spec->num_channel_mode; i++) {
2583 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2584 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2589 /* SPDIF for stream index #1 */
2590 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2591 codec->num_pcms = 2;
2592 info = spec->pcm_rec + 1;
2593 info->name = spec->stream_name_digital;
2594 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2595 if (spec->multiout.dig_out_nid &&
2596 spec->stream_digital_playback) {
2597 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2598 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2600 if (spec->dig_in_nid &&
2601 spec->stream_digital_capture) {
2602 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2603 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2607 /* If the use of more than one ADC is requested for the current
2608 * model, configure a second analog capture-only PCM.
2610 /* Additional Analaog capture for index #2 */
2611 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2612 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2613 codec->num_pcms = 3;
2614 info = spec->pcm_rec + 2;
2615 info->name = spec->stream_name_analog;
2616 if (spec->alt_dac_nid) {
2617 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2618 *spec->stream_analog_alt_playback;
2619 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2622 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2623 alc_pcm_null_stream;
2624 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2626 if (spec->num_adc_nids > 1) {
2627 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2628 *spec->stream_analog_alt_capture;
2629 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2631 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2632 spec->num_adc_nids - 1;
2634 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2635 alc_pcm_null_stream;
2636 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2643 static void alc_free(struct hda_codec *codec)
2645 struct alc_spec *spec = codec->spec;
2651 if (spec->kctl_alloc) {
2652 for (i = 0; i < spec->num_kctl_used; i++)
2653 kfree(spec->kctl_alloc[i].name);
2654 kfree(spec->kctl_alloc);
2657 codec->spec = NULL; /* to be sure */
2662 static struct hda_codec_ops alc_patch_ops = {
2663 .build_controls = alc_build_controls,
2664 .build_pcms = alc_build_pcms,
2667 .unsol_event = alc_unsol_event,
2668 #ifdef CONFIG_SND_HDA_POWER_SAVE
2669 .check_power_status = alc_check_power_status,
2675 * Test configuration for debugging
2677 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2680 #ifdef CONFIG_SND_DEBUG
2681 static hda_nid_t alc880_test_dac_nids[4] = {
2682 0x02, 0x03, 0x04, 0x05
2685 static struct hda_input_mux alc880_test_capture_source = {
2694 { "Surround", 0x6 },
2698 static struct hda_channel_mode alc880_test_modes[4] = {
2705 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2706 struct snd_ctl_elem_info *uinfo)
2708 static char *texts[] = {
2709 "N/A", "Line Out", "HP Out",
2710 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2712 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2714 uinfo->value.enumerated.items = 8;
2715 if (uinfo->value.enumerated.item >= 8)
2716 uinfo->value.enumerated.item = 7;
2717 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2721 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2722 struct snd_ctl_elem_value *ucontrol)
2724 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2725 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2726 unsigned int pin_ctl, item = 0;
2728 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2729 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2730 if (pin_ctl & AC_PINCTL_OUT_EN) {
2731 if (pin_ctl & AC_PINCTL_HP_EN)
2735 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2736 switch (pin_ctl & AC_PINCTL_VREFEN) {
2737 case AC_PINCTL_VREF_HIZ: item = 3; break;
2738 case AC_PINCTL_VREF_50: item = 4; break;
2739 case AC_PINCTL_VREF_GRD: item = 5; break;
2740 case AC_PINCTL_VREF_80: item = 6; break;
2741 case AC_PINCTL_VREF_100: item = 7; break;
2744 ucontrol->value.enumerated.item[0] = item;
2748 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2749 struct snd_ctl_elem_value *ucontrol)
2751 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2752 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2753 static unsigned int ctls[] = {
2754 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2755 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2756 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2757 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2758 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2759 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2761 unsigned int old_ctl, new_ctl;
2763 old_ctl = snd_hda_codec_read(codec, nid, 0,
2764 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2765 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2766 if (old_ctl != new_ctl) {
2768 snd_hda_codec_write_cache(codec, nid, 0,
2769 AC_VERB_SET_PIN_WIDGET_CONTROL,
2771 val = ucontrol->value.enumerated.item[0] >= 3 ?
2773 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2780 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2781 struct snd_ctl_elem_info *uinfo)
2783 static char *texts[] = {
2784 "Front", "Surround", "CLFE", "Side"
2786 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2788 uinfo->value.enumerated.items = 4;
2789 if (uinfo->value.enumerated.item >= 4)
2790 uinfo->value.enumerated.item = 3;
2791 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2795 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2796 struct snd_ctl_elem_value *ucontrol)
2798 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2799 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2802 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2803 ucontrol->value.enumerated.item[0] = sel & 3;
2807 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2808 struct snd_ctl_elem_value *ucontrol)
2810 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2811 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2814 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2815 if (ucontrol->value.enumerated.item[0] != sel) {
2816 sel = ucontrol->value.enumerated.item[0] & 3;
2817 snd_hda_codec_write_cache(codec, nid, 0,
2818 AC_VERB_SET_CONNECT_SEL, sel);
2824 #define PIN_CTL_TEST(xname,nid) { \
2825 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2827 .info = alc_test_pin_ctl_info, \
2828 .get = alc_test_pin_ctl_get, \
2829 .put = alc_test_pin_ctl_put, \
2830 .private_value = nid \
2833 #define PIN_SRC_TEST(xname,nid) { \
2834 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2836 .info = alc_test_pin_src_info, \
2837 .get = alc_test_pin_src_get, \
2838 .put = alc_test_pin_src_put, \
2839 .private_value = nid \
2842 static struct snd_kcontrol_new alc880_test_mixer[] = {
2843 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2844 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2845 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2846 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2847 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2848 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2849 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2850 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2851 PIN_CTL_TEST("Front Pin Mode", 0x14),
2852 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2853 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2854 PIN_CTL_TEST("Side Pin Mode", 0x17),
2855 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2856 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2857 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2858 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2859 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2860 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2861 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2862 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2863 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2864 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2865 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2866 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2867 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2868 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2869 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2870 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2871 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2872 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2875 .name = "Channel Mode",
2876 .info = alc_ch_mode_info,
2877 .get = alc_ch_mode_get,
2878 .put = alc_ch_mode_put,
2883 static struct hda_verb alc880_test_init_verbs[] = {
2884 /* Unmute inputs of 0x0c - 0x0f */
2885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2888 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2891 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2892 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2893 /* Vol output for 0x0c-0x0f */
2894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2896 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2897 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2898 /* Set output pins 0x14-0x17 */
2899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2901 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2902 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2903 /* Unmute output pins 0x14-0x17 */
2904 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2906 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2907 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2908 /* Set input pins 0x18-0x1c */
2909 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2910 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2911 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2912 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2913 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2914 /* Mute input pins 0x18-0x1b */
2915 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2916 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2917 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2918 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2921 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2922 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2923 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2924 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2925 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2926 /* Analog input/passthru */
2927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2939 static const char *alc880_models[ALC880_MODEL_LAST] = {
2940 [ALC880_3ST] = "3stack",
2941 [ALC880_TCL_S700] = "tcl",
2942 [ALC880_3ST_DIG] = "3stack-digout",
2943 [ALC880_CLEVO] = "clevo",
2944 [ALC880_5ST] = "5stack",
2945 [ALC880_5ST_DIG] = "5stack-digout",
2946 [ALC880_W810] = "w810",
2947 [ALC880_Z71V] = "z71v",
2948 [ALC880_6ST] = "6stack",
2949 [ALC880_6ST_DIG] = "6stack-digout",
2950 [ALC880_ASUS] = "asus",
2951 [ALC880_ASUS_W1V] = "asus-w1v",
2952 [ALC880_ASUS_DIG] = "asus-dig",
2953 [ALC880_ASUS_DIG2] = "asus-dig2",
2954 [ALC880_UNIWILL_DIG] = "uniwill",
2955 [ALC880_UNIWILL_P53] = "uniwill-p53",
2956 [ALC880_FUJITSU] = "fujitsu",
2957 [ALC880_F1734] = "F1734",
2959 [ALC880_LG_LW] = "lg-lw",
2960 [ALC880_MEDION_RIM] = "medion",
2961 #ifdef CONFIG_SND_DEBUG
2962 [ALC880_TEST] = "test",
2964 [ALC880_AUTO] = "auto",
2967 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2968 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2969 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2970 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2971 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2972 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2973 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2974 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2975 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2976 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2977 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2978 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2979 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2980 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2981 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2982 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2983 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2984 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2985 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2986 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2987 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2988 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2989 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
2990 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2991 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2992 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2993 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2994 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2995 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2996 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2997 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2998 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2999 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3000 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3001 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3002 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3003 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3004 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3005 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3006 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3007 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3008 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3009 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3010 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3011 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3012 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3013 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3014 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3015 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3016 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3017 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3018 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3019 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3020 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3021 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3022 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3023 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3024 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3025 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3026 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3027 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3028 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3029 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3030 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3031 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3032 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3033 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3034 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3035 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3036 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3037 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3042 * ALC880 codec presets
3044 static struct alc_config_preset alc880_presets[] = {
3046 .mixers = { alc880_three_stack_mixer },
3047 .init_verbs = { alc880_volume_init_verbs,
3048 alc880_pin_3stack_init_verbs },
3049 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3050 .dac_nids = alc880_dac_nids,
3051 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3052 .channel_mode = alc880_threestack_modes,
3054 .input_mux = &alc880_capture_source,
3056 [ALC880_3ST_DIG] = {
3057 .mixers = { alc880_three_stack_mixer },
3058 .init_verbs = { alc880_volume_init_verbs,
3059 alc880_pin_3stack_init_verbs },
3060 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3061 .dac_nids = alc880_dac_nids,
3062 .dig_out_nid = ALC880_DIGOUT_NID,
3063 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3064 .channel_mode = alc880_threestack_modes,
3066 .input_mux = &alc880_capture_source,
3068 [ALC880_TCL_S700] = {
3069 .mixers = { alc880_tcl_s700_mixer },
3070 .init_verbs = { alc880_volume_init_verbs,
3071 alc880_pin_tcl_S700_init_verbs,
3072 alc880_gpio2_init_verbs },
3073 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3074 .dac_nids = alc880_dac_nids,
3076 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3077 .channel_mode = alc880_2_jack_modes,
3078 .input_mux = &alc880_capture_source,
3081 .mixers = { alc880_three_stack_mixer,
3082 alc880_five_stack_mixer},
3083 .init_verbs = { alc880_volume_init_verbs,
3084 alc880_pin_5stack_init_verbs },
3085 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3086 .dac_nids = alc880_dac_nids,
3087 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3088 .channel_mode = alc880_fivestack_modes,
3089 .input_mux = &alc880_capture_source,
3091 [ALC880_5ST_DIG] = {
3092 .mixers = { alc880_three_stack_mixer,
3093 alc880_five_stack_mixer },
3094 .init_verbs = { alc880_volume_init_verbs,
3095 alc880_pin_5stack_init_verbs },
3096 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3097 .dac_nids = alc880_dac_nids,
3098 .dig_out_nid = ALC880_DIGOUT_NID,
3099 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3100 .channel_mode = alc880_fivestack_modes,
3101 .input_mux = &alc880_capture_source,
3104 .mixers = { alc880_six_stack_mixer },
3105 .init_verbs = { alc880_volume_init_verbs,
3106 alc880_pin_6stack_init_verbs },
3107 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3108 .dac_nids = alc880_6st_dac_nids,
3109 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3110 .channel_mode = alc880_sixstack_modes,
3111 .input_mux = &alc880_6stack_capture_source,
3113 [ALC880_6ST_DIG] = {
3114 .mixers = { alc880_six_stack_mixer },
3115 .init_verbs = { alc880_volume_init_verbs,
3116 alc880_pin_6stack_init_verbs },
3117 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3118 .dac_nids = alc880_6st_dac_nids,
3119 .dig_out_nid = ALC880_DIGOUT_NID,
3120 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3121 .channel_mode = alc880_sixstack_modes,
3122 .input_mux = &alc880_6stack_capture_source,
3125 .mixers = { alc880_w810_base_mixer },
3126 .init_verbs = { alc880_volume_init_verbs,
3127 alc880_pin_w810_init_verbs,
3128 alc880_gpio2_init_verbs },
3129 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3130 .dac_nids = alc880_w810_dac_nids,
3131 .dig_out_nid = ALC880_DIGOUT_NID,
3132 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3133 .channel_mode = alc880_w810_modes,
3134 .input_mux = &alc880_capture_source,
3137 .mixers = { alc880_z71v_mixer },
3138 .init_verbs = { alc880_volume_init_verbs,
3139 alc880_pin_z71v_init_verbs },
3140 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3141 .dac_nids = alc880_z71v_dac_nids,
3142 .dig_out_nid = ALC880_DIGOUT_NID,
3144 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3145 .channel_mode = alc880_2_jack_modes,
3146 .input_mux = &alc880_capture_source,
3149 .mixers = { alc880_f1734_mixer },
3150 .init_verbs = { alc880_volume_init_verbs,
3151 alc880_pin_f1734_init_verbs },
3152 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3153 .dac_nids = alc880_f1734_dac_nids,
3155 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3156 .channel_mode = alc880_2_jack_modes,
3157 .input_mux = &alc880_f1734_capture_source,
3158 .unsol_event = alc880_uniwill_p53_unsol_event,
3159 .init_hook = alc880_uniwill_p53_hp_automute,
3162 .mixers = { alc880_asus_mixer },
3163 .init_verbs = { alc880_volume_init_verbs,
3164 alc880_pin_asus_init_verbs,
3165 alc880_gpio1_init_verbs },
3166 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3167 .dac_nids = alc880_asus_dac_nids,
3168 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3169 .channel_mode = alc880_asus_modes,
3171 .input_mux = &alc880_capture_source,
3173 [ALC880_ASUS_DIG] = {
3174 .mixers = { alc880_asus_mixer },
3175 .init_verbs = { alc880_volume_init_verbs,
3176 alc880_pin_asus_init_verbs,
3177 alc880_gpio1_init_verbs },
3178 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3179 .dac_nids = alc880_asus_dac_nids,
3180 .dig_out_nid = ALC880_DIGOUT_NID,
3181 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3182 .channel_mode = alc880_asus_modes,
3184 .input_mux = &alc880_capture_source,
3186 [ALC880_ASUS_DIG2] = {
3187 .mixers = { alc880_asus_mixer },
3188 .init_verbs = { alc880_volume_init_verbs,
3189 alc880_pin_asus_init_verbs,
3190 alc880_gpio2_init_verbs }, /* use GPIO2 */
3191 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3192 .dac_nids = alc880_asus_dac_nids,
3193 .dig_out_nid = ALC880_DIGOUT_NID,
3194 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3195 .channel_mode = alc880_asus_modes,
3197 .input_mux = &alc880_capture_source,
3199 [ALC880_ASUS_W1V] = {
3200 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3201 .init_verbs = { alc880_volume_init_verbs,
3202 alc880_pin_asus_init_verbs,
3203 alc880_gpio1_init_verbs },
3204 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3205 .dac_nids = alc880_asus_dac_nids,
3206 .dig_out_nid = ALC880_DIGOUT_NID,
3207 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3208 .channel_mode = alc880_asus_modes,
3210 .input_mux = &alc880_capture_source,
3212 [ALC880_UNIWILL_DIG] = {
3213 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3214 .init_verbs = { alc880_volume_init_verbs,
3215 alc880_pin_asus_init_verbs },
3216 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3217 .dac_nids = alc880_asus_dac_nids,
3218 .dig_out_nid = ALC880_DIGOUT_NID,
3219 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3220 .channel_mode = alc880_asus_modes,
3222 .input_mux = &alc880_capture_source,
3224 [ALC880_UNIWILL] = {
3225 .mixers = { alc880_uniwill_mixer },
3226 .init_verbs = { alc880_volume_init_verbs,
3227 alc880_uniwill_init_verbs },
3228 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3229 .dac_nids = alc880_asus_dac_nids,
3230 .dig_out_nid = ALC880_DIGOUT_NID,
3231 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3232 .channel_mode = alc880_threestack_modes,
3234 .input_mux = &alc880_capture_source,
3235 .unsol_event = alc880_uniwill_unsol_event,
3236 .init_hook = alc880_uniwill_automute,
3238 [ALC880_UNIWILL_P53] = {
3239 .mixers = { alc880_uniwill_p53_mixer },
3240 .init_verbs = { alc880_volume_init_verbs,
3241 alc880_uniwill_p53_init_verbs },
3242 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3243 .dac_nids = alc880_asus_dac_nids,
3244 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3245 .channel_mode = alc880_threestack_modes,
3246 .input_mux = &alc880_capture_source,
3247 .unsol_event = alc880_uniwill_p53_unsol_event,
3248 .init_hook = alc880_uniwill_p53_hp_automute,
3250 [ALC880_FUJITSU] = {
3251 .mixers = { alc880_fujitsu_mixer,
3252 alc880_pcbeep_mixer, },
3253 .init_verbs = { alc880_volume_init_verbs,
3254 alc880_uniwill_p53_init_verbs,
3255 alc880_beep_init_verbs },
3256 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3257 .dac_nids = alc880_dac_nids,
3258 .dig_out_nid = ALC880_DIGOUT_NID,
3259 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3260 .channel_mode = alc880_2_jack_modes,
3261 .input_mux = &alc880_capture_source,
3262 .unsol_event = alc880_uniwill_p53_unsol_event,
3263 .init_hook = alc880_uniwill_p53_hp_automute,
3266 .mixers = { alc880_three_stack_mixer },
3267 .init_verbs = { alc880_volume_init_verbs,
3268 alc880_pin_clevo_init_verbs },
3269 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3270 .dac_nids = alc880_dac_nids,
3272 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3273 .channel_mode = alc880_threestack_modes,
3275 .input_mux = &alc880_capture_source,
3278 .mixers = { alc880_lg_mixer },
3279 .init_verbs = { alc880_volume_init_verbs,
3280 alc880_lg_init_verbs },
3281 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3282 .dac_nids = alc880_lg_dac_nids,
3283 .dig_out_nid = ALC880_DIGOUT_NID,
3284 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3285 .channel_mode = alc880_lg_ch_modes,
3287 .input_mux = &alc880_lg_capture_source,
3288 .unsol_event = alc880_lg_unsol_event,
3289 .init_hook = alc880_lg_automute,
3290 #ifdef CONFIG_SND_HDA_POWER_SAVE
3291 .loopbacks = alc880_lg_loopbacks,
3295 .mixers = { alc880_lg_lw_mixer },
3296 .init_verbs = { alc880_volume_init_verbs,
3297 alc880_lg_lw_init_verbs },
3298 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3299 .dac_nids = alc880_dac_nids,
3300 .dig_out_nid = ALC880_DIGOUT_NID,
3301 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3302 .channel_mode = alc880_lg_lw_modes,
3303 .input_mux = &alc880_lg_lw_capture_source,
3304 .unsol_event = alc880_lg_lw_unsol_event,
3305 .init_hook = alc880_lg_lw_automute,
3307 [ALC880_MEDION_RIM] = {
3308 .mixers = { alc880_medion_rim_mixer },
3309 .init_verbs = { alc880_volume_init_verbs,
3310 alc880_medion_rim_init_verbs,
3311 alc_gpio2_init_verbs },
3312 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3313 .dac_nids = alc880_dac_nids,
3314 .dig_out_nid = ALC880_DIGOUT_NID,
3315 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3316 .channel_mode = alc880_2_jack_modes,
3317 .input_mux = &alc880_medion_rim_capture_source,
3318 .unsol_event = alc880_medion_rim_unsol_event,
3319 .init_hook = alc880_medion_rim_automute,
3321 #ifdef CONFIG_SND_DEBUG
3323 .mixers = { alc880_test_mixer },
3324 .init_verbs = { alc880_test_init_verbs },
3325 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3326 .dac_nids = alc880_test_dac_nids,
3327 .dig_out_nid = ALC880_DIGOUT_NID,
3328 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3329 .channel_mode = alc880_test_modes,
3330 .input_mux = &alc880_test_capture_source,
3336 * Automatic parse of I/O pins from the BIOS configuration
3339 #define NUM_CONTROL_ALLOC 32
3340 #define NUM_VERB_ALLOC 32
3344 ALC_CTL_WIDGET_MUTE,
3347 static struct snd_kcontrol_new alc880_control_templates[] = {
3348 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3349 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3350 HDA_BIND_MUTE(NULL, 0, 0, 0),
3353 /* add dynamic controls */
3354 static int add_control(struct alc_spec *spec, int type, const char *name,
3357 struct snd_kcontrol_new *knew;
3359 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3360 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3362 /* array + terminator */
3363 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3366 if (spec->kctl_alloc) {
3367 memcpy(knew, spec->kctl_alloc,
3368 sizeof(*knew) * spec->num_kctl_alloc);
3369 kfree(spec->kctl_alloc);
3371 spec->kctl_alloc = knew;
3372 spec->num_kctl_alloc = num;
3375 knew = &spec->kctl_alloc[spec->num_kctl_used];
3376 *knew = alc880_control_templates[type];
3377 knew->name = kstrdup(name, GFP_KERNEL);
3380 knew->private_value = val;
3381 spec->num_kctl_used++;
3385 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3386 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3387 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3388 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3389 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3390 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3391 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3392 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3393 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3394 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3395 #define ALC880_PIN_CD_NID 0x1c
3397 /* fill in the dac_nids table from the parsed pin configuration */
3398 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3399 const struct auto_pin_cfg *cfg)
3405 memset(assigned, 0, sizeof(assigned));
3406 spec->multiout.dac_nids = spec->private_dac_nids;
3408 /* check the pins hardwired to audio widget */
3409 for (i = 0; i < cfg->line_outs; i++) {
3410 nid = cfg->line_out_pins[i];
3411 if (alc880_is_fixed_pin(nid)) {
3412 int idx = alc880_fixed_pin_idx(nid);
3413 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3417 /* left pins can be connect to any audio widget */
3418 for (i = 0; i < cfg->line_outs; i++) {
3419 nid = cfg->line_out_pins[i];
3420 if (alc880_is_fixed_pin(nid))
3422 /* search for an empty channel */
3423 for (j = 0; j < cfg->line_outs; j++) {
3425 spec->multiout.dac_nids[i] =
3426 alc880_idx_to_dac(j);
3432 spec->multiout.num_dacs = cfg->line_outs;
3436 /* add playback controls from the parsed DAC table */
3437 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3438 const struct auto_pin_cfg *cfg)
3441 static const char *chname[4] = {
3442 "Front", "Surround", NULL /*CLFE*/, "Side"
3447 for (i = 0; i < cfg->line_outs; i++) {
3448 if (!spec->multiout.dac_nids[i])
3450 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3453 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3454 "Center Playback Volume",
3455 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3459 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3460 "LFE Playback Volume",
3461 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3465 err = add_control(spec, ALC_CTL_BIND_MUTE,
3466 "Center Playback Switch",
3467 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3471 err = add_control(spec, ALC_CTL_BIND_MUTE,
3472 "LFE Playback Switch",
3473 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3478 sprintf(name, "%s Playback Volume", chname[i]);
3479 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3480 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3484 sprintf(name, "%s Playback Switch", chname[i]);
3485 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3486 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3495 /* add playback controls for speaker and HP outputs */
3496 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3506 if (alc880_is_fixed_pin(pin)) {
3507 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3508 /* specify the DAC as the extra output */
3509 if (!spec->multiout.hp_nid)
3510 spec->multiout.hp_nid = nid;
3512 spec->multiout.extra_out_nid[0] = nid;
3513 /* control HP volume/switch on the output mixer amp */
3514 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3515 sprintf(name, "%s Playback Volume", pfx);
3516 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3517 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3520 sprintf(name, "%s Playback Switch", pfx);
3521 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3522 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3525 } else if (alc880_is_multi_pin(pin)) {
3526 /* set manual connection */
3527 /* we have only a switch on HP-out PIN */
3528 sprintf(name, "%s Playback Switch", pfx);
3529 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3530 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3537 /* create input playback/capture controls for the given pin */
3538 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3539 const char *ctlname,
3540 int idx, hda_nid_t mix_nid)
3545 sprintf(name, "%s Playback Volume", ctlname);
3546 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3547 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3550 sprintf(name, "%s Playback Switch", ctlname);
3551 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3552 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3558 /* create playback/capture controls for input pins */
3559 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3560 const struct auto_pin_cfg *cfg)
3562 struct hda_input_mux *imux = &spec->private_imux;
3565 for (i = 0; i < AUTO_PIN_LAST; i++) {
3566 if (alc880_is_input_pin(cfg->input_pins[i])) {
3567 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3568 err = new_analog_input(spec, cfg->input_pins[i],
3569 auto_pin_cfg_labels[i],
3573 imux->items[imux->num_items].label =
3574 auto_pin_cfg_labels[i];
3575 imux->items[imux->num_items].index =
3576 alc880_input_pin_idx(cfg->input_pins[i]);
3583 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3584 unsigned int pin_type)
3586 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3589 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3593 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3594 hda_nid_t nid, int pin_type,
3597 alc_set_pin_output(codec, nid, pin_type);
3598 /* need the manual connection? */
3599 if (alc880_is_multi_pin(nid)) {
3600 struct alc_spec *spec = codec->spec;
3601 int idx = alc880_multi_pin_idx(nid);
3602 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3603 AC_VERB_SET_CONNECT_SEL,
3604 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3608 static int get_pin_type(int line_out_type)
3610 if (line_out_type == AUTO_PIN_HP_OUT)
3616 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3618 struct alc_spec *spec = codec->spec;
3621 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3622 for (i = 0; i < spec->autocfg.line_outs; i++) {
3623 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3624 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3625 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3629 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3631 struct alc_spec *spec = codec->spec;
3634 pin = spec->autocfg.speaker_pins[0];
3635 if (pin) /* connect to front */
3636 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3637 pin = spec->autocfg.hp_pins[0];
3638 if (pin) /* connect to front */
3639 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3642 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3644 struct alc_spec *spec = codec->spec;
3647 for (i = 0; i < AUTO_PIN_LAST; i++) {
3648 hda_nid_t nid = spec->autocfg.input_pins[i];
3649 if (alc880_is_input_pin(nid)) {
3650 snd_hda_codec_write(codec, nid, 0,
3651 AC_VERB_SET_PIN_WIDGET_CONTROL,
3652 i <= AUTO_PIN_FRONT_MIC ?
3653 PIN_VREF80 : PIN_IN);
3654 if (nid != ALC880_PIN_CD_NID)
3655 snd_hda_codec_write(codec, nid, 0,
3656 AC_VERB_SET_AMP_GAIN_MUTE,
3662 /* parse the BIOS configuration and set up the alc_spec */
3663 /* return 1 if successful, 0 if the proper config is not found,
3664 * or a negative error code
3666 static int alc880_parse_auto_config(struct hda_codec *codec)
3668 struct alc_spec *spec = codec->spec;
3670 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3672 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3676 if (!spec->autocfg.line_outs)
3677 return 0; /* can't find valid BIOS pin config */
3679 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3682 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3685 err = alc880_auto_create_extra_out(spec,
3686 spec->autocfg.speaker_pins[0],
3690 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3694 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3698 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3700 if (spec->autocfg.dig_out_pin)
3701 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3702 if (spec->autocfg.dig_in_pin)
3703 spec->dig_in_nid = ALC880_DIGIN_NID;
3705 if (spec->kctl_alloc)
3706 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3708 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3710 spec->num_mux_defs = 1;
3711 spec->input_mux = &spec->private_imux;
3716 /* additional initialization for auto-configuration model */
3717 static void alc880_auto_init(struct hda_codec *codec)
3719 struct alc_spec *spec = codec->spec;
3720 alc880_auto_init_multi_out(codec);
3721 alc880_auto_init_extra_out(codec);
3722 alc880_auto_init_analog_input(codec);
3723 if (spec->unsol_event)
3724 alc_sku_automute(codec);
3728 * OK, here we have finally the patch for ALC880
3731 static int patch_alc880(struct hda_codec *codec)
3733 struct alc_spec *spec;
3737 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3743 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3746 if (board_config < 0) {
3747 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3748 "trying auto-probe from BIOS...\n");
3749 board_config = ALC880_AUTO;
3752 if (board_config == ALC880_AUTO) {
3753 /* automatic parse from the BIOS config */
3754 err = alc880_parse_auto_config(codec);
3760 "hda_codec: Cannot set up configuration "
3761 "from BIOS. Using 3-stack mode...\n");
3762 board_config = ALC880_3ST;
3766 if (board_config != ALC880_AUTO)
3767 setup_preset(spec, &alc880_presets[board_config]);
3769 spec->stream_name_analog = "ALC880 Analog";
3770 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3771 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3772 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3774 spec->stream_name_digital = "ALC880 Digital";
3775 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3776 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3778 if (!spec->adc_nids && spec->input_mux) {
3779 /* check whether NID 0x07 is valid */
3780 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3782 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3783 if (wcap != AC_WID_AUD_IN) {
3784 spec->adc_nids = alc880_adc_nids_alt;
3785 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3786 spec->mixers[spec->num_mixers] =
3787 alc880_capture_alt_mixer;
3790 spec->adc_nids = alc880_adc_nids;
3791 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3792 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3797 spec->vmaster_nid = 0x0c;
3799 codec->patch_ops = alc_patch_ops;
3800 if (board_config == ALC880_AUTO)
3801 spec->init_hook = alc880_auto_init;
3802 #ifdef CONFIG_SND_HDA_POWER_SAVE
3803 if (!spec->loopback.amplist)
3804 spec->loopback.amplist = alc880_loopbacks;
3815 static hda_nid_t alc260_dac_nids[1] = {
3820 static hda_nid_t alc260_adc_nids[1] = {
3825 static hda_nid_t alc260_adc_nids_alt[1] = {
3830 static hda_nid_t alc260_hp_adc_nids[2] = {
3835 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3836 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3838 static hda_nid_t alc260_dual_adc_nids[2] = {
3843 #define ALC260_DIGOUT_NID 0x03
3844 #define ALC260_DIGIN_NID 0x06
3846 static struct hda_input_mux alc260_capture_source = {
3850 { "Front Mic", 0x1 },
3856 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3857 * headphone jack and the internal CD lines since these are the only pins at
3858 * which audio can appear. For flexibility, also allow the option of
3859 * recording the mixer output on the second ADC (ADC0 doesn't have a
3860 * connection to the mixer output).
3862 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3866 { "Mic/Line", 0x0 },
3868 { "Headphone", 0x2 },
3874 { "Mic/Line", 0x0 },
3876 { "Headphone", 0x2 },
3883 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3884 * the Fujitsu S702x, but jacks are marked differently.
3886 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3893 { "Headphone", 0x5 },
3902 { "Headphone", 0x6 },
3908 * This is just place-holder, so there's something for alc_build_pcms to look
3909 * at when it calculates the maximum number of channels. ALC260 has no mixer
3910 * element which allows changing the channel mode, so the verb list is
3913 static struct hda_channel_mode alc260_modes[1] = {
3918 /* Mixer combinations
3920 * basic: base_output + input + pc_beep + capture
3921 * HP: base_output + input + capture_alt
3922 * HP_3013: hp_3013 + input + capture
3923 * fujitsu: fujitsu + capture
3924 * acer: acer + capture
3927 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3928 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3929 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3930 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3931 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3932 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3933 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3937 static struct snd_kcontrol_new alc260_input_mixer[] = {
3938 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3939 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3940 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3941 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3943 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3944 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3945 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3949 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3950 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3951 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3955 /* update HP, line and mono out pins according to the master switch */
3956 static void alc260_hp_master_update(struct hda_codec *codec,
3957 hda_nid_t hp, hda_nid_t line,
3960 struct alc_spec *spec = codec->spec;
3961 unsigned int val = spec->master_sw ? PIN_HP : 0;
3962 /* change HP and line-out pins */
3963 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3965 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3967 /* mono (speaker) depending on the HP jack sense */
3968 val = (val && !spec->jack_present) ? PIN_OUT : 0;
3969 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3973 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
3974 struct snd_ctl_elem_value *ucontrol)
3976 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3977 struct alc_spec *spec = codec->spec;
3978 *ucontrol->value.integer.value = spec->master_sw;
3982 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
3983 struct snd_ctl_elem_value *ucontrol)
3985 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3986 struct alc_spec *spec = codec->spec;
3987 int val = !!*ucontrol->value.integer.value;
3988 hda_nid_t hp, line, mono;
3990 if (val == spec->master_sw)
3992 spec->master_sw = val;
3993 hp = (kcontrol->private_value >> 16) & 0xff;
3994 line = (kcontrol->private_value >> 8) & 0xff;
3995 mono = kcontrol->private_value & 0xff;
3996 alc260_hp_master_update(codec, hp, line, mono);
4000 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4003 .name = "Master Playback Switch",
4004 .info = snd_ctl_boolean_mono_info,
4005 .get = alc260_hp_master_sw_get,
4006 .put = alc260_hp_master_sw_put,
4007 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4009 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4010 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4011 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4012 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4013 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4015 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4019 static struct hda_verb alc260_hp_unsol_verbs[] = {
4020 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4024 static void alc260_hp_automute(struct hda_codec *codec)
4026 struct alc_spec *spec = codec->spec;
4027 unsigned int present;
4029 present = snd_hda_codec_read(codec, 0x10, 0,
4030 AC_VERB_GET_PIN_SENSE, 0);
4031 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4032 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4035 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4037 if ((res >> 26) == ALC880_HP_EVENT)
4038 alc260_hp_automute(codec);
4041 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4043 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4044 .name = "Master Playback Switch",
4045 .info = snd_ctl_boolean_mono_info,
4046 .get = alc260_hp_master_sw_get,
4047 .put = alc260_hp_master_sw_put,
4048 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4050 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4051 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4052 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4053 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4054 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4056 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4057 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4061 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4062 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4066 static void alc260_hp_3013_automute(struct hda_codec *codec)
4068 struct alc_spec *spec = codec->spec;
4069 unsigned int present;
4071 present = snd_hda_codec_read(codec, 0x15, 0,
4072 AC_VERB_GET_PIN_SENSE, 0);
4073 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4074 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4077 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4080 if ((res >> 26) == ALC880_HP_EVENT)
4081 alc260_hp_3013_automute(codec);
4084 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4085 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4087 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4088 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4089 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4090 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4091 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4092 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4093 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4094 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4095 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4096 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4097 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4098 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4099 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4103 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4104 * versions of the ALC260 don't act on requests to enable mic bias from NID
4105 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4106 * datasheet doesn't mention this restriction. At this stage it's not clear
4107 * whether this behaviour is intentional or is a hardware bug in chip
4108 * revisions available in early 2006. Therefore for now allow the
4109 * "Headphone Jack Mode" control to span all choices, but if it turns out
4110 * that the lack of mic bias for this NID is intentional we could change the
4111 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4113 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4114 * don't appear to make the mic bias available from the "line" jack, even
4115 * though the NID used for this jack (0x14) can supply it. The theory is
4116 * that perhaps Acer have included blocking capacitors between the ALC260
4117 * and the output jack. If this turns out to be the case for all such
4118 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4119 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4121 * The C20x Tablet series have a mono internal speaker which is controlled
4122 * via the chip's Mono sum widget and pin complex, so include the necessary
4123 * controls for such models. On models without a "mono speaker" the control
4124 * won't do anything.
4126 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4127 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4128 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4129 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4130 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4132 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4134 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4135 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4137 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4138 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4139 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4140 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4141 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4142 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4143 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4147 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4148 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4150 static struct snd_kcontrol_new alc260_will_mixer[] = {
4151 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4152 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4154 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4155 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4156 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4157 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4158 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4159 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4160 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4161 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4162 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4166 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4167 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4169 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4170 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4171 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4173 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4174 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4175 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4176 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4177 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4178 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4179 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4183 /* capture mixer elements */
4184 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4185 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4186 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4187 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4188 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4190 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4191 /* The multiple "Capture Source" controls confuse alsamixer
4192 * So call somewhat different..
4194 /* .name = "Capture Source", */
4195 .name = "Input Source",
4197 .info = alc_mux_enum_info,
4198 .get = alc_mux_enum_get,
4199 .put = alc_mux_enum_put,
4204 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4205 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4206 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4209 /* The multiple "Capture Source" controls confuse alsamixer
4210 * So call somewhat different..
4212 /* .name = "Capture Source", */
4213 .name = "Input Source",
4215 .info = alc_mux_enum_info,
4216 .get = alc_mux_enum_get,
4217 .put = alc_mux_enum_put,
4223 * initialization verbs
4225 static struct hda_verb alc260_init_verbs[] = {
4226 /* Line In pin widget for input */
4227 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4228 /* CD pin widget for input */
4229 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4230 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4231 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4232 /* Mic2 (front panel) pin widget for input and vref at 80% */
4233 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4234 /* LINE-2 is used for line-out in rear */
4235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4236 /* select line-out */
4237 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4239 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4241 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4243 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4244 /* mute capture amp left and right */
4245 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4246 /* set connection select to line in (default select for this ADC) */
4247 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4248 /* mute capture amp left and right */
4249 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4250 /* set connection select to line in (default select for this ADC) */
4251 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4252 /* set vol=0 Line-Out mixer amp left and right */
4253 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4254 /* unmute pin widget amp left and right (no gain on this amp) */
4255 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4256 /* set vol=0 HP mixer amp left and right */
4257 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4258 /* unmute pin widget amp left and right (no gain on this amp) */
4259 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4260 /* set vol=0 Mono mixer amp left and right */
4261 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4262 /* unmute pin widget amp left and right (no gain on this amp) */
4263 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4264 /* unmute LINE-2 out pin */
4265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4266 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4269 /* mute analog inputs */
4270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4275 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4276 /* mute Front out path */
4277 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4278 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4279 /* mute Headphone out path */
4280 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4281 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4282 /* mute Mono out path */
4283 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4284 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4288 #if 0 /* should be identical with alc260_init_verbs? */
4289 static struct hda_verb alc260_hp_init_verbs[] = {
4290 /* Headphone and output */
4291 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4293 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4294 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4295 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4296 /* Mic2 (front panel) pin widget for input and vref at 80% */
4297 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4298 /* Line In pin widget for input */
4299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4300 /* Line-2 pin widget for output */
4301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4302 /* CD pin widget for input */
4303 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4304 /* unmute amp left and right */
4305 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4306 /* set connection select to line in (default select for this ADC) */
4307 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4308 /* unmute Line-Out mixer amp left and right (volume = 0) */
4309 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4310 /* mute pin widget amp left and right (no gain on this amp) */
4311 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4312 /* unmute HP mixer amp left and right (volume = 0) */
4313 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4314 /* mute pin widget amp left and right (no gain on this amp) */
4315 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4316 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4319 /* mute analog inputs */
4320 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4321 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4324 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4325 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4326 /* Unmute Front out path */
4327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4328 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4329 /* Unmute Headphone out path */
4330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4331 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4332 /* Unmute Mono out path */
4333 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4334 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4339 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4340 /* Line out and output */
4341 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4343 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4344 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4345 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4346 /* Mic2 (front panel) pin widget for input and vref at 80% */
4347 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4348 /* Line In pin widget for input */
4349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4350 /* Headphone pin widget for output */
4351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4352 /* CD pin widget for input */
4353 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4354 /* unmute amp left and right */
4355 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4356 /* set connection select to line in (default select for this ADC) */
4357 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4358 /* unmute Line-Out mixer amp left and right (volume = 0) */
4359 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4360 /* mute pin widget amp left and right (no gain on this amp) */
4361 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4362 /* unmute HP mixer amp left and right (volume = 0) */
4363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4364 /* mute pin widget amp left and right (no gain on this amp) */
4365 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4366 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4369 /* mute analog inputs */
4370 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4371 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4375 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4376 /* Unmute Front out path */
4377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4379 /* Unmute Headphone out path */
4380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4382 /* Unmute Mono out path */
4383 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4384 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4388 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4389 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4390 * audio = 0x16, internal speaker = 0x10.
4392 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4393 /* Disable all GPIOs */
4394 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4395 /* Internal speaker is connected to headphone pin */
4396 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4397 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4398 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4399 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4400 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4401 /* Ensure all other unused pins are disabled and muted. */
4402 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4403 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4404 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4405 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4406 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4407 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4409 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4411 /* Disable digital (SPDIF) pins */
4412 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4413 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4415 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4416 * when acting as an output.
4418 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4420 /* Start with output sum widgets muted and their output gains at min */
4421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4423 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4426 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4427 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4428 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4429 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4431 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4432 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4433 /* Unmute Line1 pin widget output buffer since it starts as an output.
4434 * If the pin mode is changed by the user the pin mode control will
4435 * take care of enabling the pin's input/output buffers as needed.
4436 * Therefore there's no need to enable the input buffer at this
4439 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4440 /* Unmute input buffer of pin widget used for Line-in (no equiv
4443 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4445 /* Mute capture amp left and right */
4446 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4447 /* Set ADC connection select to match default mixer setting - line
4450 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4452 /* Do the same for the second ADC: mute capture input amp and
4453 * set ADC connection to line in (on mic1 pin)
4455 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4456 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4458 /* Mute all inputs to mixer widget (even unconnected ones) */
4459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4463 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4464 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4465 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4466 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4471 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4472 * similar laptops (adapted from Fujitsu init verbs).
4474 static struct hda_verb alc260_acer_init_verbs[] = {
4475 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4476 * the headphone jack. Turn this on and rely on the standard mute
4477 * methods whenever the user wants to turn these outputs off.
4479 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4480 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4481 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4482 /* Internal speaker/Headphone jack is connected to Line-out pin */
4483 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4484 /* Internal microphone/Mic jack is connected to Mic1 pin */
4485 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4486 /* Line In jack is connected to Line1 pin */
4487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4488 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4489 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4490 /* Ensure all other unused pins are disabled and muted. */
4491 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4492 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4493 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4494 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4497 /* Disable digital (SPDIF) pins */
4498 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4499 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4501 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4502 * bus when acting as outputs.
4504 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4505 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4507 /* Start with output sum widgets muted and their output gains at min */
4508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4510 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4513 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4514 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4515 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4516 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4518 /* Unmute Line-out pin widget amp left and right
4519 * (no equiv mixer ctrl)
4521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4522 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4523 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4524 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4525 * inputs. If the pin mode is changed by the user the pin mode control
4526 * will take care of enabling the pin's input/output buffers as needed.
4527 * Therefore there's no need to enable the input buffer at this
4530 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4531 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4533 /* Mute capture amp left and right */
4534 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4535 /* Set ADC connection select to match default mixer setting - mic
4538 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4540 /* Do similar with the second ADC: mute capture input amp and
4541 * set ADC connection to mic to match ALSA's default state.
4543 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4544 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4546 /* Mute all inputs to mixer widget (even unconnected ones) */
4547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4559 static struct hda_verb alc260_will_verbs[] = {
4560 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4561 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4562 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4563 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4564 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4565 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4569 static struct hda_verb alc260_replacer_672v_verbs[] = {
4570 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4571 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4572 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4574 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4575 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4576 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4578 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4582 /* toggle speaker-output according to the hp-jack state */
4583 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4585 unsigned int present;
4587 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4588 present = snd_hda_codec_read(codec, 0x0f, 0,
4589 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4591 snd_hda_codec_write_cache(codec, 0x01, 0,
4592 AC_VERB_SET_GPIO_DATA, 1);
4593 snd_hda_codec_write_cache(codec, 0x0f, 0,
4594 AC_VERB_SET_PIN_WIDGET_CONTROL,
4597 snd_hda_codec_write_cache(codec, 0x01, 0,
4598 AC_VERB_SET_GPIO_DATA, 0);
4599 snd_hda_codec_write_cache(codec, 0x0f, 0,
4600 AC_VERB_SET_PIN_WIDGET_CONTROL,
4605 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4608 if ((res >> 26) == ALC880_HP_EVENT)
4609 alc260_replacer_672v_automute(codec);
4612 /* Test configuration for debugging, modelled after the ALC880 test
4615 #ifdef CONFIG_SND_DEBUG
4616 static hda_nid_t alc260_test_dac_nids[1] = {
4619 static hda_nid_t alc260_test_adc_nids[2] = {
4622 /* For testing the ALC260, each input MUX needs its own definition since
4623 * the signal assignments are different. This assumes that the first ADC
4626 static struct hda_input_mux alc260_test_capture_sources[2] = {
4630 { "MIC1 pin", 0x0 },
4631 { "MIC2 pin", 0x1 },
4632 { "LINE1 pin", 0x2 },
4633 { "LINE2 pin", 0x3 },
4635 { "LINE-OUT pin", 0x5 },
4636 { "HP-OUT pin", 0x6 },
4642 { "MIC1 pin", 0x0 },
4643 { "MIC2 pin", 0x1 },
4644 { "LINE1 pin", 0x2 },
4645 { "LINE2 pin", 0x3 },
4648 { "LINE-OUT pin", 0x6 },
4649 { "HP-OUT pin", 0x7 },
4653 static struct snd_kcontrol_new alc260_test_mixer[] = {
4654 /* Output driver widgets */
4655 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4656 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4657 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4658 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4659 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4660 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4662 /* Modes for retasking pin widgets
4663 * Note: the ALC260 doesn't seem to act on requests to enable mic
4664 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4665 * mention this restriction. At this stage it's not clear whether
4666 * this behaviour is intentional or is a hardware bug in chip
4667 * revisions available at least up until early 2006. Therefore for
4668 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4669 * choices, but if it turns out that the lack of mic bias for these
4670 * NIDs is intentional we could change their modes from
4671 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4673 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4674 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4675 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4676 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4677 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4678 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4680 /* Loopback mixer controls */
4681 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4682 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4683 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4684 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4685 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4686 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4687 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4688 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4689 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4690 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4691 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4692 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4693 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4694 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4695 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4696 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4698 /* Controls for GPIO pins, assuming they are configured as outputs */
4699 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4700 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4701 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4702 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4704 /* Switches to allow the digital IO pins to be enabled. The datasheet
4705 * is ambigious as to which NID is which; testing on laptops which
4706 * make this output available should provide clarification.
4708 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4709 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4711 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4712 * this output to turn on an external amplifier.
4714 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4715 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4719 static struct hda_verb alc260_test_init_verbs[] = {
4720 /* Enable all GPIOs as outputs with an initial value of 0 */
4721 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4722 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4723 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4725 /* Enable retasking pins as output, initially without power amp */
4726 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4727 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4730 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4731 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4733 /* Disable digital (SPDIF) pins initially, but users can enable
4734 * them via a mixer switch. In the case of SPDIF-out, this initverb
4735 * payload also sets the generation to 0, output to be in "consumer"
4736 * PCM format, copyright asserted, no pre-emphasis and no validity
4739 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4740 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4742 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4743 * OUT1 sum bus when acting as an output.
4745 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4746 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4747 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4748 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4750 /* Start with output sum widgets muted and their output gains at min */
4751 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4754 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4755 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4756 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4757 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4758 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4759 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4761 /* Unmute retasking pin widget output buffers since the default
4762 * state appears to be output. As the pin mode is changed by the
4763 * user the pin mode control will take care of enabling the pin's
4764 * input/output buffers as needed.
4766 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4767 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4770 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4771 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4772 /* Also unmute the mono-out pin widget */
4773 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4775 /* Mute capture amp left and right */
4776 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4777 /* Set ADC connection select to match default mixer setting (mic1
4780 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4782 /* Do the same for the second ADC: mute capture input amp and
4783 * set ADC connection to mic1 pin
4785 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4786 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4788 /* Mute all inputs to mixer widget (even unconnected ones) */
4789 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4790 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4794 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4802 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4803 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4805 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4806 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4809 * for BIOS auto-configuration
4812 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4816 unsigned long vol_val, sw_val;
4820 if (nid >= 0x0f && nid < 0x11) {
4821 nid_vol = nid - 0x7;
4822 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4823 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4824 } else if (nid == 0x11) {
4825 nid_vol = nid - 0x7;
4826 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4827 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4828 } else if (nid >= 0x12 && nid <= 0x15) {
4830 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4831 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4835 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4836 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4839 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4840 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4846 /* add playback controls from the parsed DAC table */
4847 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4848 const struct auto_pin_cfg *cfg)
4853 spec->multiout.num_dacs = 1;
4854 spec->multiout.dac_nids = spec->private_dac_nids;
4855 spec->multiout.dac_nids[0] = 0x02;
4857 nid = cfg->line_out_pins[0];
4859 err = alc260_add_playback_controls(spec, nid, "Front");
4864 nid = cfg->speaker_pins[0];
4866 err = alc260_add_playback_controls(spec, nid, "Speaker");
4871 nid = cfg->hp_pins[0];
4873 err = alc260_add_playback_controls(spec, nid, "Headphone");
4880 /* create playback/capture controls for input pins */
4881 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4882 const struct auto_pin_cfg *cfg)
4884 struct hda_input_mux *imux = &spec->private_imux;
4887 for (i = 0; i < AUTO_PIN_LAST; i++) {
4888 if (cfg->input_pins[i] >= 0x12) {
4889 idx = cfg->input_pins[i] - 0x12;
4890 err = new_analog_input(spec, cfg->input_pins[i],
4891 auto_pin_cfg_labels[i], idx,
4895 imux->items[imux->num_items].label =
4896 auto_pin_cfg_labels[i];
4897 imux->items[imux->num_items].index = idx;
4900 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4901 idx = cfg->input_pins[i] - 0x09;
4902 err = new_analog_input(spec, cfg->input_pins[i],
4903 auto_pin_cfg_labels[i], idx,
4907 imux->items[imux->num_items].label =
4908 auto_pin_cfg_labels[i];
4909 imux->items[imux->num_items].index = idx;
4916 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4917 hda_nid_t nid, int pin_type,
4920 alc_set_pin_output(codec, nid, pin_type);
4921 /* need the manual connection? */
4923 int idx = nid - 0x12;
4924 snd_hda_codec_write(codec, idx + 0x0b, 0,
4925 AC_VERB_SET_CONNECT_SEL, sel_idx);
4929 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4931 struct alc_spec *spec = codec->spec;
4934 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4935 nid = spec->autocfg.line_out_pins[0];
4937 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4938 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4941 nid = spec->autocfg.speaker_pins[0];
4943 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4945 nid = spec->autocfg.hp_pins[0];
4947 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4950 #define ALC260_PIN_CD_NID 0x16
4951 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4953 struct alc_spec *spec = codec->spec;
4956 for (i = 0; i < AUTO_PIN_LAST; i++) {
4957 hda_nid_t nid = spec->autocfg.input_pins[i];
4959 snd_hda_codec_write(codec, nid, 0,
4960 AC_VERB_SET_PIN_WIDGET_CONTROL,
4961 i <= AUTO_PIN_FRONT_MIC ?
4962 PIN_VREF80 : PIN_IN);
4963 if (nid != ALC260_PIN_CD_NID)
4964 snd_hda_codec_write(codec, nid, 0,
4965 AC_VERB_SET_AMP_GAIN_MUTE,
4972 * generic initialization of ADC, input mixers and output mixers
4974 static struct hda_verb alc260_volume_init_verbs[] = {
4976 * Unmute ADC0-1 and set the default input to mic-in
4978 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4979 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4980 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4981 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4983 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4985 * Note: PASD motherboards uses the Line In 2 as the input for
4986 * front panel mic (mic 2)
4988 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4989 /* mute analog inputs */
4990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4991 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4992 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4993 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4994 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4997 * Set up output mixers (0x08 - 0x0a)
4999 /* set vol=0 to output mixers */
5000 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5001 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5002 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5003 /* set up input amps for analog loopback */
5004 /* Amp Indices: DAC = 0, mixer = 1 */
5005 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5006 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5007 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5008 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5009 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5010 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5015 static int alc260_parse_auto_config(struct hda_codec *codec)
5017 struct alc_spec *spec = codec->spec;
5020 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5022 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5026 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5029 if (!spec->kctl_alloc)
5030 return 0; /* can't find valid BIOS pin config */
5031 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5035 spec->multiout.max_channels = 2;
5037 if (spec->autocfg.dig_out_pin)
5038 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5039 if (spec->kctl_alloc)
5040 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5042 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5044 spec->num_mux_defs = 1;
5045 spec->input_mux = &spec->private_imux;
5047 /* check whether NID 0x04 is valid */
5048 wcap = get_wcaps(codec, 0x04);
5049 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5050 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5051 spec->adc_nids = alc260_adc_nids_alt;
5052 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5053 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5055 spec->adc_nids = alc260_adc_nids;
5056 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5057 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5064 /* additional initialization for auto-configuration model */
5065 static void alc260_auto_init(struct hda_codec *codec)
5067 struct alc_spec *spec = codec->spec;
5068 alc260_auto_init_multi_out(codec);
5069 alc260_auto_init_analog_input(codec);
5070 if (spec->unsol_event)
5071 alc_sku_automute(codec);
5074 #ifdef CONFIG_SND_HDA_POWER_SAVE
5075 static struct hda_amp_list alc260_loopbacks[] = {
5076 { 0x07, HDA_INPUT, 0 },
5077 { 0x07, HDA_INPUT, 1 },
5078 { 0x07, HDA_INPUT, 2 },
5079 { 0x07, HDA_INPUT, 3 },
5080 { 0x07, HDA_INPUT, 4 },
5086 * ALC260 configurations
5088 static const char *alc260_models[ALC260_MODEL_LAST] = {
5089 [ALC260_BASIC] = "basic",
5091 [ALC260_HP_3013] = "hp-3013",
5092 [ALC260_FUJITSU_S702X] = "fujitsu",
5093 [ALC260_ACER] = "acer",
5094 [ALC260_WILL] = "will",
5095 [ALC260_REPLACER_672V] = "replacer",
5096 #ifdef CONFIG_SND_DEBUG
5097 [ALC260_TEST] = "test",
5099 [ALC260_AUTO] = "auto",
5102 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5103 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5104 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5105 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5106 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5107 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5108 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
5109 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5110 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5111 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5112 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5113 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5114 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5115 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5116 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5117 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5118 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5119 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5120 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5124 static struct alc_config_preset alc260_presets[] = {
5126 .mixers = { alc260_base_output_mixer,
5128 alc260_pc_beep_mixer,
5129 alc260_capture_mixer },
5130 .init_verbs = { alc260_init_verbs },
5131 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5132 .dac_nids = alc260_dac_nids,
5133 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5134 .adc_nids = alc260_adc_nids,
5135 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5136 .channel_mode = alc260_modes,
5137 .input_mux = &alc260_capture_source,
5140 .mixers = { alc260_hp_output_mixer,
5142 alc260_capture_alt_mixer },
5143 .init_verbs = { alc260_init_verbs,
5144 alc260_hp_unsol_verbs },
5145 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5146 .dac_nids = alc260_dac_nids,
5147 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5148 .adc_nids = alc260_hp_adc_nids,
5149 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5150 .channel_mode = alc260_modes,
5151 .input_mux = &alc260_capture_source,
5152 .unsol_event = alc260_hp_unsol_event,
5153 .init_hook = alc260_hp_automute,
5155 [ALC260_HP_3013] = {
5156 .mixers = { alc260_hp_3013_mixer,
5158 alc260_capture_alt_mixer },
5159 .init_verbs = { alc260_hp_3013_init_verbs,
5160 alc260_hp_3013_unsol_verbs },
5161 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5162 .dac_nids = alc260_dac_nids,
5163 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5164 .adc_nids = alc260_hp_adc_nids,
5165 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5166 .channel_mode = alc260_modes,
5167 .input_mux = &alc260_capture_source,
5168 .unsol_event = alc260_hp_3013_unsol_event,
5169 .init_hook = alc260_hp_3013_automute,
5171 [ALC260_FUJITSU_S702X] = {
5172 .mixers = { alc260_fujitsu_mixer,
5173 alc260_capture_mixer },
5174 .init_verbs = { alc260_fujitsu_init_verbs },
5175 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5176 .dac_nids = alc260_dac_nids,
5177 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5178 .adc_nids = alc260_dual_adc_nids,
5179 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5180 .channel_mode = alc260_modes,
5181 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5182 .input_mux = alc260_fujitsu_capture_sources,
5185 .mixers = { alc260_acer_mixer,
5186 alc260_capture_mixer },
5187 .init_verbs = { alc260_acer_init_verbs },
5188 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5189 .dac_nids = alc260_dac_nids,
5190 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5191 .adc_nids = alc260_dual_adc_nids,
5192 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5193 .channel_mode = alc260_modes,
5194 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5195 .input_mux = alc260_acer_capture_sources,
5198 .mixers = { alc260_will_mixer,
5199 alc260_capture_mixer },
5200 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5201 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5202 .dac_nids = alc260_dac_nids,
5203 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5204 .adc_nids = alc260_adc_nids,
5205 .dig_out_nid = ALC260_DIGOUT_NID,
5206 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5207 .channel_mode = alc260_modes,
5208 .input_mux = &alc260_capture_source,
5210 [ALC260_REPLACER_672V] = {
5211 .mixers = { alc260_replacer_672v_mixer,
5212 alc260_capture_mixer },
5213 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5214 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5215 .dac_nids = alc260_dac_nids,
5216 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5217 .adc_nids = alc260_adc_nids,
5218 .dig_out_nid = ALC260_DIGOUT_NID,
5219 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5220 .channel_mode = alc260_modes,
5221 .input_mux = &alc260_capture_source,
5222 .unsol_event = alc260_replacer_672v_unsol_event,
5223 .init_hook = alc260_replacer_672v_automute,
5225 #ifdef CONFIG_SND_DEBUG
5227 .mixers = { alc260_test_mixer,
5228 alc260_capture_mixer },
5229 .init_verbs = { alc260_test_init_verbs },
5230 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5231 .dac_nids = alc260_test_dac_nids,
5232 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5233 .adc_nids = alc260_test_adc_nids,
5234 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5235 .channel_mode = alc260_modes,
5236 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5237 .input_mux = alc260_test_capture_sources,
5242 static int patch_alc260(struct hda_codec *codec)
5244 struct alc_spec *spec;
5245 int err, board_config;
5247 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5253 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5256 if (board_config < 0) {
5257 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5258 "trying auto-probe from BIOS...\n");
5259 board_config = ALC260_AUTO;
5262 if (board_config == ALC260_AUTO) {
5263 /* automatic parse from the BIOS config */
5264 err = alc260_parse_auto_config(codec);
5270 "hda_codec: Cannot set up configuration "
5271 "from BIOS. Using base mode...\n");
5272 board_config = ALC260_BASIC;
5276 if (board_config != ALC260_AUTO)
5277 setup_preset(spec, &alc260_presets[board_config]);
5279 spec->stream_name_analog = "ALC260 Analog";
5280 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5281 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5283 spec->stream_name_digital = "ALC260 Digital";
5284 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5285 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5287 spec->vmaster_nid = 0x08;
5289 codec->patch_ops = alc_patch_ops;
5290 if (board_config == ALC260_AUTO)
5291 spec->init_hook = alc260_auto_init;
5292 #ifdef CONFIG_SND_HDA_POWER_SAVE
5293 if (!spec->loopback.amplist)
5294 spec->loopback.amplist = alc260_loopbacks;
5304 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5305 * configuration. Each pin widget can choose any input DACs and a mixer.
5306 * Each ADC is connected from a mixer of all inputs. This makes possible
5307 * 6-channel independent captures.
5309 * In addition, an independent DAC for the multi-playback (not used in this
5312 #define ALC882_DIGOUT_NID 0x06
5313 #define ALC882_DIGIN_NID 0x0a
5315 static struct hda_channel_mode alc882_ch_modes[1] = {
5319 static hda_nid_t alc882_dac_nids[4] = {
5320 /* front, rear, clfe, rear_surr */
5321 0x02, 0x03, 0x04, 0x05
5324 /* identical with ALC880 */
5325 #define alc882_adc_nids alc880_adc_nids
5326 #define alc882_adc_nids_alt alc880_adc_nids_alt
5328 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5329 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5332 /* FIXME: should be a matrix-type input source selection */
5334 static struct hda_input_mux alc882_capture_source = {
5338 { "Front Mic", 0x1 },
5343 #define alc882_mux_enum_info alc_mux_enum_info
5344 #define alc882_mux_enum_get alc_mux_enum_get
5346 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5347 struct snd_ctl_elem_value *ucontrol)
5349 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5350 struct alc_spec *spec = codec->spec;
5351 const struct hda_input_mux *imux = spec->input_mux;
5352 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5353 hda_nid_t nid = spec->capsrc_nids ?
5354 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5355 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5356 unsigned int i, idx;
5358 idx = ucontrol->value.enumerated.item[0];
5359 if (idx >= imux->num_items)
5360 idx = imux->num_items - 1;
5361 if (*cur_val == idx)
5363 for (i = 0; i < imux->num_items; i++) {
5364 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5365 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5366 imux->items[i].index,
5376 static struct hda_verb alc882_3ST_ch2_init[] = {
5377 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5378 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5379 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5380 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5387 static struct hda_verb alc882_3ST_ch6_init[] = {
5388 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5389 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5390 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5391 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5392 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5393 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5397 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5398 { 2, alc882_3ST_ch2_init },
5399 { 6, alc882_3ST_ch6_init },
5405 static struct hda_verb alc882_sixstack_ch6_init[] = {
5406 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5407 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5408 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5409 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5416 static struct hda_verb alc882_sixstack_ch8_init[] = {
5417 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5418 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5419 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5420 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5424 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5425 { 6, alc882_sixstack_ch6_init },
5426 { 8, alc882_sixstack_ch8_init },
5430 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5436 static struct hda_verb alc885_mbp_ch2_init[] = {
5437 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5438 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5439 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5446 static struct hda_verb alc885_mbp_ch6_init[] = {
5447 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5448 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5449 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5450 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5451 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5455 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5456 { 2, alc885_mbp_ch2_init },
5457 { 6, alc885_mbp_ch6_init },
5461 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5462 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5464 static struct snd_kcontrol_new alc882_base_mixer[] = {
5465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5466 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5467 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5468 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5469 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5470 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5471 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5472 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5473 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5474 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5475 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5476 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5477 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5478 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5479 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5480 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5481 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5482 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5483 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5484 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5485 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5486 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5487 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5491 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5492 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5493 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5494 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5495 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5496 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5497 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5499 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5500 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5501 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5504 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5505 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5506 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5507 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5508 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5509 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5510 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5511 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5512 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5514 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5515 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5519 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5520 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5523 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5524 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5525 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5526 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5528 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5529 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5530 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5531 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5532 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5536 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5537 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5539 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5541 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5543 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5544 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5545 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5546 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5547 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5548 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5549 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5556 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5557 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5558 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5560 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5561 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5562 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5563 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5565 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5566 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5567 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5568 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5572 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5575 .name = "Channel Mode",
5576 .info = alc_ch_mode_info,
5577 .get = alc_ch_mode_get,
5578 .put = alc_ch_mode_put,
5583 static struct hda_verb alc882_init_verbs[] = {
5584 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5595 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5601 /* Front Pin: output 0 (0x0c) */
5602 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5603 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5604 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5605 /* Rear Pin: output 1 (0x0d) */
5606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5607 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5608 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5609 /* CLFE Pin: output 2 (0x0e) */
5610 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5611 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5612 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5613 /* Side Pin: output 3 (0x0f) */
5614 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5615 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5616 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5617 /* Mic (rear) pin: input vref at 80% */
5618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5620 /* Front Mic pin: input vref at 80% */
5621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5623 /* Line In pin: input */
5624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5626 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5629 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5630 /* CD pin widget for input */
5631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5633 /* FIXME: use matrix-type input source selection */
5634 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5635 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5636 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5650 /* ADC1: mute amp left and right */
5651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5652 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5653 /* ADC2: mute amp left and right */
5654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5655 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5656 /* ADC3: mute amp left and right */
5657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5658 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5663 static struct hda_verb alc882_eapd_verbs[] = {
5664 /* change to EAPD mode */
5665 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5666 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5671 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5672 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5673 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5674 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5677 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5678 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5682 static struct hda_verb alc882_macpro_init_verbs[] = {
5683 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5687 /* Front Pin: output 0 (0x0c) */
5688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5690 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5691 /* Front Mic pin: input vref at 80% */
5692 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5694 /* Speaker: output */
5695 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5697 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5698 /* Headphone output (output 0 - 0x0c) */
5699 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5701 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5703 /* FIXME: use matrix-type input source selection */
5704 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5705 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5720 /* ADC1: mute amp left and right */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5722 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5723 /* ADC2: mute amp left and right */
5724 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5725 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5726 /* ADC3: mute amp left and right */
5727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5728 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5733 /* Macbook Pro rev3 */
5734 static struct hda_verb alc885_mbp3_init_verbs[] = {
5735 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5743 /* Front Pin: output 0 (0x0c) */
5744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5746 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5747 /* HP Pin: output 0 (0x0d) */
5748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5749 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5751 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5752 /* Mic (rear) pin: input vref at 80% */
5753 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5754 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5755 /* Front Mic pin: input vref at 80% */
5756 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5757 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5758 /* Line In pin: use output 1 when in LineOut mode */
5759 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5760 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5761 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5763 /* FIXME: use matrix-type input source selection */
5764 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5765 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5766 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5780 /* ADC1: mute amp left and right */
5781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5782 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5783 /* ADC2: mute amp left and right */
5784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5785 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5786 /* ADC3: mute amp left and right */
5787 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5788 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5793 /* iMac 24 mixer. */
5794 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5795 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5796 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5800 /* iMac 24 init verbs. */
5801 static struct hda_verb alc885_imac24_init_verbs[] = {
5802 /* Internal speakers: output 0 (0x0c) */
5803 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5804 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5805 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5806 /* Internal speakers: output 0 (0x0c) */
5807 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5808 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5809 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5810 /* Headphone: output 0 (0x0c) */
5811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5813 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5814 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5815 /* Front Mic: input vref at 80% */
5816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5817 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5821 /* Toggle speaker-output according to the hp-jack state */
5822 static void alc885_imac24_automute(struct hda_codec *codec)
5824 unsigned int present;
5826 present = snd_hda_codec_read(codec, 0x14, 0,
5827 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5828 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5829 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5830 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5831 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5834 /* Processes unsolicited events. */
5835 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5838 /* Headphone insertion or removal. */
5839 if ((res >> 26) == ALC880_HP_EVENT)
5840 alc885_imac24_automute(codec);
5843 static void alc885_mbp3_automute(struct hda_codec *codec)
5845 unsigned int present;
5847 present = snd_hda_codec_read(codec, 0x15, 0,
5848 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5849 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5850 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5851 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5852 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5855 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5858 /* Headphone insertion or removal. */
5859 if ((res >> 26) == ALC880_HP_EVENT)
5860 alc885_mbp3_automute(codec);
5864 static struct hda_verb alc882_targa_verbs[] = {
5865 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5866 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5869 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5871 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5872 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5873 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5875 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5876 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5877 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5878 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5882 /* toggle speaker-output according to the hp-jack state */
5883 static void alc882_targa_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, 0x1b, HDA_OUTPUT, 0,
5890 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5891 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5895 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5897 /* Looks like the unsol event is incompatible with the standard
5898 * definition. 4bit tag is placed at 26 bit!
5900 if (((res >> 26) == ALC880_HP_EVENT)) {
5901 alc882_targa_automute(codec);
5905 static struct hda_verb alc882_asus_a7j_verbs[] = {
5906 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5909 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5910 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5911 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5913 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5914 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5915 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5917 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5918 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5919 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5923 static struct hda_verb alc882_asus_a7m_verbs[] = {
5924 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5928 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5929 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5931 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5932 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5933 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5935 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5936 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5937 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5941 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5943 unsigned int gpiostate, gpiomask, gpiodir;
5945 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5946 AC_VERB_GET_GPIO_DATA, 0);
5949 gpiostate |= (1 << pin);
5951 gpiostate &= ~(1 << pin);
5953 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5954 AC_VERB_GET_GPIO_MASK, 0);
5955 gpiomask |= (1 << pin);
5957 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5958 AC_VERB_GET_GPIO_DIRECTION, 0);
5959 gpiodir |= (1 << pin);
5962 snd_hda_codec_write(codec, codec->afg, 0,
5963 AC_VERB_SET_GPIO_MASK, gpiomask);
5964 snd_hda_codec_write(codec, codec->afg, 0,
5965 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5969 snd_hda_codec_write(codec, codec->afg, 0,
5970 AC_VERB_SET_GPIO_DATA, gpiostate);
5973 /* set up GPIO at initialization */
5974 static void alc885_macpro_init_hook(struct hda_codec *codec)
5976 alc882_gpio_mute(codec, 0, 0);
5977 alc882_gpio_mute(codec, 1, 0);
5980 /* set up GPIO and update auto-muting at initialization */
5981 static void alc885_imac24_init_hook(struct hda_codec *codec)
5983 alc885_macpro_init_hook(codec);
5984 alc885_imac24_automute(codec);
5988 * generic initialization of ADC, input mixers and output mixers
5990 static struct hda_verb alc882_auto_init_verbs[] = {
5992 * Unmute ADC0-2 and set the default input to mic-in
5994 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5996 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5997 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5998 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5999 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6001 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6003 * Note: PASD motherboards uses the Line In 2 as the input for
6004 * front panel mic (mic 2)
6006 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6008 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6014 * Set up output mixers (0x0c - 0x0f)
6016 /* set vol=0 to output mixers */
6017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6021 /* set up input amps for analog loopback */
6022 /* Amp Indices: DAC = 0, mixer = 1 */
6023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6025 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6027 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6028 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6029 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6030 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6031 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6032 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6034 /* FIXME: use matrix-type input source selection */
6035 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6036 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6037 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6038 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6039 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6042 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6044 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6045 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6047 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6049 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6055 /* capture mixer elements */
6056 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6057 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6058 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6059 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6060 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6062 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6063 /* The multiple "Capture Source" controls confuse alsamixer
6064 * So call somewhat different..
6066 /* .name = "Capture Source", */
6067 .name = "Input Source",
6069 .info = alc882_mux_enum_info,
6070 .get = alc882_mux_enum_get,
6071 .put = alc882_mux_enum_put,
6076 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6077 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6078 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6079 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6080 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6081 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6082 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6084 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6085 /* The multiple "Capture Source" controls confuse alsamixer
6086 * So call somewhat different..
6088 /* .name = "Capture Source", */
6089 .name = "Input Source",
6091 .info = alc882_mux_enum_info,
6092 .get = alc882_mux_enum_get,
6093 .put = alc882_mux_enum_put,
6098 #ifdef CONFIG_SND_HDA_POWER_SAVE
6099 #define alc882_loopbacks alc880_loopbacks
6102 /* pcm configuration: identiacal with ALC880 */
6103 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6104 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6105 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6106 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6109 * configuration and preset
6111 static const char *alc882_models[ALC882_MODEL_LAST] = {
6112 [ALC882_3ST_DIG] = "3stack-dig",
6113 [ALC882_6ST_DIG] = "6stack-dig",
6114 [ALC882_ARIMA] = "arima",
6115 [ALC882_W2JC] = "w2jc",
6116 [ALC882_TARGA] = "targa",
6117 [ALC882_ASUS_A7J] = "asus-a7j",
6118 [ALC882_ASUS_A7M] = "asus-a7m",
6119 [ALC885_MACPRO] = "macpro",
6120 [ALC885_MBP3] = "mbp3",
6121 [ALC885_IMAC24] = "imac24",
6122 [ALC882_AUTO] = "auto",
6125 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6126 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6127 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6128 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6129 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6130 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6131 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6132 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6133 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6134 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6135 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6136 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6137 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6141 static struct alc_config_preset alc882_presets[] = {
6142 [ALC882_3ST_DIG] = {
6143 .mixers = { alc882_base_mixer },
6144 .init_verbs = { alc882_init_verbs },
6145 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6146 .dac_nids = alc882_dac_nids,
6147 .dig_out_nid = ALC882_DIGOUT_NID,
6148 .dig_in_nid = ALC882_DIGIN_NID,
6149 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6150 .channel_mode = alc882_ch_modes,
6152 .input_mux = &alc882_capture_source,
6154 [ALC882_6ST_DIG] = {
6155 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6156 .init_verbs = { alc882_init_verbs },
6157 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6158 .dac_nids = alc882_dac_nids,
6159 .dig_out_nid = ALC882_DIGOUT_NID,
6160 .dig_in_nid = ALC882_DIGIN_NID,
6161 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6162 .channel_mode = alc882_sixstack_modes,
6163 .input_mux = &alc882_capture_source,
6166 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6167 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6168 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6169 .dac_nids = alc882_dac_nids,
6170 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6171 .channel_mode = alc882_sixstack_modes,
6172 .input_mux = &alc882_capture_source,
6175 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6176 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6177 alc880_gpio1_init_verbs },
6178 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6179 .dac_nids = alc882_dac_nids,
6180 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6181 .channel_mode = alc880_threestack_modes,
6183 .input_mux = &alc882_capture_source,
6184 .dig_out_nid = ALC882_DIGOUT_NID,
6187 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6188 .init_verbs = { alc885_mbp3_init_verbs,
6189 alc880_gpio1_init_verbs },
6190 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6191 .dac_nids = alc882_dac_nids,
6192 .channel_mode = alc885_mbp_6ch_modes,
6193 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6194 .input_mux = &alc882_capture_source,
6195 .dig_out_nid = ALC882_DIGOUT_NID,
6196 .dig_in_nid = ALC882_DIGIN_NID,
6197 .unsol_event = alc885_mbp3_unsol_event,
6198 .init_hook = alc885_mbp3_automute,
6201 .mixers = { alc882_macpro_mixer },
6202 .init_verbs = { alc882_macpro_init_verbs },
6203 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6204 .dac_nids = alc882_dac_nids,
6205 .dig_out_nid = ALC882_DIGOUT_NID,
6206 .dig_in_nid = ALC882_DIGIN_NID,
6207 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6208 .channel_mode = alc882_ch_modes,
6209 .input_mux = &alc882_capture_source,
6210 .init_hook = alc885_macpro_init_hook,
6213 .mixers = { alc885_imac24_mixer },
6214 .init_verbs = { alc885_imac24_init_verbs },
6215 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6216 .dac_nids = alc882_dac_nids,
6217 .dig_out_nid = ALC882_DIGOUT_NID,
6218 .dig_in_nid = ALC882_DIGIN_NID,
6219 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6220 .channel_mode = alc882_ch_modes,
6221 .input_mux = &alc882_capture_source,
6222 .unsol_event = alc885_imac24_unsol_event,
6223 .init_hook = alc885_imac24_init_hook,
6226 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6227 alc882_capture_mixer },
6228 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6229 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6230 .dac_nids = alc882_dac_nids,
6231 .dig_out_nid = ALC882_DIGOUT_NID,
6232 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6233 .adc_nids = alc882_adc_nids,
6234 .capsrc_nids = alc882_capsrc_nids,
6235 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6236 .channel_mode = alc882_3ST_6ch_modes,
6238 .input_mux = &alc882_capture_source,
6239 .unsol_event = alc882_targa_unsol_event,
6240 .init_hook = alc882_targa_automute,
6242 [ALC882_ASUS_A7J] = {
6243 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6244 alc882_capture_mixer },
6245 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6246 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6247 .dac_nids = alc882_dac_nids,
6248 .dig_out_nid = ALC882_DIGOUT_NID,
6249 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6250 .adc_nids = alc882_adc_nids,
6251 .capsrc_nids = alc882_capsrc_nids,
6252 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6253 .channel_mode = alc882_3ST_6ch_modes,
6255 .input_mux = &alc882_capture_source,
6257 [ALC882_ASUS_A7M] = {
6258 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6259 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6260 alc880_gpio1_init_verbs,
6261 alc882_asus_a7m_verbs },
6262 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6263 .dac_nids = alc882_dac_nids,
6264 .dig_out_nid = ALC882_DIGOUT_NID,
6265 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6266 .channel_mode = alc880_threestack_modes,
6268 .input_mux = &alc882_capture_source,
6277 PINFIX_ABIT_AW9D_MAX
6280 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6281 { 0x15, 0x01080104 }, /* side */
6282 { 0x16, 0x01011012 }, /* rear */
6283 { 0x17, 0x01016011 }, /* clfe */
6287 static const struct alc_pincfg *alc882_pin_fixes[] = {
6288 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6291 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6292 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6297 * BIOS auto configuration
6299 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6300 hda_nid_t nid, int pin_type,
6304 struct alc_spec *spec = codec->spec;
6307 alc_set_pin_output(codec, nid, pin_type);
6308 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6311 idx = spec->multiout.dac_nids[dac_idx] - 2;
6312 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6316 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6318 struct alc_spec *spec = codec->spec;
6321 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6322 for (i = 0; i <= HDA_SIDE; i++) {
6323 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6324 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6326 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6331 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6333 struct alc_spec *spec = codec->spec;
6336 pin = spec->autocfg.hp_pins[0];
6337 if (pin) /* connect to front */
6339 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6340 pin = spec->autocfg.speaker_pins[0];
6342 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6345 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6346 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6348 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6350 struct alc_spec *spec = codec->spec;
6353 for (i = 0; i < AUTO_PIN_LAST; i++) {
6354 hda_nid_t nid = spec->autocfg.input_pins[i];
6359 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6360 unsigned int pincap;
6361 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6362 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6366 snd_hda_codec_write(codec, nid, 0,
6367 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6368 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6369 snd_hda_codec_write(codec, nid, 0,
6370 AC_VERB_SET_AMP_GAIN_MUTE,
6375 /* add mic boosts if needed */
6376 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6378 struct alc_spec *spec = codec->spec;
6382 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6383 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6384 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6386 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6390 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6391 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6392 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6394 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6401 /* almost identical with ALC880 parser... */
6402 static int alc882_parse_auto_config(struct hda_codec *codec)
6404 struct alc_spec *spec = codec->spec;
6405 int err = alc880_parse_auto_config(codec);
6410 return 0; /* no config found */
6412 err = alc_auto_add_mic_boost(codec);
6416 /* hack - override the init verbs */
6417 spec->init_verbs[0] = alc882_auto_init_verbs;
6419 return 1; /* config found */
6422 /* additional initialization for auto-configuration model */
6423 static void alc882_auto_init(struct hda_codec *codec)
6425 struct alc_spec *spec = codec->spec;
6426 alc882_auto_init_multi_out(codec);
6427 alc882_auto_init_hp_out(codec);
6428 alc882_auto_init_analog_input(codec);
6429 if (spec->unsol_event)
6430 alc_sku_automute(codec);
6433 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6435 static int patch_alc882(struct hda_codec *codec)
6437 struct alc_spec *spec;
6438 int err, board_config;
6440 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6446 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6450 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6451 /* Pick up systems that don't supply PCI SSID */
6452 switch (codec->subsystem_id) {
6453 case 0x106b0c00: /* Mac Pro */
6454 board_config = ALC885_MACPRO;
6456 case 0x106b1000: /* iMac 24 */
6457 board_config = ALC885_IMAC24;
6459 case 0x106b00a1: /* Macbook */
6460 case 0x106b2c00: /* Macbook Pro rev3 */
6461 board_config = ALC885_MBP3;
6464 /* ALC889A is handled better as ALC888-compatible */
6465 if (codec->revision_id == 0x100103) {
6467 return patch_alc883(codec);
6469 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6470 "trying auto-probe from BIOS...\n");
6471 board_config = ALC882_AUTO;
6475 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6477 if (board_config == ALC882_AUTO) {
6478 /* automatic parse from the BIOS config */
6479 err = alc882_parse_auto_config(codec);
6485 "hda_codec: Cannot set up configuration "
6486 "from BIOS. Using base mode...\n");
6487 board_config = ALC882_3ST_DIG;
6491 if (board_config != ALC882_AUTO)
6492 setup_preset(spec, &alc882_presets[board_config]);
6494 spec->stream_name_analog = "ALC882 Analog";
6495 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6496 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6497 /* FIXME: setup DAC5 */
6498 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6499 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6501 spec->stream_name_digital = "ALC882 Digital";
6502 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6503 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6505 if (!spec->adc_nids && spec->input_mux) {
6506 /* check whether NID 0x07 is valid */
6507 unsigned int wcap = get_wcaps(codec, 0x07);
6509 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6510 if (wcap != AC_WID_AUD_IN) {
6511 spec->adc_nids = alc882_adc_nids_alt;
6512 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6513 spec->capsrc_nids = alc882_capsrc_nids_alt;
6514 spec->mixers[spec->num_mixers] =
6515 alc882_capture_alt_mixer;
6518 spec->adc_nids = alc882_adc_nids;
6519 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6520 spec->capsrc_nids = alc882_capsrc_nids;
6521 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6526 spec->vmaster_nid = 0x0c;
6528 codec->patch_ops = alc_patch_ops;
6529 if (board_config == ALC882_AUTO)
6530 spec->init_hook = alc882_auto_init;
6531 #ifdef CONFIG_SND_HDA_POWER_SAVE
6532 if (!spec->loopback.amplist)
6533 spec->loopback.amplist = alc882_loopbacks;
6542 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6543 * configuration. Each pin widget can choose any input DACs and a mixer.
6544 * Each ADC is connected from a mixer of all inputs. This makes possible
6545 * 6-channel independent captures.
6547 * In addition, an independent DAC for the multi-playback (not used in this
6550 #define ALC883_DIGOUT_NID 0x06
6551 #define ALC883_DIGIN_NID 0x0a
6553 static hda_nid_t alc883_dac_nids[4] = {
6554 /* front, rear, clfe, rear_surr */
6555 0x02, 0x03, 0x04, 0x05
6558 static hda_nid_t alc883_adc_nids[2] = {
6563 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6566 /* FIXME: should be a matrix-type input source selection */
6568 static struct hda_input_mux alc883_capture_source = {
6572 { "Front Mic", 0x1 },
6578 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6586 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6596 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6604 #define alc883_mux_enum_info alc_mux_enum_info
6605 #define alc883_mux_enum_get alc_mux_enum_get
6606 /* ALC883 has the ALC882-type input selection */
6607 #define alc883_mux_enum_put alc882_mux_enum_put
6612 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6619 static struct hda_verb alc883_3ST_ch2_init[] = {
6620 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6621 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6622 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6623 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6630 static struct hda_verb alc883_3ST_ch4_init[] = {
6631 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6632 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6635 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6642 static struct hda_verb alc883_3ST_ch6_init[] = {
6643 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6644 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6645 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6646 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6647 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6648 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6652 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6653 { 2, alc883_3ST_ch2_init },
6654 { 4, alc883_3ST_ch4_init },
6655 { 6, alc883_3ST_ch6_init },
6661 static struct hda_verb alc883_sixstack_ch6_init[] = {
6662 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6663 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6664 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6665 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6672 static struct hda_verb alc883_sixstack_ch8_init[] = {
6673 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6674 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6675 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6676 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6680 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6681 { 6, alc883_sixstack_ch6_init },
6682 { 8, alc883_sixstack_ch8_init },
6685 static struct hda_verb alc883_medion_eapd_verbs[] = {
6686 /* eanable EAPD on medion laptop */
6687 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6688 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6692 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6693 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6696 static struct snd_kcontrol_new alc883_base_mixer[] = {
6697 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6698 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6699 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6700 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6701 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6702 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6703 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6704 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6705 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6706 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6707 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6708 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6709 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6710 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6711 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6713 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6715 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6716 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6717 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6718 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6719 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6720 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6721 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6722 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6723 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6725 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6726 /* .name = "Capture Source", */
6727 .name = "Input Source",
6729 .info = alc883_mux_enum_info,
6730 .get = alc883_mux_enum_get,
6731 .put = alc883_mux_enum_put,
6736 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6737 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6738 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6739 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6740 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6741 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6742 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6745 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6747 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6748 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6749 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6750 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6751 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6752 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6753 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6755 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6756 /* .name = "Capture Source", */
6757 .name = "Input Source",
6759 .info = alc883_mux_enum_info,
6760 .get = alc883_mux_enum_get,
6761 .put = alc883_mux_enum_put,
6766 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6767 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6768 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6769 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6770 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6772 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6774 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6775 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6776 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6777 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6778 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6779 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6780 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6783 /* .name = "Capture Source", */
6784 .name = "Input Source",
6786 .info = alc883_mux_enum_info,
6787 .get = alc883_mux_enum_get,
6788 .put = alc883_mux_enum_put,
6793 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6794 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6795 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6796 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6797 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6798 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6799 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6801 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6802 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6803 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6804 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6805 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6806 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6807 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6809 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6810 /* .name = "Capture Source", */
6811 .name = "Input Source",
6813 .info = alc883_mux_enum_info,
6814 .get = alc883_mux_enum_get,
6815 .put = alc883_mux_enum_put,
6820 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6821 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6822 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6823 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6824 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6825 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6826 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6827 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6828 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6829 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6831 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6832 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6833 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6834 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6835 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6836 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6837 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6838 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6839 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6842 /* .name = "Capture Source", */
6843 .name = "Input Source",
6845 .info = alc883_mux_enum_info,
6846 .get = alc883_mux_enum_get,
6847 .put = alc883_mux_enum_put,
6852 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6854 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6855 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6857 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6858 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6859 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6860 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6864 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6865 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6869 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6870 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6871 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6872 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6873 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6874 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6875 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6876 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6877 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6879 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6880 /* .name = "Capture Source", */
6881 .name = "Input Source",
6883 .info = alc883_mux_enum_info,
6884 .get = alc883_mux_enum_get,
6885 .put = alc883_mux_enum_put,
6890 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6891 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6892 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6893 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6894 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6895 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6896 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6897 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6898 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6900 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6901 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6902 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6903 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6905 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6907 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6908 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6910 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6911 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6912 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6913 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6916 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6917 /* .name = "Capture Source", */
6918 .name = "Input Source",
6920 .info = alc883_mux_enum_info,
6921 .get = alc883_mux_enum_get,
6922 .put = alc883_mux_enum_put,
6927 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6928 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6930 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6931 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6932 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6933 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6934 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6935 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6936 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6940 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6942 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6944 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6945 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6946 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6947 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6949 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6950 /* .name = "Capture Source", */
6951 .name = "Input Source",
6953 .info = alc883_mux_enum_info,
6954 .get = alc883_mux_enum_get,
6955 .put = alc883_mux_enum_put,
6960 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6961 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6962 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6963 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6964 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6965 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6966 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6968 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6969 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6970 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6971 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6972 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6973 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6974 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6975 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6977 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6978 /* .name = "Capture Source", */
6979 .name = "Input Source",
6981 .info = alc883_mux_enum_info,
6982 .get = alc883_mux_enum_get,
6983 .put = alc883_mux_enum_put,
6988 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6992 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6993 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6995 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6998 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7001 /* .name = "Capture Source", */
7002 .name = "Input Source",
7004 .info = alc883_mux_enum_info,
7005 .get = alc883_mux_enum_get,
7006 .put = alc883_mux_enum_put,
7011 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7013 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7014 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7015 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7016 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7019 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7020 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7021 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7022 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7023 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7024 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7026 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7027 /* .name = "Capture Source", */
7028 .name = "Input Source",
7030 .info = alc883_mux_enum_info,
7031 .get = alc883_mux_enum_get,
7032 .put = alc883_mux_enum_put,
7037 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7038 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7039 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7040 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7041 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7042 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7048 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7049 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7050 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7052 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7053 /* .name = "Capture Source", */
7054 .name = "Input Source",
7056 .info = alc883_mux_enum_info,
7057 .get = alc883_mux_enum_get,
7058 .put = alc883_mux_enum_put,
7063 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7064 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7065 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7066 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7067 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7068 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7072 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7073 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7074 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7075 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7077 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7078 /* .name = "Capture Source", */
7079 .name = "Input Source",
7081 .info = alc883_mux_enum_info,
7082 .get = alc883_mux_enum_get,
7083 .put = alc883_mux_enum_put,
7088 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7090 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7091 .name = "Channel Mode",
7092 .info = alc_ch_mode_info,
7093 .get = alc_ch_mode_get,
7094 .put = alc_ch_mode_put,
7099 static struct hda_verb alc883_init_verbs[] = {
7100 /* ADC1: mute amp left and right */
7101 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7102 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7103 /* ADC2: mute amp left and right */
7104 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7105 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7106 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7111 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7113 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7115 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7116 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7117 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7119 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7120 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7123 /* mute analog input loopbacks */
7124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7130 /* Front Pin: output 0 (0x0c) */
7131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7132 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7133 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7134 /* Rear Pin: output 1 (0x0d) */
7135 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7137 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7138 /* CLFE Pin: output 2 (0x0e) */
7139 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7140 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7141 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7142 /* Side Pin: output 3 (0x0f) */
7143 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7144 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7145 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7146 /* Mic (rear) pin: input vref at 80% */
7147 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7149 /* Front Mic pin: input vref at 80% */
7150 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7151 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7152 /* Line In pin: input */
7153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7155 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7156 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7157 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7158 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7159 /* CD pin widget for input */
7160 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7162 /* FIXME: use matrix-type input source selection */
7163 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7165 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7166 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7167 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7168 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7172 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7173 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7177 /* toggle speaker-output according to the hp-jack state */
7178 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7180 unsigned int present;
7182 present = snd_hda_codec_read(codec, 0x15, 0,
7183 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7184 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7185 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7186 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7187 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7190 /* auto-toggle front mic */
7192 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7194 unsigned int present;
7197 present = snd_hda_codec_read(codec, 0x18, 0,
7198 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7199 bits = present ? HDA_AMP_MUTE : 0;
7200 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7204 static void alc883_mitac_automute(struct hda_codec *codec)
7206 alc883_mitac_hp_automute(codec);
7207 /* alc883_mitac_mic_automute(codec); */
7210 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7213 switch (res >> 26) {
7214 case ALC880_HP_EVENT:
7215 alc883_mitac_hp_automute(codec);
7217 case ALC880_MIC_EVENT:
7218 /* alc883_mitac_mic_automute(codec); */
7223 static struct hda_verb alc883_mitac_verbs[] = {
7225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7226 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7228 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7229 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7231 /* enable unsolicited event */
7232 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7233 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7238 static struct hda_verb alc883_clevo_m720_verbs[] = {
7240 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7243 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7244 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7246 /* enable unsolicited event */
7247 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7248 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7253 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7255 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7258 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7261 /* enable unsolicited event */
7262 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7267 static struct hda_verb alc883_tagra_verbs[] = {
7268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7271 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7272 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7274 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7275 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7276 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7278 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7279 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7280 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7281 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7286 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7287 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7289 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7293 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7294 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7296 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7297 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7301 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7304 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7305 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7306 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7310 static struct hda_verb alc883_haier_w66_verbs[] = {
7311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7314 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7316 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7317 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7318 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7319 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7323 static struct hda_verb alc888_3st_hp_verbs[] = {
7324 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7325 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7326 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7330 static struct hda_verb alc888_6st_dell_verbs[] = {
7331 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7335 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7336 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7337 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7338 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7339 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7343 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7344 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7345 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7346 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7347 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7351 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7352 { 2, alc888_3st_hp_2ch_init },
7353 { 6, alc888_3st_hp_6ch_init },
7356 /* toggle front-jack and RCA according to the hp-jack state */
7357 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7359 unsigned int present;
7361 present = snd_hda_codec_read(codec, 0x1b, 0,
7362 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7363 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7364 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7365 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7366 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7369 /* toggle RCA according to the front-jack state */
7370 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7372 unsigned int present;
7374 present = snd_hda_codec_read(codec, 0x14, 0,
7375 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7376 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7377 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7380 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7383 if ((res >> 26) == ALC880_HP_EVENT)
7384 alc888_lenovo_ms7195_front_automute(codec);
7385 if ((res >> 26) == ALC880_FRONT_EVENT)
7386 alc888_lenovo_ms7195_rca_automute(codec);
7389 static struct hda_verb alc883_medion_md2_verbs[] = {
7390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7391 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7393 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7395 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7399 /* toggle speaker-output according to the hp-jack state */
7400 static void alc883_medion_md2_automute(struct hda_codec *codec)
7402 unsigned int present;
7404 present = snd_hda_codec_read(codec, 0x14, 0,
7405 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7406 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7407 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7410 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7413 if ((res >> 26) == ALC880_HP_EVENT)
7414 alc883_medion_md2_automute(codec);
7417 /* toggle speaker-output according to the hp-jack state */
7418 static void alc883_tagra_automute(struct hda_codec *codec)
7420 unsigned int present;
7423 present = snd_hda_codec_read(codec, 0x14, 0,
7424 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7425 bits = present ? HDA_AMP_MUTE : 0;
7426 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7427 HDA_AMP_MUTE, bits);
7428 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7432 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7434 if ((res >> 26) == ALC880_HP_EVENT)
7435 alc883_tagra_automute(codec);
7438 /* toggle speaker-output according to the hp-jack state */
7439 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7441 unsigned int present;
7444 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7445 & AC_PINSENSE_PRESENCE;
7446 bits = present ? HDA_AMP_MUTE : 0;
7447 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7448 HDA_AMP_MUTE, bits);
7451 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7453 unsigned int present;
7455 present = snd_hda_codec_read(codec, 0x18, 0,
7456 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7457 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7461 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7463 alc883_clevo_m720_hp_automute(codec);
7464 alc883_clevo_m720_mic_automute(codec);
7467 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7470 switch (res >> 26) {
7471 case ALC880_HP_EVENT:
7472 alc883_clevo_m720_hp_automute(codec);
7474 case ALC880_MIC_EVENT:
7475 alc883_clevo_m720_mic_automute(codec);
7480 /* toggle speaker-output according to the hp-jack state */
7481 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7483 unsigned int present;
7486 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7487 & AC_PINSENSE_PRESENCE;
7488 bits = present ? HDA_AMP_MUTE : 0;
7489 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7490 HDA_AMP_MUTE, bits);
7493 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7496 if ((res >> 26) == ALC880_HP_EVENT)
7497 alc883_2ch_fujitsu_pi2515_automute(codec);
7500 static void alc883_haier_w66_automute(struct hda_codec *codec)
7502 unsigned int present;
7505 present = snd_hda_codec_read(codec, 0x1b, 0,
7506 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7507 bits = present ? 0x80 : 0;
7508 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7512 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7515 if ((res >> 26) == ALC880_HP_EVENT)
7516 alc883_haier_w66_automute(codec);
7519 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7521 unsigned int present;
7524 present = snd_hda_codec_read(codec, 0x14, 0,
7525 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7526 bits = present ? HDA_AMP_MUTE : 0;
7527 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7528 HDA_AMP_MUTE, bits);
7531 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7533 unsigned int present;
7536 present = snd_hda_codec_read(codec, 0x1b, 0,
7537 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7538 bits = present ? HDA_AMP_MUTE : 0;
7539 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7540 HDA_AMP_MUTE, bits);
7541 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7542 HDA_AMP_MUTE, bits);
7545 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7548 if ((res >> 26) == ALC880_HP_EVENT)
7549 alc883_lenovo_101e_all_automute(codec);
7550 if ((res >> 26) == ALC880_FRONT_EVENT)
7551 alc883_lenovo_101e_ispeaker_automute(codec);
7554 /* toggle speaker-output according to the hp-jack state */
7555 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7557 unsigned int present;
7559 present = snd_hda_codec_read(codec, 0x14, 0,
7560 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7561 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7562 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7563 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7564 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7567 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7570 if ((res >> 26) == ALC880_HP_EVENT)
7571 alc883_acer_aspire_automute(codec);
7574 static struct hda_verb alc883_acer_eapd_verbs[] = {
7575 /* HP Pin: output 0 (0x0c) */
7576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7577 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7578 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7579 /* Front Pin: output 0 (0x0c) */
7580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7581 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7582 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7583 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7584 /* eanable EAPD on medion laptop */
7585 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7586 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7587 /* enable unsolicited event */
7588 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7592 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7594 unsigned int present;
7596 present = snd_hda_codec_read(codec, 0x1b, 0,
7597 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7598 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7599 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7600 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7601 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7602 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7603 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7604 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7605 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7608 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7611 switch (res >> 26) {
7612 case ALC880_HP_EVENT:
7613 printk("hp_event\n");
7614 alc888_6st_dell_front_automute(codec);
7620 * generic initialization of ADC, input mixers and output mixers
7622 static struct hda_verb alc883_auto_init_verbs[] = {
7624 * Unmute ADC0-2 and set the default input to mic-in
7626 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7627 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7628 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7629 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7631 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7633 * Note: PASD motherboards uses the Line In 2 as the input for
7634 * front panel mic (mic 2)
7636 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7644 * Set up output mixers (0x0c - 0x0f)
7646 /* set vol=0 to output mixers */
7647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7648 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7649 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7651 /* set up input amps for analog loopback */
7652 /* Amp Indices: DAC = 0, mixer = 1 */
7653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7655 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7656 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7658 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7659 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7661 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7662 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7664 /* FIXME: use matrix-type input source selection */
7665 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7670 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7676 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7682 /* capture mixer elements */
7683 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7684 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7685 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7686 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7687 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7690 /* The multiple "Capture Source" controls confuse alsamixer
7691 * So call somewhat different..
7693 /* .name = "Capture Source", */
7694 .name = "Input Source",
7696 .info = alc882_mux_enum_info,
7697 .get = alc882_mux_enum_get,
7698 .put = alc882_mux_enum_put,
7703 #ifdef CONFIG_SND_HDA_POWER_SAVE
7704 #define alc883_loopbacks alc880_loopbacks
7707 /* pcm configuration: identiacal with ALC880 */
7708 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7709 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7710 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7711 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7712 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7715 * configuration and preset
7717 static const char *alc883_models[ALC883_MODEL_LAST] = {
7718 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7719 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7720 [ALC883_3ST_6ch] = "3stack-6ch",
7721 [ALC883_6ST_DIG] = "6stack-dig",
7722 [ALC883_TARGA_DIG] = "targa-dig",
7723 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7724 [ALC883_ACER] = "acer",
7725 [ALC883_ACER_ASPIRE] = "acer-aspire",
7726 [ALC883_MEDION] = "medion",
7727 [ALC883_MEDION_MD2] = "medion-md2",
7728 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7729 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7730 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7731 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7732 [ALC883_HAIER_W66] = "haier-w66",
7733 [ALC888_3ST_HP] = "3stack-hp",
7734 [ALC888_6ST_DELL] = "6stack-dell",
7735 [ALC883_MITAC] = "mitac",
7736 [ALC883_CLEVO_M720] = "clevo-m720",
7737 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7738 [ALC883_AUTO] = "auto",
7741 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7742 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7743 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7744 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7745 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7746 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7747 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7748 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7749 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7750 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7751 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7752 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7753 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7754 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7755 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7756 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7757 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7758 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7759 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7760 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7761 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7762 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7763 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7764 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7765 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7766 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7767 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7768 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7769 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7770 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7771 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7772 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7773 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7774 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7775 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7776 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7777 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7778 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7779 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7780 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7781 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7782 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7783 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7784 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7785 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7786 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7787 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7788 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7789 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7790 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7791 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7792 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7793 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7794 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7795 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7799 static struct alc_config_preset alc883_presets[] = {
7800 [ALC883_3ST_2ch_DIG] = {
7801 .mixers = { alc883_3ST_2ch_mixer },
7802 .init_verbs = { alc883_init_verbs },
7803 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7804 .dac_nids = alc883_dac_nids,
7805 .dig_out_nid = ALC883_DIGOUT_NID,
7806 .dig_in_nid = ALC883_DIGIN_NID,
7807 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7808 .channel_mode = alc883_3ST_2ch_modes,
7809 .input_mux = &alc883_capture_source,
7811 [ALC883_3ST_6ch_DIG] = {
7812 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7813 .init_verbs = { alc883_init_verbs },
7814 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7815 .dac_nids = alc883_dac_nids,
7816 .dig_out_nid = ALC883_DIGOUT_NID,
7817 .dig_in_nid = ALC883_DIGIN_NID,
7818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7819 .channel_mode = alc883_3ST_6ch_modes,
7821 .input_mux = &alc883_capture_source,
7823 [ALC883_3ST_6ch] = {
7824 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7825 .init_verbs = { alc883_init_verbs },
7826 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7827 .dac_nids = alc883_dac_nids,
7828 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7829 .channel_mode = alc883_3ST_6ch_modes,
7831 .input_mux = &alc883_capture_source,
7833 [ALC883_6ST_DIG] = {
7834 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7835 .init_verbs = { alc883_init_verbs },
7836 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7837 .dac_nids = alc883_dac_nids,
7838 .dig_out_nid = ALC883_DIGOUT_NID,
7839 .dig_in_nid = ALC883_DIGIN_NID,
7840 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7841 .channel_mode = alc883_sixstack_modes,
7842 .input_mux = &alc883_capture_source,
7844 [ALC883_TARGA_DIG] = {
7845 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7846 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7847 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7848 .dac_nids = alc883_dac_nids,
7849 .dig_out_nid = ALC883_DIGOUT_NID,
7850 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7851 .channel_mode = alc883_3ST_6ch_modes,
7853 .input_mux = &alc883_capture_source,
7854 .unsol_event = alc883_tagra_unsol_event,
7855 .init_hook = alc883_tagra_automute,
7857 [ALC883_TARGA_2ch_DIG] = {
7858 .mixers = { alc883_tagra_2ch_mixer},
7859 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7860 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7861 .dac_nids = alc883_dac_nids,
7862 .dig_out_nid = ALC883_DIGOUT_NID,
7863 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7864 .channel_mode = alc883_3ST_2ch_modes,
7865 .input_mux = &alc883_capture_source,
7866 .unsol_event = alc883_tagra_unsol_event,
7867 .init_hook = alc883_tagra_automute,
7870 .mixers = { alc883_base_mixer },
7871 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7872 * and the headphone jack. Turn this on and rely on the
7873 * standard mute methods whenever the user wants to turn
7874 * these outputs off.
7876 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7877 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7878 .dac_nids = alc883_dac_nids,
7879 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7880 .channel_mode = alc883_3ST_2ch_modes,
7881 .input_mux = &alc883_capture_source,
7883 [ALC883_ACER_ASPIRE] = {
7884 .mixers = { alc883_acer_aspire_mixer },
7885 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7886 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7887 .dac_nids = alc883_dac_nids,
7888 .dig_out_nid = ALC883_DIGOUT_NID,
7889 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7890 .channel_mode = alc883_3ST_2ch_modes,
7891 .input_mux = &alc883_capture_source,
7892 .unsol_event = alc883_acer_aspire_unsol_event,
7893 .init_hook = alc883_acer_aspire_automute,
7896 .mixers = { alc883_fivestack_mixer,
7897 alc883_chmode_mixer },
7898 .init_verbs = { alc883_init_verbs,
7899 alc883_medion_eapd_verbs },
7900 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7901 .dac_nids = alc883_dac_nids,
7902 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7903 .channel_mode = alc883_sixstack_modes,
7904 .input_mux = &alc883_capture_source,
7906 [ALC883_MEDION_MD2] = {
7907 .mixers = { alc883_medion_md2_mixer},
7908 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7909 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7910 .dac_nids = alc883_dac_nids,
7911 .dig_out_nid = ALC883_DIGOUT_NID,
7912 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7913 .channel_mode = alc883_3ST_2ch_modes,
7914 .input_mux = &alc883_capture_source,
7915 .unsol_event = alc883_medion_md2_unsol_event,
7916 .init_hook = alc883_medion_md2_automute,
7918 [ALC883_LAPTOP_EAPD] = {
7919 .mixers = { alc883_base_mixer },
7920 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7921 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7922 .dac_nids = alc883_dac_nids,
7923 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7924 .channel_mode = alc883_3ST_2ch_modes,
7925 .input_mux = &alc883_capture_source,
7927 [ALC883_CLEVO_M720] = {
7928 .mixers = { alc883_clevo_m720_mixer },
7929 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
7930 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7931 .dac_nids = alc883_dac_nids,
7932 .dig_out_nid = ALC883_DIGOUT_NID,
7933 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7934 .channel_mode = alc883_3ST_2ch_modes,
7935 .input_mux = &alc883_capture_source,
7936 .unsol_event = alc883_clevo_m720_unsol_event,
7937 .init_hook = alc883_clevo_m720_automute,
7939 [ALC883_LENOVO_101E_2ch] = {
7940 .mixers = { alc883_lenovo_101e_2ch_mixer},
7941 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7942 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7943 .dac_nids = alc883_dac_nids,
7944 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7945 .channel_mode = alc883_3ST_2ch_modes,
7946 .input_mux = &alc883_lenovo_101e_capture_source,
7947 .unsol_event = alc883_lenovo_101e_unsol_event,
7948 .init_hook = alc883_lenovo_101e_all_automute,
7950 [ALC883_LENOVO_NB0763] = {
7951 .mixers = { alc883_lenovo_nb0763_mixer },
7952 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7953 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7954 .dac_nids = alc883_dac_nids,
7955 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7956 .channel_mode = alc883_3ST_2ch_modes,
7958 .input_mux = &alc883_lenovo_nb0763_capture_source,
7959 .unsol_event = alc883_medion_md2_unsol_event,
7960 .init_hook = alc883_medion_md2_automute,
7962 [ALC888_LENOVO_MS7195_DIG] = {
7963 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7964 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7965 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7966 .dac_nids = alc883_dac_nids,
7967 .dig_out_nid = ALC883_DIGOUT_NID,
7968 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7969 .channel_mode = alc883_3ST_6ch_modes,
7971 .input_mux = &alc883_capture_source,
7972 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7973 .init_hook = alc888_lenovo_ms7195_front_automute,
7975 [ALC883_HAIER_W66] = {
7976 .mixers = { alc883_tagra_2ch_mixer},
7977 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7978 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7979 .dac_nids = alc883_dac_nids,
7980 .dig_out_nid = ALC883_DIGOUT_NID,
7981 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7982 .channel_mode = alc883_3ST_2ch_modes,
7983 .input_mux = &alc883_capture_source,
7984 .unsol_event = alc883_haier_w66_unsol_event,
7985 .init_hook = alc883_haier_w66_automute,
7988 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7989 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7990 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7991 .dac_nids = alc883_dac_nids,
7992 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7993 .channel_mode = alc888_3st_hp_modes,
7995 .input_mux = &alc883_capture_source,
7997 [ALC888_6ST_DELL] = {
7998 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7999 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8000 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8001 .dac_nids = alc883_dac_nids,
8002 .dig_out_nid = ALC883_DIGOUT_NID,
8003 .dig_in_nid = ALC883_DIGIN_NID,
8004 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8005 .channel_mode = alc883_sixstack_modes,
8006 .input_mux = &alc883_capture_source,
8007 .unsol_event = alc888_6st_dell_unsol_event,
8008 .init_hook = alc888_6st_dell_front_automute,
8011 .mixers = { alc883_mitac_mixer },
8012 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8013 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8014 .dac_nids = alc883_dac_nids,
8015 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8016 .channel_mode = alc883_3ST_2ch_modes,
8017 .input_mux = &alc883_capture_source,
8018 .unsol_event = alc883_mitac_unsol_event,
8019 .init_hook = alc883_mitac_automute,
8021 [ALC883_FUJITSU_PI2515] = {
8022 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8023 .init_verbs = { alc883_init_verbs,
8024 alc883_2ch_fujitsu_pi2515_verbs},
8025 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8026 .dac_nids = alc883_dac_nids,
8027 .dig_out_nid = ALC883_DIGOUT_NID,
8028 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8029 .channel_mode = alc883_3ST_2ch_modes,
8030 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8031 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8032 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8038 * BIOS auto configuration
8040 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8041 hda_nid_t nid, int pin_type,
8045 struct alc_spec *spec = codec->spec;
8048 alc_set_pin_output(codec, nid, pin_type);
8049 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8052 idx = spec->multiout.dac_nids[dac_idx] - 2;
8053 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8057 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8059 struct alc_spec *spec = codec->spec;
8062 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8063 for (i = 0; i <= HDA_SIDE; i++) {
8064 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8065 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8067 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8072 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8074 struct alc_spec *spec = codec->spec;
8077 pin = spec->autocfg.hp_pins[0];
8078 if (pin) /* connect to front */
8080 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8081 pin = spec->autocfg.speaker_pins[0];
8083 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8086 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8087 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8089 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8091 struct alc_spec *spec = codec->spec;
8094 for (i = 0; i < AUTO_PIN_LAST; i++) {
8095 hda_nid_t nid = spec->autocfg.input_pins[i];
8096 if (alc883_is_input_pin(nid)) {
8097 snd_hda_codec_write(codec, nid, 0,
8098 AC_VERB_SET_PIN_WIDGET_CONTROL,
8099 (i <= AUTO_PIN_FRONT_MIC ?
8100 PIN_VREF80 : PIN_IN));
8101 if (nid != ALC883_PIN_CD_NID)
8102 snd_hda_codec_write(codec, nid, 0,
8103 AC_VERB_SET_AMP_GAIN_MUTE,
8109 /* almost identical with ALC880 parser... */
8110 static int alc883_parse_auto_config(struct hda_codec *codec)
8112 struct alc_spec *spec = codec->spec;
8113 int err = alc880_parse_auto_config(codec);
8118 return 0; /* no config found */
8120 err = alc_auto_add_mic_boost(codec);
8124 /* hack - override the init verbs */
8125 spec->init_verbs[0] = alc883_auto_init_verbs;
8126 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8129 return 1; /* config found */
8132 /* additional initialization for auto-configuration model */
8133 static void alc883_auto_init(struct hda_codec *codec)
8135 struct alc_spec *spec = codec->spec;
8136 alc883_auto_init_multi_out(codec);
8137 alc883_auto_init_hp_out(codec);
8138 alc883_auto_init_analog_input(codec);
8139 if (spec->unsol_event)
8140 alc_sku_automute(codec);
8143 static int patch_alc883(struct hda_codec *codec)
8145 struct alc_spec *spec;
8146 int err, board_config;
8148 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8154 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8157 if (board_config < 0) {
8158 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8159 "trying auto-probe from BIOS...\n");
8160 board_config = ALC883_AUTO;
8163 if (board_config == ALC883_AUTO) {
8164 /* automatic parse from the BIOS config */
8165 err = alc883_parse_auto_config(codec);
8171 "hda_codec: Cannot set up configuration "
8172 "from BIOS. Using base mode...\n");
8173 board_config = ALC883_3ST_2ch_DIG;
8177 if (board_config != ALC883_AUTO)
8178 setup_preset(spec, &alc883_presets[board_config]);
8180 spec->stream_name_analog = "ALC883 Analog";
8181 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8182 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8183 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8185 spec->stream_name_digital = "ALC883 Digital";
8186 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8187 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8189 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8190 spec->adc_nids = alc883_adc_nids;
8191 spec->capsrc_nids = alc883_capsrc_nids;
8193 spec->vmaster_nid = 0x0c;
8195 codec->patch_ops = alc_patch_ops;
8196 if (board_config == ALC883_AUTO)
8197 spec->init_hook = alc883_auto_init;
8198 #ifdef CONFIG_SND_HDA_POWER_SAVE
8199 if (!spec->loopback.amplist)
8200 spec->loopback.amplist = alc883_loopbacks;
8210 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8211 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8213 #define alc262_dac_nids alc260_dac_nids
8214 #define alc262_adc_nids alc882_adc_nids
8215 #define alc262_adc_nids_alt alc882_adc_nids_alt
8216 #define alc262_capsrc_nids alc882_capsrc_nids
8217 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8219 #define alc262_modes alc260_modes
8220 #define alc262_capture_source alc882_capture_source
8222 static struct snd_kcontrol_new alc262_base_mixer[] = {
8223 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8224 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8225 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8226 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8227 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8228 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8232 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8233 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8235 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8236 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8237 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8239 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8240 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8244 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8246 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8250 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8254 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8255 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8256 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8257 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8258 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8259 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8264 /* update HP, line and mono-out pins according to the master switch */
8265 static void alc262_hp_master_update(struct hda_codec *codec)
8267 struct alc_spec *spec = codec->spec;
8268 int val = spec->master_sw;
8271 snd_hda_codec_write_cache(codec, 0x1b, 0,
8272 AC_VERB_SET_PIN_WIDGET_CONTROL,
8274 snd_hda_codec_write_cache(codec, 0x15, 0,
8275 AC_VERB_SET_PIN_WIDGET_CONTROL,
8277 /* mono (speaker) depending on the HP jack sense */
8278 val = val && !spec->jack_present;
8279 snd_hda_codec_write_cache(codec, 0x16, 0,
8280 AC_VERB_SET_PIN_WIDGET_CONTROL,
8284 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8286 struct alc_spec *spec = codec->spec;
8287 unsigned int presence;
8288 presence = snd_hda_codec_read(codec, 0x1b, 0,
8289 AC_VERB_GET_PIN_SENSE, 0);
8290 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8291 alc262_hp_master_update(codec);
8294 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8296 if ((res >> 26) != ALC880_HP_EVENT)
8298 alc262_hp_bpc_automute(codec);
8301 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8303 struct alc_spec *spec = codec->spec;
8304 unsigned int presence;
8305 presence = snd_hda_codec_read(codec, 0x15, 0,
8306 AC_VERB_GET_PIN_SENSE, 0);
8307 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8308 alc262_hp_master_update(codec);
8311 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8314 if ((res >> 26) != ALC880_HP_EVENT)
8316 alc262_hp_wildwest_automute(codec);
8319 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8320 struct snd_ctl_elem_value *ucontrol)
8322 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8323 struct alc_spec *spec = codec->spec;
8324 *ucontrol->value.integer.value = spec->master_sw;
8328 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8329 struct snd_ctl_elem_value *ucontrol)
8331 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8332 struct alc_spec *spec = codec->spec;
8333 int val = !!*ucontrol->value.integer.value;
8335 if (val == spec->master_sw)
8337 spec->master_sw = val;
8338 alc262_hp_master_update(codec);
8342 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8344 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8345 .name = "Master Playback Switch",
8346 .info = snd_ctl_boolean_mono_info,
8347 .get = alc262_hp_master_sw_get,
8348 .put = alc262_hp_master_sw_put,
8350 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8351 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8353 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8355 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8357 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8358 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8359 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8360 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8361 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8363 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8364 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8365 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8366 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8367 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8368 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8369 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8370 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8374 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8377 .name = "Master Playback Switch",
8378 .info = snd_ctl_boolean_mono_info,
8379 .get = alc262_hp_master_sw_get,
8380 .put = alc262_hp_master_sw_put,
8382 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8383 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8384 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8386 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8388 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8390 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8391 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8392 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8393 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8394 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8395 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8396 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8397 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8398 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8402 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8403 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8404 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8405 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8409 /* mute/unmute internal speaker according to the hp jack and mute state */
8410 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8412 struct alc_spec *spec = codec->spec;
8414 if (force || !spec->sense_updated) {
8415 unsigned int present;
8416 present = snd_hda_codec_read(codec, 0x15, 0,
8417 AC_VERB_GET_PIN_SENSE, 0);
8418 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8419 spec->sense_updated = 1;
8421 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8422 spec->jack_present ? HDA_AMP_MUTE : 0);
8425 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8428 if ((res >> 26) != ALC880_HP_EVENT)
8430 alc262_hp_t5735_automute(codec, 1);
8433 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8435 alc262_hp_t5735_automute(codec, 1);
8438 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8439 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8440 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8441 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8442 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8444 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8445 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8449 static struct hda_verb alc262_hp_t5735_verbs[] = {
8450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8453 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8457 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8458 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8460 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8461 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8462 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8463 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8467 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8468 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8469 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8471 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8473 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8477 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8481 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8488 /* bind hp and internal speaker mute (with plug check) */
8489 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8490 struct snd_ctl_elem_value *ucontrol)
8492 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8493 long *valp = ucontrol->value.integer.value;
8496 /* change hp mute */
8497 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8499 valp[0] ? 0 : HDA_AMP_MUTE);
8500 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8502 valp[1] ? 0 : HDA_AMP_MUTE);
8504 /* change speaker according to HP jack state */
8505 struct alc_spec *spec = codec->spec;
8507 if (spec->jack_present)
8508 mute = HDA_AMP_MUTE;
8510 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8512 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8513 HDA_AMP_MUTE, mute);
8518 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8519 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8521 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8522 .name = "Master Playback Switch",
8523 .info = snd_hda_mixer_amp_switch_info,
8524 .get = snd_hda_mixer_amp_switch_get,
8525 .put = alc262_sony_master_sw_put,
8526 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8528 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8529 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8530 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8531 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8535 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8536 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8537 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8541 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8542 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8546 #define alc262_capture_mixer alc882_capture_mixer
8547 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8550 * generic initialization of ADC, input mixers and output mixers
8552 static struct hda_verb alc262_init_verbs[] = {
8554 * Unmute ADC0-2 and set the default input to mic-in
8556 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8558 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8560 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8563 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8565 * Note: PASD motherboards uses the Line In 2 as the input for
8566 * front panel mic (mic 2)
8568 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8576 * Set up output mixers (0x0c - 0x0e)
8578 /* set vol=0 to output mixers */
8579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8580 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8582 /* set up input amps for analog loopback */
8583 /* Amp Indices: DAC = 0, mixer = 1 */
8584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8593 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8594 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8596 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8599 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8600 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8601 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8602 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8604 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8607 /* FIXME: use matrix-type input source selection */
8608 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8609 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8628 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8629 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8634 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8635 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8636 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8637 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8639 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8640 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8644 static struct hda_verb alc262_sony_unsol_verbs[] = {
8645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8646 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8647 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8649 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8654 /* mute/unmute internal speaker according to the hp jack and mute state */
8655 static void alc262_hippo_automute(struct hda_codec *codec)
8657 struct alc_spec *spec = codec->spec;
8659 unsigned int present;
8661 /* need to execute and sync at first */
8662 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8663 present = snd_hda_codec_read(codec, 0x15, 0,
8664 AC_VERB_GET_PIN_SENSE, 0);
8665 spec->jack_present = (present & 0x80000000) != 0;
8666 if (spec->jack_present) {
8667 /* mute internal speaker */
8668 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8669 HDA_AMP_MUTE, HDA_AMP_MUTE);
8671 /* unmute internal speaker if necessary */
8672 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8673 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8674 HDA_AMP_MUTE, mute);
8678 /* unsolicited event for HP jack sensing */
8679 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8682 if ((res >> 26) != ALC880_HP_EVENT)
8684 alc262_hippo_automute(codec);
8687 static void alc262_hippo1_automute(struct hda_codec *codec)
8690 unsigned int present;
8692 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8693 present = snd_hda_codec_read(codec, 0x1b, 0,
8694 AC_VERB_GET_PIN_SENSE, 0);
8695 present = (present & 0x80000000) != 0;
8697 /* mute internal speaker */
8698 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8699 HDA_AMP_MUTE, HDA_AMP_MUTE);
8701 /* unmute internal speaker if necessary */
8702 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8703 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8704 HDA_AMP_MUTE, mute);
8708 /* unsolicited event for HP jack sensing */
8709 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8712 if ((res >> 26) != ALC880_HP_EVENT)
8714 alc262_hippo1_automute(codec);
8719 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8720 * 0x1b = port replicator headphone out
8723 #define ALC_HP_EVENT 0x37
8725 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8726 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8728 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8733 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8734 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8739 static struct hda_input_mux alc262_fujitsu_capture_source = {
8748 static struct hda_input_mux alc262_HP_capture_source = {
8752 { "Front Mic", 0x1 },
8759 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8763 { "Front Mic", 0x2 },
8769 /* mute/unmute internal speaker according to the hp jacks and mute state */
8770 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8772 struct alc_spec *spec = codec->spec;
8775 if (force || !spec->sense_updated) {
8776 unsigned int present;
8777 /* need to execute and sync at first */
8778 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8779 /* check laptop HP jack */
8780 present = snd_hda_codec_read(codec, 0x14, 0,
8781 AC_VERB_GET_PIN_SENSE, 0);
8782 /* need to execute and sync at first */
8783 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8784 /* check docking HP jack */
8785 present |= snd_hda_codec_read(codec, 0x1b, 0,
8786 AC_VERB_GET_PIN_SENSE, 0);
8787 if (present & AC_PINSENSE_PRESENCE)
8788 spec->jack_present = 1;
8790 spec->jack_present = 0;
8791 spec->sense_updated = 1;
8793 /* unmute internal speaker only if both HPs are unplugged and
8794 * master switch is on
8796 if (spec->jack_present)
8797 mute = HDA_AMP_MUTE;
8799 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8800 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8801 HDA_AMP_MUTE, mute);
8804 /* unsolicited event for HP jack sensing */
8805 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8808 if ((res >> 26) != ALC_HP_EVENT)
8810 alc262_fujitsu_automute(codec, 1);
8813 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
8815 alc262_fujitsu_automute(codec, 1);
8818 /* bind volumes of both NID 0x0c and 0x0d */
8819 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8820 .ops = &snd_hda_bind_vol,
8822 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8823 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8828 /* mute/unmute internal speaker according to the hp jack and mute state */
8829 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
8831 struct alc_spec *spec = codec->spec;
8834 if (force || !spec->sense_updated) {
8835 unsigned int present_int_hp;
8836 /* need to execute and sync at first */
8837 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8838 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
8839 AC_VERB_GET_PIN_SENSE, 0);
8840 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8841 spec->sense_updated = 1;
8843 if (spec->jack_present) {
8844 /* mute internal speaker */
8845 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8846 HDA_AMP_MUTE, HDA_AMP_MUTE);
8847 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8848 HDA_AMP_MUTE, HDA_AMP_MUTE);
8850 /* unmute internal speaker if necessary */
8851 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8852 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8853 HDA_AMP_MUTE, mute);
8854 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8855 HDA_AMP_MUTE, mute);
8859 /* unsolicited event for HP jack sensing */
8860 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
8863 if ((res >> 26) != ALC_HP_EVENT)
8865 alc262_lenovo_3000_automute(codec, 1);
8868 /* bind hp and internal speaker mute (with plug check) */
8869 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8870 struct snd_ctl_elem_value *ucontrol)
8872 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8873 long *valp = ucontrol->value.integer.value;
8876 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8878 valp ? 0 : HDA_AMP_MUTE);
8879 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8881 valp ? 0 : HDA_AMP_MUTE);
8884 alc262_fujitsu_automute(codec, 0);
8888 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8889 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8891 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8892 .name = "Master Playback Switch",
8893 .info = snd_hda_mixer_amp_switch_info,
8894 .get = snd_hda_mixer_amp_switch_get,
8895 .put = alc262_fujitsu_master_sw_put,
8896 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8900 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
8901 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
8902 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8904 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8905 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8906 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8907 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8911 /* bind hp and internal speaker mute (with plug check) */
8912 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
8913 struct snd_ctl_elem_value *ucontrol)
8915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8916 long *valp = ucontrol->value.integer.value;
8919 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8921 valp ? 0 : HDA_AMP_MUTE);
8924 alc262_lenovo_3000_automute(codec, 0);
8928 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
8929 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8932 .name = "Master Playback Switch",
8933 .info = snd_hda_mixer_amp_switch_info,
8934 .get = snd_hda_mixer_amp_switch_get,
8935 .put = alc262_lenovo_3000_master_sw_put,
8936 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8938 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8939 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8940 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8943 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8944 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8945 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8949 /* additional init verbs for Benq laptops */
8950 static struct hda_verb alc262_EAPD_verbs[] = {
8951 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8952 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8956 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8957 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8958 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8960 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8961 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8965 /* Samsung Q1 Ultra Vista model setup */
8966 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8967 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8968 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
8969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8971 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8972 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
8976 static struct hda_verb alc262_ultra_verbs[] = {
8978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8980 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8984 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8985 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8987 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8988 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8990 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8991 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8993 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8995 /* ADC, choose mic */
8996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8997 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9002 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9003 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9004 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9005 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9009 /* mute/unmute internal speaker according to the hp jack and mute state */
9010 static void alc262_ultra_automute(struct hda_codec *codec)
9012 struct alc_spec *spec = codec->spec;
9016 /* auto-mute only when HP is used as HP */
9017 if (!spec->cur_mux[0]) {
9018 unsigned int present;
9019 /* need to execute and sync at first */
9020 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9021 present = snd_hda_codec_read(codec, 0x15, 0,
9022 AC_VERB_GET_PIN_SENSE, 0);
9023 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9024 if (spec->jack_present)
9025 mute = HDA_AMP_MUTE;
9027 /* mute/unmute internal speaker */
9028 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9029 HDA_AMP_MUTE, mute);
9030 /* mute/unmute HP */
9031 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9032 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9035 /* unsolicited event for HP jack sensing */
9036 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9039 if ((res >> 26) != ALC880_HP_EVENT)
9041 alc262_ultra_automute(codec);
9044 static struct hda_input_mux alc262_ultra_capture_source = {
9048 { "Headphone", 0x7 },
9052 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9053 struct snd_ctl_elem_value *ucontrol)
9055 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9056 struct alc_spec *spec = codec->spec;
9059 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9062 /* reprogram the HP pin as mic or HP according to the input source */
9063 snd_hda_codec_write_cache(codec, 0x15, 0,
9064 AC_VERB_SET_PIN_WIDGET_CONTROL,
9065 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9066 alc262_ultra_automute(codec); /* mute/unmute HP */
9070 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9071 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9072 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9074 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9075 .name = "Capture Source",
9076 .info = alc882_mux_enum_info,
9077 .get = alc882_mux_enum_get,
9078 .put = alc262_ultra_mux_enum_put,
9083 /* add playback controls from the parsed DAC table */
9084 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9085 const struct auto_pin_cfg *cfg)
9090 spec->multiout.num_dacs = 1; /* only use one dac */
9091 spec->multiout.dac_nids = spec->private_dac_nids;
9092 spec->multiout.dac_nids[0] = 2;
9094 nid = cfg->line_out_pins[0];
9096 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9097 "Front Playback Volume",
9098 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9101 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9102 "Front Playback Switch",
9103 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9108 nid = cfg->speaker_pins[0];
9111 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9112 "Speaker Playback Volume",
9113 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9117 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9118 "Speaker Playback Switch",
9119 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9124 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9125 "Speaker Playback Switch",
9126 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9132 nid = cfg->hp_pins[0];
9134 /* spec->multiout.hp_nid = 2; */
9136 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9137 "Headphone Playback Volume",
9138 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9142 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9143 "Headphone Playback Switch",
9144 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9149 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9150 "Headphone Playback Switch",
9151 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9160 /* identical with ALC880 */
9161 #define alc262_auto_create_analog_input_ctls \
9162 alc880_auto_create_analog_input_ctls
9165 * generic initialization of ADC, input mixers and output mixers
9167 static struct hda_verb alc262_volume_init_verbs[] = {
9169 * Unmute ADC0-2 and set the default input to mic-in
9171 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9173 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9174 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9175 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9176 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9178 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9180 * Note: PASD motherboards uses the Line In 2 as the input for
9181 * front panel mic (mic 2)
9183 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9191 * Set up output mixers (0x0c - 0x0f)
9193 /* set vol=0 to output mixers */
9194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9195 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9196 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9198 /* set up input amps for analog loopback */
9199 /* Amp Indices: DAC = 0, mixer = 1 */
9200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9202 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9203 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9204 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9205 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9207 /* FIXME: use matrix-type input source selection */
9208 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9209 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9211 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9212 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9213 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9215 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9216 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9217 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9218 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9221 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9222 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9228 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9230 * Unmute ADC0-2 and set the default input to mic-in
9232 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9234 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9236 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9239 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9241 * Note: PASD motherboards uses the Line In 2 as the input for
9242 * front panel mic (mic 2)
9244 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9254 * Set up output mixers (0x0c - 0x0e)
9256 /* set vol=0 to output mixers */
9257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9261 /* set up input amps for analog loopback */
9262 /* Amp Indices: DAC = 0, mixer = 1 */
9263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9270 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9271 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9274 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9277 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9278 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9280 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9281 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9282 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9283 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9284 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9286 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9287 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9289 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9290 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9291 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9294 /* FIXME: use matrix-type input source selection */
9295 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9296 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9298 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9302 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9303 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9312 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9317 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9319 * Unmute ADC0-2 and set the default input to mic-in
9321 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9323 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9325 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9328 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9330 * Note: PASD motherboards uses the Line In 2 as the input for front
9333 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9343 * Set up output mixers (0x0c - 0x0e)
9345 /* set vol=0 to output mixers */
9346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9350 /* set up input amps for analog loopback */
9351 /* Amp Indices: DAC = 0, mixer = 1 */
9352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9362 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9363 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9366 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9368 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9371 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9374 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9378 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9379 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9381 /* FIXME: use matrix-type input source selection */
9382 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9383 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9389 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9397 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9405 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9408 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9413 #ifdef CONFIG_SND_HDA_POWER_SAVE
9414 #define alc262_loopbacks alc880_loopbacks
9417 /* pcm configuration: identiacal with ALC880 */
9418 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9419 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9420 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9421 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9424 * BIOS auto configuration
9426 static int alc262_parse_auto_config(struct hda_codec *codec)
9428 struct alc_spec *spec = codec->spec;
9430 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9432 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9436 if (!spec->autocfg.line_outs)
9437 return 0; /* can't find valid BIOS pin config */
9438 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9441 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9445 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9447 if (spec->autocfg.dig_out_pin)
9448 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9449 if (spec->autocfg.dig_in_pin)
9450 spec->dig_in_nid = ALC262_DIGIN_NID;
9452 if (spec->kctl_alloc)
9453 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9455 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9456 spec->num_mux_defs = 1;
9457 spec->input_mux = &spec->private_imux;
9459 err = alc_auto_add_mic_boost(codec);
9466 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9467 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9468 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9471 /* init callback for auto-configuration model -- overriding the default init */
9472 static void alc262_auto_init(struct hda_codec *codec)
9474 struct alc_spec *spec = codec->spec;
9475 alc262_auto_init_multi_out(codec);
9476 alc262_auto_init_hp_out(codec);
9477 alc262_auto_init_analog_input(codec);
9478 if (spec->unsol_event)
9479 alc_sku_automute(codec);
9483 * configuration and preset
9485 static const char *alc262_models[ALC262_MODEL_LAST] = {
9486 [ALC262_BASIC] = "basic",
9487 [ALC262_HIPPO] = "hippo",
9488 [ALC262_HIPPO_1] = "hippo_1",
9489 [ALC262_FUJITSU] = "fujitsu",
9490 [ALC262_HP_BPC] = "hp-bpc",
9491 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9492 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9493 [ALC262_HP_RP5700] = "hp-rp5700",
9494 [ALC262_BENQ_ED8] = "benq",
9495 [ALC262_BENQ_T31] = "benq-t31",
9496 [ALC262_SONY_ASSAMD] = "sony-assamd",
9497 [ALC262_ULTRA] = "ultra",
9498 [ALC262_LENOVO_3000] = "lenovo-3000",
9499 [ALC262_AUTO] = "auto",
9502 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9503 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9504 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9505 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9506 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9507 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9508 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9509 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9510 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9511 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9512 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9513 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9514 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9515 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9516 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9517 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9518 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9519 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9520 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9521 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9522 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9523 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9524 ALC262_HP_TC_T5735),
9525 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9526 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9527 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9528 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9529 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9530 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9531 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9532 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9533 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9534 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9535 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9536 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9537 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9538 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9542 static struct alc_config_preset alc262_presets[] = {
9544 .mixers = { alc262_base_mixer },
9545 .init_verbs = { alc262_init_verbs },
9546 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9547 .dac_nids = alc262_dac_nids,
9549 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9550 .channel_mode = alc262_modes,
9551 .input_mux = &alc262_capture_source,
9554 .mixers = { alc262_base_mixer },
9555 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9556 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9557 .dac_nids = alc262_dac_nids,
9559 .dig_out_nid = ALC262_DIGOUT_NID,
9560 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9561 .channel_mode = alc262_modes,
9562 .input_mux = &alc262_capture_source,
9563 .unsol_event = alc262_hippo_unsol_event,
9564 .init_hook = alc262_hippo_automute,
9566 [ALC262_HIPPO_1] = {
9567 .mixers = { alc262_hippo1_mixer },
9568 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9569 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9570 .dac_nids = alc262_dac_nids,
9572 .dig_out_nid = ALC262_DIGOUT_NID,
9573 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9574 .channel_mode = alc262_modes,
9575 .input_mux = &alc262_capture_source,
9576 .unsol_event = alc262_hippo1_unsol_event,
9577 .init_hook = alc262_hippo1_automute,
9579 [ALC262_FUJITSU] = {
9580 .mixers = { alc262_fujitsu_mixer },
9581 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9582 alc262_fujitsu_unsol_verbs },
9583 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9584 .dac_nids = alc262_dac_nids,
9586 .dig_out_nid = ALC262_DIGOUT_NID,
9587 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9588 .channel_mode = alc262_modes,
9589 .input_mux = &alc262_fujitsu_capture_source,
9590 .unsol_event = alc262_fujitsu_unsol_event,
9591 .init_hook = alc262_fujitsu_init_hook,
9594 .mixers = { alc262_HP_BPC_mixer },
9595 .init_verbs = { alc262_HP_BPC_init_verbs },
9596 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9597 .dac_nids = alc262_dac_nids,
9599 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9600 .channel_mode = alc262_modes,
9601 .input_mux = &alc262_HP_capture_source,
9602 .unsol_event = alc262_hp_bpc_unsol_event,
9603 .init_hook = alc262_hp_bpc_automute,
9605 [ALC262_HP_BPC_D7000_WF] = {
9606 .mixers = { alc262_HP_BPC_WildWest_mixer },
9607 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9608 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9609 .dac_nids = alc262_dac_nids,
9611 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9612 .channel_mode = alc262_modes,
9613 .input_mux = &alc262_HP_D7000_capture_source,
9614 .unsol_event = alc262_hp_wildwest_unsol_event,
9615 .init_hook = alc262_hp_wildwest_automute,
9617 [ALC262_HP_BPC_D7000_WL] = {
9618 .mixers = { alc262_HP_BPC_WildWest_mixer,
9619 alc262_HP_BPC_WildWest_option_mixer },
9620 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9621 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9622 .dac_nids = alc262_dac_nids,
9624 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9625 .channel_mode = alc262_modes,
9626 .input_mux = &alc262_HP_D7000_capture_source,
9627 .unsol_event = alc262_hp_wildwest_unsol_event,
9628 .init_hook = alc262_hp_wildwest_automute,
9630 [ALC262_HP_TC_T5735] = {
9631 .mixers = { alc262_hp_t5735_mixer },
9632 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9633 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9634 .dac_nids = alc262_dac_nids,
9636 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9637 .channel_mode = alc262_modes,
9638 .input_mux = &alc262_capture_source,
9639 .unsol_event = alc262_hp_t5735_unsol_event,
9640 .init_hook = alc262_hp_t5735_init_hook,
9642 [ALC262_HP_RP5700] = {
9643 .mixers = { alc262_hp_rp5700_mixer },
9644 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9645 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9646 .dac_nids = alc262_dac_nids,
9647 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9648 .channel_mode = alc262_modes,
9649 .input_mux = &alc262_hp_rp5700_capture_source,
9651 [ALC262_BENQ_ED8] = {
9652 .mixers = { alc262_base_mixer },
9653 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9654 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9655 .dac_nids = alc262_dac_nids,
9657 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9658 .channel_mode = alc262_modes,
9659 .input_mux = &alc262_capture_source,
9661 [ALC262_SONY_ASSAMD] = {
9662 .mixers = { alc262_sony_mixer },
9663 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9664 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9665 .dac_nids = alc262_dac_nids,
9667 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9668 .channel_mode = alc262_modes,
9669 .input_mux = &alc262_capture_source,
9670 .unsol_event = alc262_hippo_unsol_event,
9671 .init_hook = alc262_hippo_automute,
9673 [ALC262_BENQ_T31] = {
9674 .mixers = { alc262_benq_t31_mixer },
9675 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9676 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9677 .dac_nids = alc262_dac_nids,
9679 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9680 .channel_mode = alc262_modes,
9681 .input_mux = &alc262_capture_source,
9682 .unsol_event = alc262_hippo_unsol_event,
9683 .init_hook = alc262_hippo_automute,
9686 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9687 .init_verbs = { alc262_ultra_verbs },
9688 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9689 .dac_nids = alc262_dac_nids,
9690 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9691 .channel_mode = alc262_modes,
9692 .input_mux = &alc262_ultra_capture_source,
9693 .adc_nids = alc262_adc_nids, /* ADC0 */
9694 .capsrc_nids = alc262_capsrc_nids,
9695 .num_adc_nids = 1, /* single ADC */
9696 .unsol_event = alc262_ultra_unsol_event,
9697 .init_hook = alc262_ultra_automute,
9699 [ALC262_LENOVO_3000] = {
9700 .mixers = { alc262_lenovo_3000_mixer },
9701 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9702 alc262_lenovo_3000_unsol_verbs },
9703 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9704 .dac_nids = alc262_dac_nids,
9706 .dig_out_nid = ALC262_DIGOUT_NID,
9707 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9708 .channel_mode = alc262_modes,
9709 .input_mux = &alc262_fujitsu_capture_source,
9710 .unsol_event = alc262_lenovo_3000_unsol_event,
9714 static int patch_alc262(struct hda_codec *codec)
9716 struct alc_spec *spec;
9720 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9726 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9731 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9732 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9733 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9734 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9738 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9742 if (board_config < 0) {
9743 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9744 "trying auto-probe from BIOS...\n");
9745 board_config = ALC262_AUTO;
9748 if (board_config == ALC262_AUTO) {
9749 /* automatic parse from the BIOS config */
9750 err = alc262_parse_auto_config(codec);
9756 "hda_codec: Cannot set up configuration "
9757 "from BIOS. Using base mode...\n");
9758 board_config = ALC262_BASIC;
9762 if (board_config != ALC262_AUTO)
9763 setup_preset(spec, &alc262_presets[board_config]);
9765 spec->stream_name_analog = "ALC262 Analog";
9766 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9767 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9769 spec->stream_name_digital = "ALC262 Digital";
9770 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9771 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9773 if (!spec->adc_nids && spec->input_mux) {
9774 /* check whether NID 0x07 is valid */
9775 unsigned int wcap = get_wcaps(codec, 0x07);
9778 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9779 if (wcap != AC_WID_AUD_IN) {
9780 spec->adc_nids = alc262_adc_nids_alt;
9781 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9782 spec->capsrc_nids = alc262_capsrc_nids_alt;
9783 spec->mixers[spec->num_mixers] =
9784 alc262_capture_alt_mixer;
9787 spec->adc_nids = alc262_adc_nids;
9788 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9789 spec->capsrc_nids = alc262_capsrc_nids;
9790 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9795 spec->vmaster_nid = 0x0c;
9797 codec->patch_ops = alc_patch_ops;
9798 if (board_config == ALC262_AUTO)
9799 spec->init_hook = alc262_auto_init;
9800 #ifdef CONFIG_SND_HDA_POWER_SAVE
9801 if (!spec->loopback.amplist)
9802 spec->loopback.amplist = alc262_loopbacks;
9809 * ALC268 channel source setting (2 channel)
9811 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9812 #define alc268_modes alc260_modes
9814 static hda_nid_t alc268_dac_nids[2] = {
9819 static hda_nid_t alc268_adc_nids[2] = {
9824 static hda_nid_t alc268_adc_nids_alt[1] = {
9829 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
9831 static struct snd_kcontrol_new alc268_base_mixer[] = {
9832 /* output mixer control */
9833 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9834 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9835 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9837 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9838 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9839 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9843 /* bind Beep switches of both NID 0x0f and 0x10 */
9844 static struct hda_bind_ctls alc268_bind_beep_sw = {
9845 .ops = &snd_hda_bind_sw,
9847 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9848 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9853 static struct snd_kcontrol_new alc268_beep_mixer[] = {
9854 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9855 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9859 static struct hda_verb alc268_eapd_verbs[] = {
9860 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9861 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9865 /* Toshiba specific */
9866 #define alc268_toshiba_automute alc262_hippo_automute
9868 static struct hda_verb alc268_toshiba_verbs[] = {
9869 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9874 /* bind volumes of both NID 0x02 and 0x03 */
9875 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9876 .ops = &snd_hda_bind_vol,
9878 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9879 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9884 /* mute/unmute internal speaker according to the hp jack and mute state */
9885 static void alc268_acer_automute(struct hda_codec *codec, int force)
9887 struct alc_spec *spec = codec->spec;
9890 if (force || !spec->sense_updated) {
9891 unsigned int present;
9892 present = snd_hda_codec_read(codec, 0x14, 0,
9893 AC_VERB_GET_PIN_SENSE, 0);
9894 spec->jack_present = (present & 0x80000000) != 0;
9895 spec->sense_updated = 1;
9897 if (spec->jack_present)
9898 mute = HDA_AMP_MUTE; /* mute internal speaker */
9899 else /* unmute internal speaker if necessary */
9900 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9901 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9902 HDA_AMP_MUTE, mute);
9906 /* bind hp and internal speaker mute (with plug check) */
9907 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9908 struct snd_ctl_elem_value *ucontrol)
9910 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9911 long *valp = ucontrol->value.integer.value;
9914 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9916 valp[0] ? 0 : HDA_AMP_MUTE);
9917 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9919 valp[1] ? 0 : HDA_AMP_MUTE);
9921 alc268_acer_automute(codec, 0);
9925 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9926 /* output mixer control */
9927 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9930 .name = "Master Playback Switch",
9931 .info = snd_hda_mixer_amp_switch_info,
9932 .get = snd_hda_mixer_amp_switch_get,
9933 .put = alc268_acer_master_sw_put,
9934 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9936 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9937 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9938 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9942 static struct hda_verb alc268_acer_verbs[] = {
9943 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
9944 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9945 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9946 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9947 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9948 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9950 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9954 /* unsolicited event for HP jack sensing */
9955 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9958 if ((res >> 26) != ALC880_HP_EVENT)
9960 alc268_toshiba_automute(codec);
9963 static void alc268_acer_unsol_event(struct hda_codec *codec,
9966 if ((res >> 26) != ALC880_HP_EVENT)
9968 alc268_acer_automute(codec, 1);
9971 static void alc268_acer_init_hook(struct hda_codec *codec)
9973 alc268_acer_automute(codec, 1);
9976 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9977 /* output mixer control */
9978 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9979 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9980 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9981 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9982 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9983 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9987 static struct hda_verb alc268_dell_verbs[] = {
9988 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9990 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9994 /* mute/unmute internal speaker according to the hp jack and mute state */
9995 static void alc268_dell_automute(struct hda_codec *codec)
9997 unsigned int present;
10000 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10001 if (present & 0x80000000)
10002 mute = HDA_AMP_MUTE;
10004 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10005 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10006 HDA_AMP_MUTE, mute);
10009 static void alc268_dell_unsol_event(struct hda_codec *codec,
10012 if ((res >> 26) != ALC880_HP_EVENT)
10014 alc268_dell_automute(codec);
10017 #define alc268_dell_init_hook alc268_dell_automute
10019 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10020 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10021 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10022 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10024 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10025 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10026 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10027 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10031 static struct hda_verb alc267_quanta_il1_verbs[] = {
10032 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10033 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10037 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10039 unsigned int present;
10041 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10042 & AC_PINSENSE_PRESENCE;
10043 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10044 present ? 0 : PIN_OUT);
10047 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10049 unsigned int present;
10051 present = snd_hda_codec_read(codec, 0x18, 0,
10052 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10053 snd_hda_codec_write(codec, 0x23, 0,
10054 AC_VERB_SET_CONNECT_SEL,
10055 present ? 0x00 : 0x01);
10058 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10060 alc267_quanta_il1_hp_automute(codec);
10061 alc267_quanta_il1_mic_automute(codec);
10064 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10067 switch (res >> 26) {
10068 case ALC880_HP_EVENT:
10069 alc267_quanta_il1_hp_automute(codec);
10071 case ALC880_MIC_EVENT:
10072 alc267_quanta_il1_mic_automute(codec);
10078 * generic initialization of ADC, input mixers and output mixers
10080 static struct hda_verb alc268_base_init_verbs[] = {
10081 /* Unmute DAC0-1 and set vol = 0 */
10082 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10083 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10084 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10085 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10086 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10087 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10090 * Set up output mixers (0x0c - 0x0e)
10092 /* set vol=0 to output mixers */
10093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10094 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10095 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10096 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10098 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10099 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10103 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10105 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10106 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10107 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10108 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10110 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10112 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10113 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10114 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10115 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10116 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10118 /* set PCBEEP vol = 0, mute connections */
10119 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10120 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10121 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10123 /* Unmute Selector 23h,24h and set the default input to mic-in */
10125 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10127 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10134 * generic initialization of ADC, input mixers and output mixers
10136 static struct hda_verb alc268_volume_init_verbs[] = {
10137 /* set output DAC */
10138 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10139 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10140 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10141 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10143 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10145 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10146 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10147 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10149 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10150 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10151 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10152 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10153 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10155 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10156 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10157 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10158 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10160 /* set PCBEEP vol = 0, mute connections */
10161 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10163 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10168 #define alc268_mux_enum_info alc_mux_enum_info
10169 #define alc268_mux_enum_get alc_mux_enum_get
10170 #define alc268_mux_enum_put alc_mux_enum_put
10172 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10173 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10174 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10176 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10177 /* The multiple "Capture Source" controls confuse alsamixer
10178 * So call somewhat different..
10180 /* .name = "Capture Source", */
10181 .name = "Input Source",
10183 .info = alc268_mux_enum_info,
10184 .get = alc268_mux_enum_get,
10185 .put = alc268_mux_enum_put,
10190 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10191 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10192 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10193 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10194 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10196 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10197 /* The multiple "Capture Source" controls confuse alsamixer
10198 * So call somewhat different..
10200 /* .name = "Capture Source", */
10201 .name = "Input Source",
10203 .info = alc268_mux_enum_info,
10204 .get = alc268_mux_enum_get,
10205 .put = alc268_mux_enum_put,
10210 static struct hda_input_mux alc268_capture_source = {
10214 { "Front Mic", 0x1 },
10220 static struct hda_input_mux alc268_acer_capture_source = {
10224 { "Internal Mic", 0x6 },
10229 #ifdef CONFIG_SND_DEBUG
10230 static struct snd_kcontrol_new alc268_test_mixer[] = {
10231 /* Volume widgets */
10232 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10233 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10234 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10235 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10236 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10237 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10238 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10239 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10240 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10241 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10242 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10243 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10244 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10245 /* The below appears problematic on some hardwares */
10246 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10247 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10248 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10249 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10250 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10252 /* Modes for retasking pin widgets */
10253 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10254 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10255 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10256 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10258 /* Controls for GPIO pins, assuming they are configured as outputs */
10259 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10260 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10261 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10262 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10264 /* Switches to allow the digital SPDIF output pin to be enabled.
10265 * The ALC268 does not have an SPDIF input.
10267 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10269 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10270 * this output to turn on an external amplifier.
10272 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10273 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10279 /* create input playback/capture controls for the given pin */
10280 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10281 const char *ctlname, int idx)
10286 sprintf(name, "%s Playback Volume", ctlname);
10288 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10289 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10293 } else if (nid == 0x15) {
10294 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10295 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10301 sprintf(name, "%s Playback Switch", ctlname);
10302 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10303 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10309 /* add playback controls from the parsed DAC table */
10310 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10311 const struct auto_pin_cfg *cfg)
10316 spec->multiout.num_dacs = 2; /* only use one dac */
10317 spec->multiout.dac_nids = spec->private_dac_nids;
10318 spec->multiout.dac_nids[0] = 2;
10319 spec->multiout.dac_nids[1] = 3;
10321 nid = cfg->line_out_pins[0];
10323 alc268_new_analog_output(spec, nid, "Front", 0);
10325 nid = cfg->speaker_pins[0];
10327 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10328 "Speaker Playback Volume",
10329 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10333 nid = cfg->hp_pins[0];
10335 alc268_new_analog_output(spec, nid, "Headphone", 0);
10337 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10339 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10340 "Mono Playback Switch",
10341 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10348 /* create playback/capture controls for input pins */
10349 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10350 const struct auto_pin_cfg *cfg)
10352 struct hda_input_mux *imux = &spec->private_imux;
10355 for (i = 0; i < AUTO_PIN_LAST; i++) {
10356 switch(cfg->input_pins[i]) {
10358 idx1 = 0; /* Mic 1 */
10361 idx1 = 1; /* Mic 2 */
10364 idx1 = 2; /* Line In */
10371 idx1 = 6; /* digital mics */
10376 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10377 imux->items[imux->num_items].index = idx1;
10383 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10385 struct alc_spec *spec = codec->spec;
10386 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10387 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10388 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10389 unsigned int dac_vol1, dac_vol2;
10392 snd_hda_codec_write(codec, speaker_nid, 0,
10393 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10394 snd_hda_codec_write(codec, 0x0f, 0,
10395 AC_VERB_SET_AMP_GAIN_MUTE,
10397 snd_hda_codec_write(codec, 0x10, 0,
10398 AC_VERB_SET_AMP_GAIN_MUTE,
10401 snd_hda_codec_write(codec, 0x0f, 0,
10402 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10403 snd_hda_codec_write(codec, 0x10, 0,
10404 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10407 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10408 if (line_nid == 0x14)
10409 dac_vol2 = AMP_OUT_ZERO;
10410 else if (line_nid == 0x15)
10411 dac_vol1 = AMP_OUT_ZERO;
10412 if (hp_nid == 0x14)
10413 dac_vol2 = AMP_OUT_ZERO;
10414 else if (hp_nid == 0x15)
10415 dac_vol1 = AMP_OUT_ZERO;
10416 if (line_nid != 0x16 || hp_nid != 0x16 ||
10417 spec->autocfg.line_out_pins[1] != 0x16 ||
10418 spec->autocfg.line_out_pins[2] != 0x16)
10419 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10421 snd_hda_codec_write(codec, 0x02, 0,
10422 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10423 snd_hda_codec_write(codec, 0x03, 0,
10424 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10427 /* pcm configuration: identiacal with ALC880 */
10428 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10429 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10430 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10431 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10434 * BIOS auto configuration
10436 static int alc268_parse_auto_config(struct hda_codec *codec)
10438 struct alc_spec *spec = codec->spec;
10440 static hda_nid_t alc268_ignore[] = { 0 };
10442 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10446 if (!spec->autocfg.line_outs)
10447 return 0; /* can't find valid BIOS pin config */
10449 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10452 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10456 spec->multiout.max_channels = 2;
10458 /* digital only support output */
10459 if (spec->autocfg.dig_out_pin)
10460 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10462 if (spec->kctl_alloc)
10463 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10465 if (spec->autocfg.speaker_pins[0] != 0x1d)
10466 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10468 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10469 spec->num_mux_defs = 1;
10470 spec->input_mux = &spec->private_imux;
10472 err = alc_auto_add_mic_boost(codec);
10479 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10480 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10481 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10483 /* init callback for auto-configuration model -- overriding the default init */
10484 static void alc268_auto_init(struct hda_codec *codec)
10486 struct alc_spec *spec = codec->spec;
10487 alc268_auto_init_multi_out(codec);
10488 alc268_auto_init_hp_out(codec);
10489 alc268_auto_init_mono_speaker_out(codec);
10490 alc268_auto_init_analog_input(codec);
10491 if (spec->unsol_event)
10492 alc_sku_automute(codec);
10496 * configuration and preset
10498 static const char *alc268_models[ALC268_MODEL_LAST] = {
10499 [ALC267_QUANTA_IL1] = "quanta-il1",
10500 [ALC268_3ST] = "3stack",
10501 [ALC268_TOSHIBA] = "toshiba",
10502 [ALC268_ACER] = "acer",
10503 [ALC268_DELL] = "dell",
10504 [ALC268_ZEPTO] = "zepto",
10505 #ifdef CONFIG_SND_DEBUG
10506 [ALC268_TEST] = "test",
10508 [ALC268_AUTO] = "auto",
10511 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10512 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10513 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10514 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10515 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10516 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10517 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10518 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10519 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10520 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10521 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10522 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10523 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10524 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10525 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10529 static struct alc_config_preset alc268_presets[] = {
10530 [ALC267_QUANTA_IL1] = {
10531 .mixers = { alc267_quanta_il1_mixer },
10532 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10533 alc267_quanta_il1_verbs },
10534 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10535 .dac_nids = alc268_dac_nids,
10536 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10537 .adc_nids = alc268_adc_nids_alt,
10539 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10540 .channel_mode = alc268_modes,
10541 .input_mux = &alc268_capture_source,
10542 .unsol_event = alc267_quanta_il1_unsol_event,
10543 .init_hook = alc267_quanta_il1_automute,
10546 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10547 alc268_beep_mixer },
10548 .init_verbs = { alc268_base_init_verbs },
10549 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10550 .dac_nids = alc268_dac_nids,
10551 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10552 .adc_nids = alc268_adc_nids_alt,
10553 .capsrc_nids = alc268_capsrc_nids,
10555 .dig_out_nid = ALC268_DIGOUT_NID,
10556 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10557 .channel_mode = alc268_modes,
10558 .input_mux = &alc268_capture_source,
10560 [ALC268_TOSHIBA] = {
10561 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10562 alc268_beep_mixer },
10563 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10564 alc268_toshiba_verbs },
10565 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10566 .dac_nids = alc268_dac_nids,
10567 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10568 .adc_nids = alc268_adc_nids_alt,
10569 .capsrc_nids = alc268_capsrc_nids,
10571 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10572 .channel_mode = alc268_modes,
10573 .input_mux = &alc268_capture_source,
10574 .unsol_event = alc268_toshiba_unsol_event,
10575 .init_hook = alc268_toshiba_automute,
10578 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10579 alc268_beep_mixer },
10580 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10581 alc268_acer_verbs },
10582 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10583 .dac_nids = alc268_dac_nids,
10584 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10585 .adc_nids = alc268_adc_nids_alt,
10586 .capsrc_nids = alc268_capsrc_nids,
10588 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10589 .channel_mode = alc268_modes,
10590 .input_mux = &alc268_acer_capture_source,
10591 .unsol_event = alc268_acer_unsol_event,
10592 .init_hook = alc268_acer_init_hook,
10595 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10596 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10597 alc268_dell_verbs },
10598 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10599 .dac_nids = alc268_dac_nids,
10601 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10602 .channel_mode = alc268_modes,
10603 .unsol_event = alc268_dell_unsol_event,
10604 .init_hook = alc268_dell_init_hook,
10605 .input_mux = &alc268_capture_source,
10608 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10609 alc268_beep_mixer },
10610 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10611 alc268_toshiba_verbs },
10612 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10613 .dac_nids = alc268_dac_nids,
10614 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10615 .adc_nids = alc268_adc_nids_alt,
10616 .capsrc_nids = alc268_capsrc_nids,
10618 .dig_out_nid = ALC268_DIGOUT_NID,
10619 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10620 .channel_mode = alc268_modes,
10621 .input_mux = &alc268_capture_source,
10622 .unsol_event = alc268_toshiba_unsol_event,
10623 .init_hook = alc268_toshiba_automute
10625 #ifdef CONFIG_SND_DEBUG
10627 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10628 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10629 alc268_volume_init_verbs },
10630 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10631 .dac_nids = alc268_dac_nids,
10632 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10633 .adc_nids = alc268_adc_nids_alt,
10634 .capsrc_nids = alc268_capsrc_nids,
10636 .dig_out_nid = ALC268_DIGOUT_NID,
10637 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10638 .channel_mode = alc268_modes,
10639 .input_mux = &alc268_capture_source,
10644 static int patch_alc268(struct hda_codec *codec)
10646 struct alc_spec *spec;
10650 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10654 codec->spec = spec;
10656 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10660 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10661 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10662 "trying auto-probe from BIOS...\n");
10663 board_config = ALC268_AUTO;
10666 if (board_config == ALC268_AUTO) {
10667 /* automatic parse from the BIOS config */
10668 err = alc268_parse_auto_config(codec);
10674 "hda_codec: Cannot set up configuration "
10675 "from BIOS. Using base mode...\n");
10676 board_config = ALC268_3ST;
10680 if (board_config != ALC268_AUTO)
10681 setup_preset(spec, &alc268_presets[board_config]);
10683 spec->stream_name_analog = "ALC268 Analog";
10684 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10685 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10686 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10688 spec->stream_name_digital = "ALC268 Digital";
10689 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10691 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10692 /* override the amp caps for beep generator */
10693 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10694 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10695 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10696 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10697 (0 << AC_AMPCAP_MUTE_SHIFT));
10699 if (!spec->adc_nids && spec->input_mux) {
10700 /* check whether NID 0x07 is valid */
10701 unsigned int wcap = get_wcaps(codec, 0x07);
10705 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10706 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10707 spec->adc_nids = alc268_adc_nids_alt;
10708 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10709 spec->mixers[spec->num_mixers] =
10710 alc268_capture_alt_mixer;
10711 spec->num_mixers++;
10713 spec->adc_nids = alc268_adc_nids;
10714 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10715 spec->mixers[spec->num_mixers] =
10716 alc268_capture_mixer;
10717 spec->num_mixers++;
10719 spec->capsrc_nids = alc268_capsrc_nids;
10720 /* set default input source */
10721 for (i = 0; i < spec->num_adc_nids; i++)
10722 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10723 0, AC_VERB_SET_CONNECT_SEL,
10724 spec->input_mux->items[0].index);
10727 spec->vmaster_nid = 0x02;
10729 codec->patch_ops = alc_patch_ops;
10730 if (board_config == ALC268_AUTO)
10731 spec->init_hook = alc268_auto_init;
10737 * ALC269 channel source setting (2 channel)
10739 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10741 #define alc269_dac_nids alc260_dac_nids
10743 static hda_nid_t alc269_adc_nids[1] = {
10748 #define alc269_modes alc260_modes
10749 #define alc269_capture_source alc880_lg_lw_capture_source
10751 static struct snd_kcontrol_new alc269_base_mixer[] = {
10752 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10753 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10754 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10755 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10758 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10759 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10760 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10761 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10763 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10767 /* capture mixer elements */
10768 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10769 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10770 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10772 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10773 /* The multiple "Capture Source" controls confuse alsamixer
10774 * So call somewhat different..
10776 /* .name = "Capture Source", */
10777 .name = "Input Source",
10779 .info = alc_mux_enum_info,
10780 .get = alc_mux_enum_get,
10781 .put = alc_mux_enum_put,
10787 * generic initialization of ADC, input mixers and output mixers
10789 static struct hda_verb alc269_init_verbs[] = {
10791 * Unmute ADC0 and set the default input to mic-in
10793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10795 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10796 * analog-loopback mixer widget
10797 * Note: PASD motherboards uses the Line In 2 as the input for
10798 * front panel mic (mic 2)
10800 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10803 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10804 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10805 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10808 * Set up output mixers (0x0c - 0x0e)
10810 /* set vol=0 to output mixers */
10811 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10812 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10814 /* set up input amps for analog loopback */
10815 /* Amp Indices: DAC = 0, mixer = 1 */
10816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10824 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10825 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10826 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10827 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10834 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10835 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10836 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10837 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10839 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10840 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10842 /* FIXME: use matrix-type input source selection */
10843 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10844 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10851 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10852 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10856 /* add playback controls from the parsed DAC table */
10857 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10858 const struct auto_pin_cfg *cfg)
10863 spec->multiout.num_dacs = 1; /* only use one dac */
10864 spec->multiout.dac_nids = spec->private_dac_nids;
10865 spec->multiout.dac_nids[0] = 2;
10867 nid = cfg->line_out_pins[0];
10869 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10870 "Front Playback Volume",
10871 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10874 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10875 "Front Playback Switch",
10876 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10881 nid = cfg->speaker_pins[0];
10883 if (!cfg->line_out_pins[0]) {
10884 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10885 "Speaker Playback Volume",
10886 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10892 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10893 "Speaker Playback Switch",
10894 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10899 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10900 "Speaker Playback Switch",
10901 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10907 nid = cfg->hp_pins[0];
10909 /* spec->multiout.hp_nid = 2; */
10910 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10911 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10912 "Headphone Playback Volume",
10913 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10919 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10920 "Headphone Playback Switch",
10921 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10926 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10927 "Headphone Playback Switch",
10928 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10937 #define alc269_auto_create_analog_input_ctls \
10938 alc880_auto_create_analog_input_ctls
10940 #ifdef CONFIG_SND_HDA_POWER_SAVE
10941 #define alc269_loopbacks alc880_loopbacks
10944 /* pcm configuration: identiacal with ALC880 */
10945 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10946 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10947 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10948 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10951 * BIOS auto configuration
10953 static int alc269_parse_auto_config(struct hda_codec *codec)
10955 struct alc_spec *spec = codec->spec;
10957 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10959 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10964 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10967 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10971 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10973 if (spec->autocfg.dig_out_pin)
10974 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10976 if (spec->kctl_alloc)
10977 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10979 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10980 spec->num_mux_defs = 1;
10981 spec->input_mux = &spec->private_imux;
10983 err = alc_auto_add_mic_boost(codec);
10990 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10991 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10992 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10995 /* init callback for auto-configuration model -- overriding the default init */
10996 static void alc269_auto_init(struct hda_codec *codec)
10998 struct alc_spec *spec = codec->spec;
10999 alc269_auto_init_multi_out(codec);
11000 alc269_auto_init_hp_out(codec);
11001 alc269_auto_init_analog_input(codec);
11002 if (spec->unsol_event)
11003 alc_sku_automute(codec);
11007 * configuration and preset
11009 static const char *alc269_models[ALC269_MODEL_LAST] = {
11010 [ALC269_BASIC] = "basic",
11013 static struct snd_pci_quirk alc269_cfg_tbl[] = {
11017 static struct alc_config_preset alc269_presets[] = {
11019 .mixers = { alc269_base_mixer },
11020 .init_verbs = { alc269_init_verbs },
11021 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11022 .dac_nids = alc269_dac_nids,
11024 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11025 .channel_mode = alc269_modes,
11026 .input_mux = &alc269_capture_source,
11030 static int patch_alc269(struct hda_codec *codec)
11032 struct alc_spec *spec;
11036 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11040 codec->spec = spec;
11042 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11046 if (board_config < 0) {
11047 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11048 "trying auto-probe from BIOS...\n");
11049 board_config = ALC269_AUTO;
11052 if (board_config == ALC269_AUTO) {
11053 /* automatic parse from the BIOS config */
11054 err = alc269_parse_auto_config(codec);
11060 "hda_codec: Cannot set up configuration "
11061 "from BIOS. Using base mode...\n");
11062 board_config = ALC269_BASIC;
11066 if (board_config != ALC269_AUTO)
11067 setup_preset(spec, &alc269_presets[board_config]);
11069 spec->stream_name_analog = "ALC269 Analog";
11070 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11071 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11073 spec->stream_name_digital = "ALC269 Digital";
11074 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11075 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11077 spec->adc_nids = alc269_adc_nids;
11078 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11079 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11080 spec->num_mixers++;
11082 codec->patch_ops = alc_patch_ops;
11083 if (board_config == ALC269_AUTO)
11084 spec->init_hook = alc269_auto_init;
11085 #ifdef CONFIG_SND_HDA_POWER_SAVE
11086 if (!spec->loopback.amplist)
11087 spec->loopback.amplist = alc269_loopbacks;
11094 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11098 * set the path ways for 2 channel output
11099 * need to set the codec line out and mic 1 pin widgets to inputs
11101 static struct hda_verb alc861_threestack_ch2_init[] = {
11102 /* set pin widget 1Ah (line in) for input */
11103 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11104 /* set pin widget 18h (mic1/2) for input, for mic also enable
11107 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11109 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11111 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11112 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11118 * need to set the codec line out and mic 1 pin widgets to outputs
11120 static struct hda_verb alc861_threestack_ch6_init[] = {
11121 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11122 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11123 /* set pin widget 18h (mic1) for output (CLFE)*/
11124 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11126 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11127 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11129 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11131 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11132 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11137 static struct hda_channel_mode alc861_threestack_modes[2] = {
11138 { 2, alc861_threestack_ch2_init },
11139 { 6, alc861_threestack_ch6_init },
11141 /* Set mic1 as input and unmute the mixer */
11142 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11143 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11144 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11147 /* Set mic1 as output and mute mixer */
11148 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11149 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11150 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11154 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11155 { 2, alc861_uniwill_m31_ch2_init },
11156 { 4, alc861_uniwill_m31_ch4_init },
11159 /* Set mic1 and line-in as input and unmute the mixer */
11160 static struct hda_verb alc861_asus_ch2_init[] = {
11161 /* set pin widget 1Ah (line in) for input */
11162 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11163 /* set pin widget 18h (mic1/2) for input, for mic also enable
11166 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11168 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11170 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11171 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11175 /* Set mic1 nad line-in as output and mute mixer */
11176 static struct hda_verb alc861_asus_ch6_init[] = {
11177 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11178 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11179 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11180 /* set pin widget 18h (mic1) for output (CLFE)*/
11181 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11182 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11183 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11184 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11186 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11188 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11189 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11194 static struct hda_channel_mode alc861_asus_modes[2] = {
11195 { 2, alc861_asus_ch2_init },
11196 { 6, alc861_asus_ch6_init },
11201 static struct snd_kcontrol_new alc861_base_mixer[] = {
11202 /* output mixer control */
11203 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11204 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11205 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11206 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11207 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11209 /*Input mixer control */
11210 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11211 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11212 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11213 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11214 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11215 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11217 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11218 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11221 /* Capture mixer control */
11222 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11223 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11225 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11226 .name = "Capture Source",
11228 .info = alc_mux_enum_info,
11229 .get = alc_mux_enum_get,
11230 .put = alc_mux_enum_put,
11235 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11236 /* output mixer control */
11237 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11238 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11239 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11240 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11241 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11243 /* Input mixer control */
11244 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11245 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11246 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11247 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11248 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11249 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11251 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11252 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11255 /* Capture mixer control */
11256 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11257 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11259 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11260 .name = "Capture Source",
11262 .info = alc_mux_enum_info,
11263 .get = alc_mux_enum_get,
11264 .put = alc_mux_enum_put,
11267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11268 .name = "Channel Mode",
11269 .info = alc_ch_mode_info,
11270 .get = alc_ch_mode_get,
11271 .put = alc_ch_mode_put,
11272 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11277 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11278 /* output mixer control */
11279 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11281 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11283 /*Capture mixer control */
11284 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11285 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11288 .name = "Capture Source",
11290 .info = alc_mux_enum_info,
11291 .get = alc_mux_enum_get,
11292 .put = alc_mux_enum_put,
11298 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11299 /* output mixer control */
11300 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11301 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11302 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11303 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11304 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11306 /* Input mixer control */
11307 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11308 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11309 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11310 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11311 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11312 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11314 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11315 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11316 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11318 /* Capture mixer control */
11319 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11320 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11322 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11323 .name = "Capture Source",
11325 .info = alc_mux_enum_info,
11326 .get = alc_mux_enum_get,
11327 .put = alc_mux_enum_put,
11330 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11331 .name = "Channel Mode",
11332 .info = alc_ch_mode_info,
11333 .get = alc_ch_mode_get,
11334 .put = alc_ch_mode_put,
11335 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11340 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11341 /* output mixer control */
11342 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11343 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11344 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11345 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11346 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11348 /* Input mixer control */
11349 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11350 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11351 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11352 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11353 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11354 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11356 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11357 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11358 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11360 /* Capture mixer control */
11361 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11362 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11364 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11365 .name = "Capture Source",
11367 .info = alc_mux_enum_info,
11368 .get = alc_mux_enum_get,
11369 .put = alc_mux_enum_put,
11372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11373 .name = "Channel Mode",
11374 .info = alc_ch_mode_info,
11375 .get = alc_ch_mode_get,
11376 .put = alc_ch_mode_put,
11377 .private_value = ARRAY_SIZE(alc861_asus_modes),
11382 /* additional mixer */
11383 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11384 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11385 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11386 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11387 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11392 * generic initialization of ADC, input mixers and output mixers
11394 static struct hda_verb alc861_base_init_verbs[] = {
11396 * Unmute ADC0 and set the default input to mic-in
11398 /* port-A for surround (rear panel) */
11399 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11400 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11401 /* port-B for mic-in (rear panel) with vref */
11402 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11403 /* port-C for line-in (rear panel) */
11404 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11405 /* port-D for Front */
11406 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11407 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11408 /* port-E for HP out (front panel) */
11409 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11410 /* route front PCM to HP */
11411 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11412 /* port-F for mic-in (front panel) with vref */
11413 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11414 /* port-G for CLFE (rear panel) */
11415 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11416 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11417 /* port-H for side (rear panel) */
11418 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11419 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11421 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11422 /* route front mic to ADC1*/
11423 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11424 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11426 /* Unmute DAC0~3 & spdif out*/
11427 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11428 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11429 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11430 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11433 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11434 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11435 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11436 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11437 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11439 /* Unmute Stereo Mixer 15 */
11440 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11441 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11442 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11443 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11445 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11446 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11447 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11448 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11449 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11451 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11452 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11453 /* hp used DAC 3 (Front) */
11454 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11455 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11460 static struct hda_verb alc861_threestack_init_verbs[] = {
11462 * Unmute ADC0 and set the default input to mic-in
11464 /* port-A for surround (rear panel) */
11465 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11466 /* port-B for mic-in (rear panel) with vref */
11467 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11468 /* port-C for line-in (rear panel) */
11469 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11470 /* port-D for Front */
11471 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11472 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11473 /* port-E for HP out (front panel) */
11474 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11475 /* route front PCM to HP */
11476 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11477 /* port-F for mic-in (front panel) with vref */
11478 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11479 /* port-G for CLFE (rear panel) */
11480 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11481 /* port-H for side (rear panel) */
11482 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11484 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11485 /* route front mic to ADC1*/
11486 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11487 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11488 /* Unmute DAC0~3 & spdif out*/
11489 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11490 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11491 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11492 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11495 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11496 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11497 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11498 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11499 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11501 /* Unmute Stereo Mixer 15 */
11502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11507 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11508 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11509 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11510 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11511 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11513 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11514 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11515 /* hp used DAC 3 (Front) */
11516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11517 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11521 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11523 * Unmute ADC0 and set the default input to mic-in
11525 /* port-A for surround (rear panel) */
11526 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11527 /* port-B for mic-in (rear panel) with vref */
11528 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11529 /* port-C for line-in (rear panel) */
11530 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11531 /* port-D for Front */
11532 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11533 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11534 /* port-E for HP out (front panel) */
11535 /* this has to be set to VREF80 */
11536 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11537 /* route front PCM to HP */
11538 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11539 /* port-F for mic-in (front panel) with vref */
11540 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11541 /* port-G for CLFE (rear panel) */
11542 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11543 /* port-H for side (rear panel) */
11544 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11546 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11547 /* route front mic to ADC1*/
11548 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11550 /* Unmute DAC0~3 & spdif out*/
11551 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11552 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11553 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11554 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11557 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11558 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11559 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11560 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11561 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11563 /* Unmute Stereo Mixer 15 */
11564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11565 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11566 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11569 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11570 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11571 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11572 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11573 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11574 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11575 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11576 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11577 /* hp used DAC 3 (Front) */
11578 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11583 static struct hda_verb alc861_asus_init_verbs[] = {
11585 * Unmute ADC0 and set the default input to mic-in
11587 /* port-A for surround (rear panel)
11588 * according to codec#0 this is the HP jack
11590 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11591 /* route front PCM to HP */
11592 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11593 /* port-B for mic-in (rear panel) with vref */
11594 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11595 /* port-C for line-in (rear panel) */
11596 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11597 /* port-D for Front */
11598 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11599 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11600 /* port-E for HP out (front panel) */
11601 /* this has to be set to VREF80 */
11602 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11603 /* route front PCM to HP */
11604 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11605 /* port-F for mic-in (front panel) with vref */
11606 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11607 /* port-G for CLFE (rear panel) */
11608 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11609 /* port-H for side (rear panel) */
11610 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11612 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11613 /* route front mic to ADC1*/
11614 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11616 /* Unmute DAC0~3 & spdif out*/
11617 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11619 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11620 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11622 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11623 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11624 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11625 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11626 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11628 /* Unmute Stereo Mixer 15 */
11629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11631 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11634 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11635 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11636 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11637 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11638 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11639 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11641 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11642 /* hp used DAC 3 (Front) */
11643 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11644 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11648 /* additional init verbs for ASUS laptops */
11649 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11650 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11651 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11656 * generic initialization of ADC, input mixers and output mixers
11658 static struct hda_verb alc861_auto_init_verbs[] = {
11660 * Unmute ADC0 and set the default input to mic-in
11662 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11663 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11665 /* Unmute DAC0~3 & spdif out*/
11666 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11667 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11668 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11669 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11670 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11672 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11673 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11674 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11675 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11676 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11678 /* Unmute Stereo Mixer 15 */
11679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11682 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11684 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11685 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11686 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11687 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11688 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11689 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11690 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11691 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11693 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11694 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11697 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11698 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11700 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11702 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11707 static struct hda_verb alc861_toshiba_init_verbs[] = {
11708 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11713 /* toggle speaker-output according to the hp-jack state */
11714 static void alc861_toshiba_automute(struct hda_codec *codec)
11716 unsigned int present;
11718 present = snd_hda_codec_read(codec, 0x0f, 0,
11719 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11720 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11721 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11722 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11723 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11726 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11729 if ((res >> 26) == ALC880_HP_EVENT)
11730 alc861_toshiba_automute(codec);
11733 /* pcm configuration: identiacal with ALC880 */
11734 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11735 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11736 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11737 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11740 #define ALC861_DIGOUT_NID 0x07
11742 static struct hda_channel_mode alc861_8ch_modes[1] = {
11746 static hda_nid_t alc861_dac_nids[4] = {
11747 /* front, surround, clfe, side */
11748 0x03, 0x06, 0x05, 0x04
11751 static hda_nid_t alc660_dac_nids[3] = {
11752 /* front, clfe, surround */
11756 static hda_nid_t alc861_adc_nids[1] = {
11761 static struct hda_input_mux alc861_capture_source = {
11765 { "Front Mic", 0x3 },
11772 /* fill in the dac_nids table from the parsed pin configuration */
11773 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11774 const struct auto_pin_cfg *cfg)
11779 spec->multiout.dac_nids = spec->private_dac_nids;
11780 for (i = 0; i < cfg->line_outs; i++) {
11781 nid = cfg->line_out_pins[i];
11783 if (i >= ARRAY_SIZE(alc861_dac_nids))
11785 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11788 spec->multiout.num_dacs = cfg->line_outs;
11792 /* add playback controls from the parsed DAC table */
11793 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11794 const struct auto_pin_cfg *cfg)
11797 static const char *chname[4] = {
11798 "Front", "Surround", NULL /*CLFE*/, "Side"
11803 for (i = 0; i < cfg->line_outs; i++) {
11804 nid = spec->multiout.dac_nids[i];
11809 err = add_control(spec, ALC_CTL_BIND_MUTE,
11810 "Center Playback Switch",
11811 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11815 err = add_control(spec, ALC_CTL_BIND_MUTE,
11816 "LFE Playback Switch",
11817 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11822 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11824 if (nid == alc861_dac_nids[idx])
11826 sprintf(name, "%s Playback Switch", chname[idx]);
11827 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11828 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11837 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11845 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11847 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11848 "Headphone Playback Switch",
11849 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11852 spec->multiout.hp_nid = nid;
11857 /* create playback/capture controls for input pins */
11858 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11859 const struct auto_pin_cfg *cfg)
11861 struct hda_input_mux *imux = &spec->private_imux;
11862 int i, err, idx, idx1;
11864 for (i = 0; i < AUTO_PIN_LAST; i++) {
11865 switch (cfg->input_pins[i]) {
11868 idx = 2; /* Line In */
11872 idx = 2; /* Line In */
11876 idx = 1; /* Mic In */
11880 idx = 1; /* Mic In */
11890 err = new_analog_input(spec, cfg->input_pins[i],
11891 auto_pin_cfg_labels[i], idx, 0x15);
11895 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11896 imux->items[imux->num_items].index = idx1;
11902 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11903 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11904 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11907 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11908 /* The multiple "Capture Source" controls confuse alsamixer
11909 * So call somewhat different..
11911 /* .name = "Capture Source", */
11912 .name = "Input Source",
11914 .info = alc_mux_enum_info,
11915 .get = alc_mux_enum_get,
11916 .put = alc_mux_enum_put,
11921 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11923 int pin_type, int dac_idx)
11925 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11927 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11931 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11933 struct alc_spec *spec = codec->spec;
11936 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11937 for (i = 0; i < spec->autocfg.line_outs; i++) {
11938 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11939 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11941 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11942 spec->multiout.dac_nids[i]);
11946 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11948 struct alc_spec *spec = codec->spec;
11951 pin = spec->autocfg.hp_pins[0];
11952 if (pin) /* connect to front */
11953 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11954 spec->multiout.dac_nids[0]);
11955 pin = spec->autocfg.speaker_pins[0];
11957 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11960 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11962 struct alc_spec *spec = codec->spec;
11965 for (i = 0; i < AUTO_PIN_LAST; i++) {
11966 hda_nid_t nid = spec->autocfg.input_pins[i];
11967 if (nid >= 0x0c && nid <= 0x11) {
11968 snd_hda_codec_write(codec, nid, 0,
11969 AC_VERB_SET_PIN_WIDGET_CONTROL,
11970 i <= AUTO_PIN_FRONT_MIC ?
11971 PIN_VREF80 : PIN_IN);
11976 /* parse the BIOS configuration and set up the alc_spec */
11977 /* return 1 if successful, 0 if the proper config is not found,
11978 * or a negative error code
11980 static int alc861_parse_auto_config(struct hda_codec *codec)
11982 struct alc_spec *spec = codec->spec;
11984 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11986 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11990 if (!spec->autocfg.line_outs)
11991 return 0; /* can't find valid BIOS pin config */
11993 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11996 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11999 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
12002 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
12006 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12008 if (spec->autocfg.dig_out_pin)
12009 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
12011 if (spec->kctl_alloc)
12012 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12014 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
12016 spec->num_mux_defs = 1;
12017 spec->input_mux = &spec->private_imux;
12019 spec->adc_nids = alc861_adc_nids;
12020 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12021 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12022 spec->num_mixers++;
12027 /* additional initialization for auto-configuration model */
12028 static void alc861_auto_init(struct hda_codec *codec)
12030 struct alc_spec *spec = codec->spec;
12031 alc861_auto_init_multi_out(codec);
12032 alc861_auto_init_hp_out(codec);
12033 alc861_auto_init_analog_input(codec);
12034 if (spec->unsol_event)
12035 alc_sku_automute(codec);
12038 #ifdef CONFIG_SND_HDA_POWER_SAVE
12039 static struct hda_amp_list alc861_loopbacks[] = {
12040 { 0x15, HDA_INPUT, 0 },
12041 { 0x15, HDA_INPUT, 1 },
12042 { 0x15, HDA_INPUT, 2 },
12043 { 0x15, HDA_INPUT, 3 },
12050 * configuration and preset
12052 static const char *alc861_models[ALC861_MODEL_LAST] = {
12053 [ALC861_3ST] = "3stack",
12054 [ALC660_3ST] = "3stack-660",
12055 [ALC861_3ST_DIG] = "3stack-dig",
12056 [ALC861_6ST_DIG] = "6stack-dig",
12057 [ALC861_UNIWILL_M31] = "uniwill-m31",
12058 [ALC861_TOSHIBA] = "toshiba",
12059 [ALC861_ASUS] = "asus",
12060 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12061 [ALC861_AUTO] = "auto",
12064 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12065 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12066 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12067 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12068 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12069 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12070 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12071 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12072 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12073 * Any other models that need this preset?
12075 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12076 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12077 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12078 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12079 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12080 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12081 /* FIXME: the below seems conflict */
12082 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12083 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12084 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12088 static struct alc_config_preset alc861_presets[] = {
12090 .mixers = { alc861_3ST_mixer },
12091 .init_verbs = { alc861_threestack_init_verbs },
12092 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12093 .dac_nids = alc861_dac_nids,
12094 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12095 .channel_mode = alc861_threestack_modes,
12097 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12098 .adc_nids = alc861_adc_nids,
12099 .input_mux = &alc861_capture_source,
12101 [ALC861_3ST_DIG] = {
12102 .mixers = { alc861_base_mixer },
12103 .init_verbs = { alc861_threestack_init_verbs },
12104 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12105 .dac_nids = alc861_dac_nids,
12106 .dig_out_nid = ALC861_DIGOUT_NID,
12107 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12108 .channel_mode = alc861_threestack_modes,
12110 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12111 .adc_nids = alc861_adc_nids,
12112 .input_mux = &alc861_capture_source,
12114 [ALC861_6ST_DIG] = {
12115 .mixers = { alc861_base_mixer },
12116 .init_verbs = { alc861_base_init_verbs },
12117 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12118 .dac_nids = alc861_dac_nids,
12119 .dig_out_nid = ALC861_DIGOUT_NID,
12120 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12121 .channel_mode = alc861_8ch_modes,
12122 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12123 .adc_nids = alc861_adc_nids,
12124 .input_mux = &alc861_capture_source,
12127 .mixers = { alc861_3ST_mixer },
12128 .init_verbs = { alc861_threestack_init_verbs },
12129 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12130 .dac_nids = alc660_dac_nids,
12131 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12132 .channel_mode = alc861_threestack_modes,
12134 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12135 .adc_nids = alc861_adc_nids,
12136 .input_mux = &alc861_capture_source,
12138 [ALC861_UNIWILL_M31] = {
12139 .mixers = { alc861_uniwill_m31_mixer },
12140 .init_verbs = { alc861_uniwill_m31_init_verbs },
12141 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12142 .dac_nids = alc861_dac_nids,
12143 .dig_out_nid = ALC861_DIGOUT_NID,
12144 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12145 .channel_mode = alc861_uniwill_m31_modes,
12147 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12148 .adc_nids = alc861_adc_nids,
12149 .input_mux = &alc861_capture_source,
12151 [ALC861_TOSHIBA] = {
12152 .mixers = { alc861_toshiba_mixer },
12153 .init_verbs = { alc861_base_init_verbs,
12154 alc861_toshiba_init_verbs },
12155 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12156 .dac_nids = alc861_dac_nids,
12157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12158 .channel_mode = alc883_3ST_2ch_modes,
12159 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12160 .adc_nids = alc861_adc_nids,
12161 .input_mux = &alc861_capture_source,
12162 .unsol_event = alc861_toshiba_unsol_event,
12163 .init_hook = alc861_toshiba_automute,
12166 .mixers = { alc861_asus_mixer },
12167 .init_verbs = { alc861_asus_init_verbs },
12168 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12169 .dac_nids = alc861_dac_nids,
12170 .dig_out_nid = ALC861_DIGOUT_NID,
12171 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12172 .channel_mode = alc861_asus_modes,
12175 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12176 .adc_nids = alc861_adc_nids,
12177 .input_mux = &alc861_capture_source,
12179 [ALC861_ASUS_LAPTOP] = {
12180 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12181 .init_verbs = { alc861_asus_init_verbs,
12182 alc861_asus_laptop_init_verbs },
12183 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12184 .dac_nids = alc861_dac_nids,
12185 .dig_out_nid = ALC861_DIGOUT_NID,
12186 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12187 .channel_mode = alc883_3ST_2ch_modes,
12189 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12190 .adc_nids = alc861_adc_nids,
12191 .input_mux = &alc861_capture_source,
12196 static int patch_alc861(struct hda_codec *codec)
12198 struct alc_spec *spec;
12202 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12206 codec->spec = spec;
12208 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12212 if (board_config < 0) {
12213 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12214 "trying auto-probe from BIOS...\n");
12215 board_config = ALC861_AUTO;
12218 if (board_config == ALC861_AUTO) {
12219 /* automatic parse from the BIOS config */
12220 err = alc861_parse_auto_config(codec);
12226 "hda_codec: Cannot set up configuration "
12227 "from BIOS. Using base mode...\n");
12228 board_config = ALC861_3ST_DIG;
12232 if (board_config != ALC861_AUTO)
12233 setup_preset(spec, &alc861_presets[board_config]);
12235 spec->stream_name_analog = "ALC861 Analog";
12236 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12237 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12239 spec->stream_name_digital = "ALC861 Digital";
12240 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12241 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12243 spec->vmaster_nid = 0x03;
12245 codec->patch_ops = alc_patch_ops;
12246 if (board_config == ALC861_AUTO)
12247 spec->init_hook = alc861_auto_init;
12248 #ifdef CONFIG_SND_HDA_POWER_SAVE
12249 if (!spec->loopback.amplist)
12250 spec->loopback.amplist = alc861_loopbacks;
12257 * ALC861-VD support
12261 * In addition, an independent DAC
12263 #define ALC861VD_DIGOUT_NID 0x06
12265 static hda_nid_t alc861vd_dac_nids[4] = {
12266 /* front, surr, clfe, side surr */
12267 0x02, 0x03, 0x04, 0x05
12270 /* dac_nids for ALC660vd are in a different order - according to
12271 * Realtek's driver.
12272 * This should probably tesult in a different mixer for 6stack models
12273 * of ALC660vd codecs, but for now there is only 3stack mixer
12274 * - and it is the same as in 861vd.
12275 * adc_nids in ALC660vd are (is) the same as in 861vd
12277 static hda_nid_t alc660vd_dac_nids[3] = {
12278 /* front, rear, clfe, rear_surr */
12282 static hda_nid_t alc861vd_adc_nids[1] = {
12287 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12290 /* FIXME: should be a matrix-type input source selection */
12291 static struct hda_input_mux alc861vd_capture_source = {
12295 { "Front Mic", 0x1 },
12301 static struct hda_input_mux alc861vd_dallas_capture_source = {
12304 { "Ext Mic", 0x0 },
12305 { "Int Mic", 0x1 },
12309 static struct hda_input_mux alc861vd_hp_capture_source = {
12312 { "Front Mic", 0x0 },
12313 { "ATAPI Mic", 0x1 },
12317 #define alc861vd_mux_enum_info alc_mux_enum_info
12318 #define alc861vd_mux_enum_get alc_mux_enum_get
12319 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12320 #define alc861vd_mux_enum_put alc882_mux_enum_put
12325 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12332 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12333 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12334 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12335 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12336 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12343 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12344 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12345 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12346 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12347 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12351 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12352 { 6, alc861vd_6stack_ch6_init },
12353 { 8, alc861vd_6stack_ch8_init },
12356 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12358 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12359 .name = "Channel Mode",
12360 .info = alc_ch_mode_info,
12361 .get = alc_ch_mode_get,
12362 .put = alc_ch_mode_put,
12367 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12368 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12369 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12373 /* The multiple "Capture Source" controls confuse alsamixer
12374 * So call somewhat different..
12376 /* .name = "Capture Source", */
12377 .name = "Input Source",
12379 .info = alc861vd_mux_enum_info,
12380 .get = alc861vd_mux_enum_get,
12381 .put = alc861vd_mux_enum_put,
12386 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12387 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12389 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12390 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12391 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12393 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12394 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12396 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12398 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12400 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12401 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12403 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12404 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12406 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12408 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12409 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12410 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12412 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12413 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12414 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12416 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12417 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12419 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12420 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12422 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12423 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12428 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12429 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12430 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12434 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12438 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12439 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12440 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12442 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12443 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12445 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12446 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12448 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12449 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12454 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12455 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12456 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12457 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12461 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12465 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12469 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12470 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12475 /* Pin assignment: Speaker=0x14, HP = 0x15,
12476 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12478 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12479 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12480 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12481 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12482 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12483 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12484 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12485 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12486 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12487 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12488 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12489 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12490 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12494 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12495 * Front Mic=0x18, ATAPI Mic = 0x19,
12497 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12498 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12499 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12500 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12501 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12502 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12503 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12504 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12505 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12511 * generic initialization of ADC, input mixers and output mixers
12513 static struct hda_verb alc861vd_volume_init_verbs[] = {
12515 * Unmute ADC0 and set the default input to mic-in
12517 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12518 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12520 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12521 * the analog-loopback mixer widget
12523 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12530 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12537 * Set up output mixers (0x02 - 0x05)
12539 /* set vol=0 to output mixers */
12540 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12541 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12542 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12543 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12545 /* set up input amps for analog loopback */
12546 /* Amp Indices: DAC = 0, mixer = 1 */
12547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12551 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12552 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12553 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12554 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12560 * 3-stack pin configuration:
12561 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12563 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12565 * Set pin mode and muting
12567 /* set front pin widgets 0x14 for output */
12568 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12569 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12570 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12572 /* Mic (rear) pin: input vref at 80% */
12573 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12574 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12575 /* Front Mic pin: input vref at 80% */
12576 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12577 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12578 /* Line In pin: input */
12579 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12580 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12581 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12582 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12583 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12584 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12585 /* CD pin widget for input */
12586 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12592 * 6-stack pin configuration:
12594 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12596 * Set pin mode and muting
12598 /* set front pin widgets 0x14 for output */
12599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12601 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12603 /* Rear Pin: output 1 (0x0d) */
12604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12607 /* CLFE Pin: output 2 (0x0e) */
12608 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12609 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12610 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12611 /* Side Pin: output 3 (0x0f) */
12612 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12613 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12614 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12616 /* Mic (rear) pin: input vref at 80% */
12617 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12618 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12619 /* Front Mic pin: input vref at 80% */
12620 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12621 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12622 /* Line In pin: input */
12623 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12624 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12625 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12626 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12627 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12628 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12629 /* CD pin widget for input */
12630 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12635 static struct hda_verb alc861vd_eapd_verbs[] = {
12636 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12640 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12644 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12645 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12649 /* toggle speaker-output according to the hp-jack state */
12650 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12652 unsigned int present;
12653 unsigned char bits;
12655 present = snd_hda_codec_read(codec, 0x1b, 0,
12656 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12657 bits = present ? HDA_AMP_MUTE : 0;
12658 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12659 HDA_AMP_MUTE, bits);
12662 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12664 unsigned int present;
12665 unsigned char bits;
12667 present = snd_hda_codec_read(codec, 0x18, 0,
12668 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12669 bits = present ? HDA_AMP_MUTE : 0;
12670 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12671 HDA_AMP_MUTE, bits);
12674 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12676 alc861vd_lenovo_hp_automute(codec);
12677 alc861vd_lenovo_mic_automute(codec);
12680 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12683 switch (res >> 26) {
12684 case ALC880_HP_EVENT:
12685 alc861vd_lenovo_hp_automute(codec);
12687 case ALC880_MIC_EVENT:
12688 alc861vd_lenovo_mic_automute(codec);
12693 static struct hda_verb alc861vd_dallas_verbs[] = {
12694 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12695 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12696 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12697 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12702 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12704 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12705 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12706 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12709 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12712 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12713 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12714 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12715 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12717 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12718 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12719 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12720 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12721 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12722 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12723 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12724 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12726 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12727 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12731 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12732 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12733 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12738 /* toggle speaker-output according to the hp-jack state */
12739 static void alc861vd_dallas_automute(struct hda_codec *codec)
12741 unsigned int present;
12743 present = snd_hda_codec_read(codec, 0x15, 0,
12744 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12745 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12746 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12749 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12751 if ((res >> 26) == ALC880_HP_EVENT)
12752 alc861vd_dallas_automute(codec);
12755 #ifdef CONFIG_SND_HDA_POWER_SAVE
12756 #define alc861vd_loopbacks alc880_loopbacks
12759 /* pcm configuration: identiacal with ALC880 */
12760 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12761 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12762 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12763 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12766 * configuration and preset
12768 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12769 [ALC660VD_3ST] = "3stack-660",
12770 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12771 [ALC861VD_3ST] = "3stack",
12772 [ALC861VD_3ST_DIG] = "3stack-digout",
12773 [ALC861VD_6ST_DIG] = "6stack-digout",
12774 [ALC861VD_LENOVO] = "lenovo",
12775 [ALC861VD_DALLAS] = "dallas",
12776 [ALC861VD_HP] = "hp",
12777 [ALC861VD_AUTO] = "auto",
12780 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12781 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12782 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12783 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12784 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12785 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12786 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12787 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12788 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12789 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12790 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12791 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
12792 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12793 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12794 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12795 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12799 static struct alc_config_preset alc861vd_presets[] = {
12801 .mixers = { alc861vd_3st_mixer },
12802 .init_verbs = { alc861vd_volume_init_verbs,
12803 alc861vd_3stack_init_verbs },
12804 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12805 .dac_nids = alc660vd_dac_nids,
12806 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12807 .channel_mode = alc861vd_3stack_2ch_modes,
12808 .input_mux = &alc861vd_capture_source,
12810 [ALC660VD_3ST_DIG] = {
12811 .mixers = { alc861vd_3st_mixer },
12812 .init_verbs = { alc861vd_volume_init_verbs,
12813 alc861vd_3stack_init_verbs },
12814 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12815 .dac_nids = alc660vd_dac_nids,
12816 .dig_out_nid = ALC861VD_DIGOUT_NID,
12817 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12818 .channel_mode = alc861vd_3stack_2ch_modes,
12819 .input_mux = &alc861vd_capture_source,
12822 .mixers = { alc861vd_3st_mixer },
12823 .init_verbs = { alc861vd_volume_init_verbs,
12824 alc861vd_3stack_init_verbs },
12825 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12826 .dac_nids = alc861vd_dac_nids,
12827 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12828 .channel_mode = alc861vd_3stack_2ch_modes,
12829 .input_mux = &alc861vd_capture_source,
12831 [ALC861VD_3ST_DIG] = {
12832 .mixers = { alc861vd_3st_mixer },
12833 .init_verbs = { alc861vd_volume_init_verbs,
12834 alc861vd_3stack_init_verbs },
12835 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12836 .dac_nids = alc861vd_dac_nids,
12837 .dig_out_nid = ALC861VD_DIGOUT_NID,
12838 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12839 .channel_mode = alc861vd_3stack_2ch_modes,
12840 .input_mux = &alc861vd_capture_source,
12842 [ALC861VD_6ST_DIG] = {
12843 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12844 .init_verbs = { alc861vd_volume_init_verbs,
12845 alc861vd_6stack_init_verbs },
12846 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12847 .dac_nids = alc861vd_dac_nids,
12848 .dig_out_nid = ALC861VD_DIGOUT_NID,
12849 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12850 .channel_mode = alc861vd_6stack_modes,
12851 .input_mux = &alc861vd_capture_source,
12853 [ALC861VD_LENOVO] = {
12854 .mixers = { alc861vd_lenovo_mixer },
12855 .init_verbs = { alc861vd_volume_init_verbs,
12856 alc861vd_3stack_init_verbs,
12857 alc861vd_eapd_verbs,
12858 alc861vd_lenovo_unsol_verbs },
12859 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12860 .dac_nids = alc660vd_dac_nids,
12861 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12862 .channel_mode = alc861vd_3stack_2ch_modes,
12863 .input_mux = &alc861vd_capture_source,
12864 .unsol_event = alc861vd_lenovo_unsol_event,
12865 .init_hook = alc861vd_lenovo_automute,
12867 [ALC861VD_DALLAS] = {
12868 .mixers = { alc861vd_dallas_mixer },
12869 .init_verbs = { alc861vd_dallas_verbs },
12870 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12871 .dac_nids = alc861vd_dac_nids,
12872 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12873 .channel_mode = alc861vd_3stack_2ch_modes,
12874 .input_mux = &alc861vd_dallas_capture_source,
12875 .unsol_event = alc861vd_dallas_unsol_event,
12876 .init_hook = alc861vd_dallas_automute,
12879 .mixers = { alc861vd_hp_mixer },
12880 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12881 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12882 .dac_nids = alc861vd_dac_nids,
12883 .dig_out_nid = ALC861VD_DIGOUT_NID,
12884 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12885 .channel_mode = alc861vd_3stack_2ch_modes,
12886 .input_mux = &alc861vd_hp_capture_source,
12887 .unsol_event = alc861vd_dallas_unsol_event,
12888 .init_hook = alc861vd_dallas_automute,
12893 * BIOS auto configuration
12895 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12896 hda_nid_t nid, int pin_type, int dac_idx)
12898 alc_set_pin_output(codec, nid, pin_type);
12901 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12903 struct alc_spec *spec = codec->spec;
12906 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12907 for (i = 0; i <= HDA_SIDE; i++) {
12908 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12909 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12911 alc861vd_auto_set_output_and_unmute(codec, nid,
12917 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12919 struct alc_spec *spec = codec->spec;
12922 pin = spec->autocfg.hp_pins[0];
12923 if (pin) /* connect to front and use dac 0 */
12924 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12925 pin = spec->autocfg.speaker_pins[0];
12927 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12930 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12931 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12933 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12935 struct alc_spec *spec = codec->spec;
12938 for (i = 0; i < AUTO_PIN_LAST; i++) {
12939 hda_nid_t nid = spec->autocfg.input_pins[i];
12940 if (alc861vd_is_input_pin(nid)) {
12941 snd_hda_codec_write(codec, nid, 0,
12942 AC_VERB_SET_PIN_WIDGET_CONTROL,
12943 i <= AUTO_PIN_FRONT_MIC ?
12944 PIN_VREF80 : PIN_IN);
12945 if (nid != ALC861VD_PIN_CD_NID)
12946 snd_hda_codec_write(codec, nid, 0,
12947 AC_VERB_SET_AMP_GAIN_MUTE,
12953 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12954 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12956 /* add playback controls from the parsed DAC table */
12957 /* Based on ALC880 version. But ALC861VD has separate,
12958 * different NIDs for mute/unmute switch and volume control */
12959 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12960 const struct auto_pin_cfg *cfg)
12963 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12964 hda_nid_t nid_v, nid_s;
12967 for (i = 0; i < cfg->line_outs; i++) {
12968 if (!spec->multiout.dac_nids[i])
12970 nid_v = alc861vd_idx_to_mixer_vol(
12972 spec->multiout.dac_nids[i]));
12973 nid_s = alc861vd_idx_to_mixer_switch(
12975 spec->multiout.dac_nids[i]));
12979 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12980 "Center Playback Volume",
12981 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12985 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12986 "LFE Playback Volume",
12987 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12991 err = add_control(spec, ALC_CTL_BIND_MUTE,
12992 "Center Playback Switch",
12993 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12997 err = add_control(spec, ALC_CTL_BIND_MUTE,
12998 "LFE Playback Switch",
12999 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
13004 sprintf(name, "%s Playback Volume", chname[i]);
13005 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13006 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
13010 sprintf(name, "%s Playback Switch", chname[i]);
13011 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13012 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13021 /* add playback controls for speaker and HP outputs */
13022 /* Based on ALC880 version. But ALC861VD has separate,
13023 * different NIDs for mute/unmute switch and volume control */
13024 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13025 hda_nid_t pin, const char *pfx)
13027 hda_nid_t nid_v, nid_s;
13034 if (alc880_is_fixed_pin(pin)) {
13035 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13036 /* specify the DAC as the extra output */
13037 if (!spec->multiout.hp_nid)
13038 spec->multiout.hp_nid = nid_v;
13040 spec->multiout.extra_out_nid[0] = nid_v;
13041 /* control HP volume/switch on the output mixer amp */
13042 nid_v = alc861vd_idx_to_mixer_vol(
13043 alc880_fixed_pin_idx(pin));
13044 nid_s = alc861vd_idx_to_mixer_switch(
13045 alc880_fixed_pin_idx(pin));
13047 sprintf(name, "%s Playback Volume", pfx);
13048 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13049 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13052 sprintf(name, "%s Playback Switch", pfx);
13053 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13054 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13057 } else if (alc880_is_multi_pin(pin)) {
13058 /* set manual connection */
13059 /* we have only a switch on HP-out PIN */
13060 sprintf(name, "%s Playback Switch", pfx);
13061 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13062 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13069 /* parse the BIOS configuration and set up the alc_spec
13070 * return 1 if successful, 0 if the proper config is not found,
13071 * or a negative error code
13072 * Based on ALC880 version - had to change it to override
13073 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13074 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13076 struct alc_spec *spec = codec->spec;
13078 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13080 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13084 if (!spec->autocfg.line_outs)
13085 return 0; /* can't find valid BIOS pin config */
13087 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13090 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13093 err = alc861vd_auto_create_extra_out(spec,
13094 spec->autocfg.speaker_pins[0],
13098 err = alc861vd_auto_create_extra_out(spec,
13099 spec->autocfg.hp_pins[0],
13103 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13107 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13109 if (spec->autocfg.dig_out_pin)
13110 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13112 if (spec->kctl_alloc)
13113 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13115 spec->init_verbs[spec->num_init_verbs++]
13116 = alc861vd_volume_init_verbs;
13118 spec->num_mux_defs = 1;
13119 spec->input_mux = &spec->private_imux;
13121 err = alc_auto_add_mic_boost(codec);
13128 /* additional initialization for auto-configuration model */
13129 static void alc861vd_auto_init(struct hda_codec *codec)
13131 struct alc_spec *spec = codec->spec;
13132 alc861vd_auto_init_multi_out(codec);
13133 alc861vd_auto_init_hp_out(codec);
13134 alc861vd_auto_init_analog_input(codec);
13135 if (spec->unsol_event)
13136 alc_sku_automute(codec);
13139 static int patch_alc861vd(struct hda_codec *codec)
13141 struct alc_spec *spec;
13142 int err, board_config;
13144 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13148 codec->spec = spec;
13150 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13154 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13155 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13156 "ALC861VD, trying auto-probe from BIOS...\n");
13157 board_config = ALC861VD_AUTO;
13160 if (board_config == ALC861VD_AUTO) {
13161 /* automatic parse from the BIOS config */
13162 err = alc861vd_parse_auto_config(codec);
13168 "hda_codec: Cannot set up configuration "
13169 "from BIOS. Using base mode...\n");
13170 board_config = ALC861VD_3ST;
13174 if (board_config != ALC861VD_AUTO)
13175 setup_preset(spec, &alc861vd_presets[board_config]);
13177 spec->stream_name_analog = "ALC861VD Analog";
13178 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13179 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13181 spec->stream_name_digital = "ALC861VD Digital";
13182 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13183 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13185 spec->adc_nids = alc861vd_adc_nids;
13186 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13187 spec->capsrc_nids = alc861vd_capsrc_nids;
13189 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13190 spec->num_mixers++;
13192 spec->vmaster_nid = 0x02;
13194 codec->patch_ops = alc_patch_ops;
13196 if (board_config == ALC861VD_AUTO)
13197 spec->init_hook = alc861vd_auto_init;
13198 #ifdef CONFIG_SND_HDA_POWER_SAVE
13199 if (!spec->loopback.amplist)
13200 spec->loopback.amplist = alc861vd_loopbacks;
13209 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13210 * configuration. Each pin widget can choose any input DACs and a mixer.
13211 * Each ADC is connected from a mixer of all inputs. This makes possible
13212 * 6-channel independent captures.
13214 * In addition, an independent DAC for the multi-playback (not used in this
13217 #define ALC662_DIGOUT_NID 0x06
13218 #define ALC662_DIGIN_NID 0x0a
13220 static hda_nid_t alc662_dac_nids[4] = {
13221 /* front, rear, clfe, rear_surr */
13225 static hda_nid_t alc662_adc_nids[1] = {
13230 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13233 /* FIXME: should be a matrix-type input source selection */
13234 static struct hda_input_mux alc662_capture_source = {
13238 { "Front Mic", 0x1 },
13244 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13252 static struct hda_input_mux alc662_eeepc_capture_source = {
13260 static struct hda_input_mux alc663_capture_source = {
13264 { "Front Mic", 0x1 },
13269 static struct hda_input_mux alc663_m51va_capture_source = {
13272 { "Ext-Mic", 0x0 },
13277 #define alc662_mux_enum_info alc_mux_enum_info
13278 #define alc662_mux_enum_get alc_mux_enum_get
13279 #define alc662_mux_enum_put alc882_mux_enum_put
13284 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13291 static struct hda_verb alc662_3ST_ch2_init[] = {
13292 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13293 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13294 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13295 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13302 static struct hda_verb alc662_3ST_ch6_init[] = {
13303 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13304 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13305 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13306 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13307 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13308 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13312 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13313 { 2, alc662_3ST_ch2_init },
13314 { 6, alc662_3ST_ch6_init },
13320 static struct hda_verb alc662_sixstack_ch6_init[] = {
13321 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13322 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13323 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13330 static struct hda_verb alc662_sixstack_ch8_init[] = {
13331 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13332 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13333 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13337 static struct hda_channel_mode alc662_5stack_modes[2] = {
13338 { 2, alc662_sixstack_ch6_init },
13339 { 6, alc662_sixstack_ch8_init },
13342 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13343 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13346 static struct snd_kcontrol_new alc662_base_mixer[] = {
13347 /* output mixer control */
13348 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13349 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13350 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13351 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13352 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13353 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13354 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13355 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13358 /*Input mixer control */
13359 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13360 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13361 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13362 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13363 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13364 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13365 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13366 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13370 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13371 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13372 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13374 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13375 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13376 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13377 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13380 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13381 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13382 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13383 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13387 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13388 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13389 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13390 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13391 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13392 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13393 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13394 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13395 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13396 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13397 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13398 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13399 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13400 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13403 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13404 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13405 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13406 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13410 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13411 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13412 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13413 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13414 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13415 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13416 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13417 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13423 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13424 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13426 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13427 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13429 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13430 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13431 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13433 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13434 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13435 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13439 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13440 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13441 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13442 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13443 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13444 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13445 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13446 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13447 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13448 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13449 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13450 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13451 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13452 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13453 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13457 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
13458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13459 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13460 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13463 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT),
13467 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
13468 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13469 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13470 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13471 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13472 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13476 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13477 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13481 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
13482 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13483 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13484 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13487 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13488 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13489 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13490 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13491 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13495 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13497 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13498 .name = "Channel Mode",
13499 .info = alc_ch_mode_info,
13500 .get = alc_ch_mode_get,
13501 .put = alc_ch_mode_put,
13506 static struct hda_verb alc662_init_verbs[] = {
13507 /* ADC: mute amp left and right */
13508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13509 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13510 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13525 /* Front Pin: output 0 (0x0c) */
13526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13529 /* Rear Pin: output 1 (0x0d) */
13530 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13531 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13533 /* CLFE Pin: output 2 (0x0e) */
13534 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13535 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13537 /* Mic (rear) pin: input vref at 80% */
13538 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13539 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13540 /* Front Mic pin: input vref at 80% */
13541 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13542 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13543 /* Line In pin: input */
13544 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13545 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13546 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13547 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13548 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13549 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13550 /* CD pin widget for input */
13551 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13553 /* FIXME: use matrix-type input source selection */
13554 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13559 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13566 /* always trun on EAPD */
13567 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13568 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13573 static struct hda_verb alc662_sue_init_verbs[] = {
13574 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13575 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13579 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13580 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13581 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13585 /* Set Unsolicited Event*/
13586 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13588 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13593 * generic initialization of ADC, input mixers and output mixers
13595 static struct hda_verb alc662_auto_init_verbs[] = {
13597 * Unmute ADC and set the default input to mic-in
13599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13602 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13604 * Note: PASD motherboards uses the Line In 2 as the input for front
13605 * panel mic (mic 2)
13607 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13615 * Set up output mixers (0x0c - 0x0f)
13617 /* set vol=0 to output mixers */
13618 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13619 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13620 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13622 /* set up input amps for analog loopback */
13623 /* Amp Indices: DAC = 0, mixer = 1 */
13624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13626 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13632 /* FIXME: use matrix-type input source selection */
13633 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13635 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13640 static struct hda_verb alc663_m51va_init_verbs[] = {
13641 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13642 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13643 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
13647 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13648 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13652 static struct hda_verb alc663_g71v_init_verbs[] = {
13653 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13654 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
13655 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
13657 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13658 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13659 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13661 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13662 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
13663 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13667 static struct hda_verb alc663_g50v_init_verbs[] = {
13668 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13669 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13670 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13672 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13673 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13677 /* capture mixer elements */
13678 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13679 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13680 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13682 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13683 /* The multiple "Capture Source" controls confuse alsamixer
13684 * So call somewhat different..
13686 /* .name = "Capture Source", */
13687 .name = "Input Source",
13689 .info = alc662_mux_enum_info,
13690 .get = alc662_mux_enum_get,
13691 .put = alc662_mux_enum_put,
13696 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13698 unsigned int present;
13699 unsigned char bits;
13701 present = snd_hda_codec_read(codec, 0x14, 0,
13702 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13703 bits = present ? HDA_AMP_MUTE : 0;
13704 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13705 HDA_AMP_MUTE, bits);
13708 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13710 unsigned int present;
13711 unsigned char bits;
13713 present = snd_hda_codec_read(codec, 0x1b, 0,
13714 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13715 bits = present ? HDA_AMP_MUTE : 0;
13716 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13717 HDA_AMP_MUTE, bits);
13718 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13719 HDA_AMP_MUTE, bits);
13722 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13725 if ((res >> 26) == ALC880_HP_EVENT)
13726 alc662_lenovo_101e_all_automute(codec);
13727 if ((res >> 26) == ALC880_FRONT_EVENT)
13728 alc662_lenovo_101e_ispeaker_automute(codec);
13731 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13733 unsigned int present;
13735 present = snd_hda_codec_read(codec, 0x18, 0,
13736 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13737 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13738 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13739 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13740 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13741 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13742 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13743 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13744 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13747 /* unsolicited event for HP jack sensing */
13748 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13751 if ((res >> 26) == ALC880_HP_EVENT)
13752 alc262_hippo1_automute( codec );
13754 if ((res >> 26) == ALC880_MIC_EVENT)
13755 alc662_eeepc_mic_automute(codec);
13758 static void alc662_eeepc_inithook(struct hda_codec *codec)
13760 alc262_hippo1_automute( codec );
13761 alc662_eeepc_mic_automute(codec);
13764 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13767 unsigned int present;
13769 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13770 present = snd_hda_codec_read(codec, 0x14, 0,
13771 AC_VERB_GET_PIN_SENSE, 0);
13772 present = (present & 0x80000000) != 0;
13774 /* mute internal speaker */
13775 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13776 HDA_AMP_MUTE, HDA_AMP_MUTE);
13778 /* unmute internal speaker if necessary */
13779 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13780 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13781 HDA_AMP_MUTE, mute);
13785 /* unsolicited event for HP jack sensing */
13786 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13789 if ((res >> 26) == ALC880_HP_EVENT)
13790 alc662_eeepc_ep20_automute(codec);
13793 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13795 alc662_eeepc_ep20_automute(codec);
13798 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
13800 unsigned int present;
13801 unsigned char bits;
13803 present = snd_hda_codec_read(codec, 0x21, 0,
13804 AC_VERB_GET_PIN_SENSE, 0)
13805 & AC_PINSENSE_PRESENCE;
13806 bits = present ? HDA_AMP_MUTE : 0;
13807 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13808 HDA_AMP_MUTE, bits);
13811 static void alc663_m51va_mic_automute(struct hda_codec *codec)
13813 unsigned int present;
13815 present = snd_hda_codec_read(codec, 0x18, 0,
13816 AC_VERB_GET_PIN_SENSE, 0)
13817 & AC_PINSENSE_PRESENCE;
13818 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13819 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13820 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13821 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13822 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13823 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
13824 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13825 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
13828 static void alc663_m51va_unsol_event(struct hda_codec *codec,
13831 switch (res >> 26) {
13832 case ALC880_HP_EVENT:
13833 alc663_m51va_speaker_automute(codec);
13835 case ALC880_MIC_EVENT:
13836 alc663_m51va_mic_automute(codec);
13841 static void alc663_m51va_inithook(struct hda_codec *codec)
13843 alc663_m51va_speaker_automute(codec);
13844 alc663_m51va_mic_automute(codec);
13847 static void alc663_g71v_hp_automute(struct hda_codec *codec)
13849 unsigned int present;
13850 unsigned char bits;
13852 present = snd_hda_codec_read(codec, 0x21, 0,
13853 AC_VERB_GET_PIN_SENSE, 0)
13854 & AC_PINSENSE_PRESENCE;
13855 bits = present ? HDA_AMP_MUTE : 0;
13856 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13857 HDA_AMP_MUTE, bits);
13858 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13859 HDA_AMP_MUTE, bits);
13862 static void alc663_g71v_front_automute(struct hda_codec *codec)
13864 unsigned int present;
13865 unsigned char bits;
13867 present = snd_hda_codec_read(codec, 0x15, 0,
13868 AC_VERB_GET_PIN_SENSE, 0)
13869 & AC_PINSENSE_PRESENCE;
13870 bits = present ? HDA_AMP_MUTE : 0;
13871 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13872 HDA_AMP_MUTE, bits);
13875 static void alc663_g71v_unsol_event(struct hda_codec *codec,
13878 switch (res >> 26) {
13879 case ALC880_HP_EVENT:
13880 alc663_g71v_hp_automute(codec);
13882 case ALC880_FRONT_EVENT:
13883 alc663_g71v_front_automute(codec);
13885 case ALC880_MIC_EVENT:
13886 alc662_eeepc_mic_automute(codec);
13891 static void alc663_g71v_inithook(struct hda_codec *codec)
13893 alc663_g71v_front_automute(codec);
13894 alc663_g71v_hp_automute(codec);
13895 alc662_eeepc_mic_automute(codec);
13898 static void alc663_g50v_unsol_event(struct hda_codec *codec,
13901 switch (res >> 26) {
13902 case ALC880_HP_EVENT:
13903 alc663_m51va_speaker_automute(codec);
13905 case ALC880_MIC_EVENT:
13906 alc662_eeepc_mic_automute(codec);
13911 static void alc663_g50v_inithook(struct hda_codec *codec)
13913 alc663_m51va_speaker_automute(codec);
13914 alc662_eeepc_mic_automute(codec);
13917 #ifdef CONFIG_SND_HDA_POWER_SAVE
13918 #define alc662_loopbacks alc880_loopbacks
13922 /* pcm configuration: identiacal with ALC880 */
13923 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13924 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13925 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13926 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13929 * configuration and preset
13931 static const char *alc662_models[ALC662_MODEL_LAST] = {
13932 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13933 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13934 [ALC662_3ST_6ch] = "3stack-6ch",
13935 [ALC662_5ST_DIG] = "6stack-dig",
13936 [ALC662_LENOVO_101E] = "lenovo-101e",
13937 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13938 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13939 [ALC663_ASUS_M51VA] = "m51va",
13940 [ALC663_ASUS_G71V] = "g71v",
13941 [ALC663_ASUS_H13] = "h13",
13942 [ALC663_ASUS_G50V] = "g50v",
13943 [ALC662_AUTO] = "auto",
13946 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13947 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
13948 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
13949 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
13950 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
13951 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13952 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13953 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13954 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
13955 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
13956 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
13960 static struct alc_config_preset alc662_presets[] = {
13961 [ALC662_3ST_2ch_DIG] = {
13962 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13963 .init_verbs = { alc662_init_verbs },
13964 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13965 .dac_nids = alc662_dac_nids,
13966 .dig_out_nid = ALC662_DIGOUT_NID,
13967 .dig_in_nid = ALC662_DIGIN_NID,
13968 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13969 .channel_mode = alc662_3ST_2ch_modes,
13970 .input_mux = &alc662_capture_source,
13972 [ALC662_3ST_6ch_DIG] = {
13973 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13974 alc662_capture_mixer },
13975 .init_verbs = { alc662_init_verbs },
13976 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13977 .dac_nids = alc662_dac_nids,
13978 .dig_out_nid = ALC662_DIGOUT_NID,
13979 .dig_in_nid = ALC662_DIGIN_NID,
13980 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13981 .channel_mode = alc662_3ST_6ch_modes,
13983 .input_mux = &alc662_capture_source,
13985 [ALC662_3ST_6ch] = {
13986 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13987 alc662_capture_mixer },
13988 .init_verbs = { alc662_init_verbs },
13989 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13990 .dac_nids = alc662_dac_nids,
13991 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13992 .channel_mode = alc662_3ST_6ch_modes,
13994 .input_mux = &alc662_capture_source,
13996 [ALC662_5ST_DIG] = {
13997 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13998 alc662_capture_mixer },
13999 .init_verbs = { alc662_init_verbs },
14000 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14001 .dac_nids = alc662_dac_nids,
14002 .dig_out_nid = ALC662_DIGOUT_NID,
14003 .dig_in_nid = ALC662_DIGIN_NID,
14004 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
14005 .channel_mode = alc662_5stack_modes,
14006 .input_mux = &alc662_capture_source,
14008 [ALC662_LENOVO_101E] = {
14009 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
14010 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
14011 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14012 .dac_nids = alc662_dac_nids,
14013 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14014 .channel_mode = alc662_3ST_2ch_modes,
14015 .input_mux = &alc662_lenovo_101e_capture_source,
14016 .unsol_event = alc662_lenovo_101e_unsol_event,
14017 .init_hook = alc662_lenovo_101e_all_automute,
14019 [ALC662_ASUS_EEEPC_P701] = {
14020 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
14021 .init_verbs = { alc662_init_verbs,
14022 alc662_eeepc_sue_init_verbs },
14023 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14024 .dac_nids = alc662_dac_nids,
14025 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14026 .channel_mode = alc662_3ST_2ch_modes,
14027 .input_mux = &alc662_eeepc_capture_source,
14028 .unsol_event = alc662_eeepc_unsol_event,
14029 .init_hook = alc662_eeepc_inithook,
14031 [ALC662_ASUS_EEEPC_EP20] = {
14032 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
14033 alc662_chmode_mixer },
14034 .init_verbs = { alc662_init_verbs,
14035 alc662_eeepc_ep20_sue_init_verbs },
14036 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14037 .dac_nids = alc662_dac_nids,
14038 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14039 .channel_mode = alc662_3ST_6ch_modes,
14040 .input_mux = &alc662_lenovo_101e_capture_source,
14041 .unsol_event = alc662_eeepc_ep20_unsol_event,
14042 .init_hook = alc662_eeepc_ep20_inithook,
14044 [ALC663_ASUS_M51VA] = {
14045 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14046 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14047 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14048 .dac_nids = alc662_dac_nids,
14049 .dig_out_nid = ALC662_DIGOUT_NID,
14050 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14051 .channel_mode = alc662_3ST_2ch_modes,
14052 .input_mux = &alc663_m51va_capture_source,
14053 .unsol_event = alc663_m51va_unsol_event,
14054 .init_hook = alc663_m51va_inithook,
14056 [ALC663_ASUS_G71V] = {
14057 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
14058 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
14059 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14060 .dac_nids = alc662_dac_nids,
14061 .dig_out_nid = ALC662_DIGOUT_NID,
14062 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14063 .channel_mode = alc662_3ST_2ch_modes,
14064 .input_mux = &alc662_eeepc_capture_source,
14065 .unsol_event = alc663_g71v_unsol_event,
14066 .init_hook = alc663_g71v_inithook,
14068 [ALC663_ASUS_H13] = {
14069 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14070 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14071 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14072 .dac_nids = alc662_dac_nids,
14073 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14074 .channel_mode = alc662_3ST_2ch_modes,
14075 .input_mux = &alc663_m51va_capture_source,
14076 .unsol_event = alc663_m51va_unsol_event,
14077 .init_hook = alc663_m51va_inithook,
14079 [ALC663_ASUS_G50V] = {
14080 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
14081 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
14082 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14083 .dac_nids = alc662_dac_nids,
14084 .dig_out_nid = ALC662_DIGOUT_NID,
14085 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14086 .channel_mode = alc662_3ST_6ch_modes,
14087 .input_mux = &alc663_capture_source,
14088 .unsol_event = alc663_g50v_unsol_event,
14089 .init_hook = alc663_g50v_inithook,
14095 * BIOS auto configuration
14098 /* add playback controls from the parsed DAC table */
14099 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14100 const struct auto_pin_cfg *cfg)
14103 static const char *chname[4] = {
14104 "Front", "Surround", NULL /*CLFE*/, "Side"
14109 for (i = 0; i < cfg->line_outs; i++) {
14110 if (!spec->multiout.dac_nids[i])
14112 nid = alc880_idx_to_dac(i);
14115 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14116 "Center Playback Volume",
14117 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14121 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14122 "LFE Playback Volume",
14123 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14127 err = add_control(spec, ALC_CTL_BIND_MUTE,
14128 "Center Playback Switch",
14129 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
14133 err = add_control(spec, ALC_CTL_BIND_MUTE,
14134 "LFE Playback Switch",
14135 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
14140 sprintf(name, "%s Playback Volume", chname[i]);
14141 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14142 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14146 sprintf(name, "%s Playback Switch", chname[i]);
14147 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14148 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
14157 /* add playback controls for speaker and HP outputs */
14158 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
14168 if (alc880_is_fixed_pin(pin)) {
14169 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14170 /* printk("DAC nid=%x\n",nid); */
14171 /* specify the DAC as the extra output */
14172 if (!spec->multiout.hp_nid)
14173 spec->multiout.hp_nid = nid;
14175 spec->multiout.extra_out_nid[0] = nid;
14176 /* control HP volume/switch on the output mixer amp */
14177 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14178 sprintf(name, "%s Playback Volume", pfx);
14179 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14180 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14183 sprintf(name, "%s Playback Switch", pfx);
14184 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14185 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
14188 } else if (alc880_is_multi_pin(pin)) {
14189 /* set manual connection */
14190 /* we have only a switch on HP-out PIN */
14191 sprintf(name, "%s Playback Switch", pfx);
14192 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14193 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14200 /* create playback/capture controls for input pins */
14201 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
14202 const struct auto_pin_cfg *cfg)
14204 struct hda_input_mux *imux = &spec->private_imux;
14207 for (i = 0; i < AUTO_PIN_LAST; i++) {
14208 if (alc880_is_input_pin(cfg->input_pins[i])) {
14209 idx = alc880_input_pin_idx(cfg->input_pins[i]);
14210 err = new_analog_input(spec, cfg->input_pins[i],
14211 auto_pin_cfg_labels[i],
14215 imux->items[imux->num_items].label =
14216 auto_pin_cfg_labels[i];
14217 imux->items[imux->num_items].index =
14218 alc880_input_pin_idx(cfg->input_pins[i]);
14225 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
14226 hda_nid_t nid, int pin_type,
14229 alc_set_pin_output(codec, nid, pin_type);
14230 /* need the manual connection? */
14231 if (alc880_is_multi_pin(nid)) {
14232 struct alc_spec *spec = codec->spec;
14233 int idx = alc880_multi_pin_idx(nid);
14234 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
14235 AC_VERB_SET_CONNECT_SEL,
14236 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
14240 static void alc662_auto_init_multi_out(struct hda_codec *codec)
14242 struct alc_spec *spec = codec->spec;
14245 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14246 for (i = 0; i <= HDA_SIDE; i++) {
14247 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14248 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14250 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
14255 static void alc662_auto_init_hp_out(struct hda_codec *codec)
14257 struct alc_spec *spec = codec->spec;
14260 pin = spec->autocfg.hp_pins[0];
14261 if (pin) /* connect to front */
14263 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14264 pin = spec->autocfg.speaker_pins[0];
14266 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14269 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14270 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14272 static void alc662_auto_init_analog_input(struct hda_codec *codec)
14274 struct alc_spec *spec = codec->spec;
14277 for (i = 0; i < AUTO_PIN_LAST; i++) {
14278 hda_nid_t nid = spec->autocfg.input_pins[i];
14279 if (alc662_is_input_pin(nid)) {
14280 snd_hda_codec_write(codec, nid, 0,
14281 AC_VERB_SET_PIN_WIDGET_CONTROL,
14282 (i <= AUTO_PIN_FRONT_MIC ?
14283 PIN_VREF80 : PIN_IN));
14284 if (nid != ALC662_PIN_CD_NID)
14285 snd_hda_codec_write(codec, nid, 0,
14286 AC_VERB_SET_AMP_GAIN_MUTE,
14292 static int alc662_parse_auto_config(struct hda_codec *codec)
14294 struct alc_spec *spec = codec->spec;
14296 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14298 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14302 if (!spec->autocfg.line_outs)
14303 return 0; /* can't find valid BIOS pin config */
14305 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14308 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14311 err = alc662_auto_create_extra_out(spec,
14312 spec->autocfg.speaker_pins[0],
14316 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14320 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14324 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14326 if (spec->autocfg.dig_out_pin)
14327 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14329 if (spec->kctl_alloc)
14330 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14332 spec->num_mux_defs = 1;
14333 spec->input_mux = &spec->private_imux;
14335 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14336 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14337 spec->num_mixers++;
14341 /* additional initialization for auto-configuration model */
14342 static void alc662_auto_init(struct hda_codec *codec)
14344 struct alc_spec *spec = codec->spec;
14345 alc662_auto_init_multi_out(codec);
14346 alc662_auto_init_hp_out(codec);
14347 alc662_auto_init_analog_input(codec);
14348 if (spec->unsol_event)
14349 alc_sku_automute(codec);
14352 static int patch_alc662(struct hda_codec *codec)
14354 struct alc_spec *spec;
14355 int err, board_config;
14357 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14361 codec->spec = spec;
14363 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14366 if (board_config < 0) {
14367 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14368 "trying auto-probe from BIOS...\n");
14369 board_config = ALC662_AUTO;
14372 if (board_config == ALC662_AUTO) {
14373 /* automatic parse from the BIOS config */
14374 err = alc662_parse_auto_config(codec);
14380 "hda_codec: Cannot set up configuration "
14381 "from BIOS. Using base mode...\n");
14382 board_config = ALC662_3ST_2ch_DIG;
14386 if (board_config != ALC662_AUTO)
14387 setup_preset(spec, &alc662_presets[board_config]);
14389 if (codec->vendor_id == 0x10ec0663) {
14390 spec->stream_name_analog = "ALC663 Analog";
14391 spec->stream_name_digital = "ALC663 Digital";
14393 spec->stream_name_analog = "ALC662 Analog";
14394 spec->stream_name_digital = "ALC662 Digital";
14397 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14398 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14400 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14401 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14403 spec->adc_nids = alc662_adc_nids;
14404 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14405 spec->capsrc_nids = alc662_capsrc_nids;
14407 spec->vmaster_nid = 0x02;
14409 codec->patch_ops = alc_patch_ops;
14410 if (board_config == ALC662_AUTO)
14411 spec->init_hook = alc662_auto_init;
14412 #ifdef CONFIG_SND_HDA_POWER_SAVE
14413 if (!spec->loopback.amplist)
14414 spec->loopback.amplist = alc662_loopbacks;
14423 struct hda_codec_preset snd_hda_preset_realtek[] = {
14424 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14425 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14426 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14427 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14428 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14429 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14430 .patch = patch_alc861 },
14431 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14432 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14433 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14434 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14435 .patch = patch_alc883 },
14436 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14437 .patch = patch_alc662 },
14438 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
14439 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14440 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14441 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14442 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14443 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14444 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14445 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14446 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14447 {} /* terminator */