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 if (codec->vendor_id == 0x10ec0885) {
6495 spec->stream_name_analog = "ALC885 Analog";
6496 spec->stream_name_digital = "ALC885 Digital";
6498 spec->stream_name_analog = "ALC882 Analog";
6499 spec->stream_name_digital = "ALC882 Digital";
6502 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6503 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6504 /* FIXME: setup DAC5 */
6505 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6506 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6508 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6509 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6511 if (!spec->adc_nids && spec->input_mux) {
6512 /* check whether NID 0x07 is valid */
6513 unsigned int wcap = get_wcaps(codec, 0x07);
6515 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6516 if (wcap != AC_WID_AUD_IN) {
6517 spec->adc_nids = alc882_adc_nids_alt;
6518 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6519 spec->capsrc_nids = alc882_capsrc_nids_alt;
6520 spec->mixers[spec->num_mixers] =
6521 alc882_capture_alt_mixer;
6524 spec->adc_nids = alc882_adc_nids;
6525 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6526 spec->capsrc_nids = alc882_capsrc_nids;
6527 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6532 spec->vmaster_nid = 0x0c;
6534 codec->patch_ops = alc_patch_ops;
6535 if (board_config == ALC882_AUTO)
6536 spec->init_hook = alc882_auto_init;
6537 #ifdef CONFIG_SND_HDA_POWER_SAVE
6538 if (!spec->loopback.amplist)
6539 spec->loopback.amplist = alc882_loopbacks;
6548 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6549 * configuration. Each pin widget can choose any input DACs and a mixer.
6550 * Each ADC is connected from a mixer of all inputs. This makes possible
6551 * 6-channel independent captures.
6553 * In addition, an independent DAC for the multi-playback (not used in this
6556 #define ALC883_DIGOUT_NID 0x06
6557 #define ALC883_DIGIN_NID 0x0a
6559 static hda_nid_t alc883_dac_nids[4] = {
6560 /* front, rear, clfe, rear_surr */
6561 0x02, 0x03, 0x04, 0x05
6564 static hda_nid_t alc883_adc_nids[2] = {
6569 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6572 /* FIXME: should be a matrix-type input source selection */
6574 static struct hda_input_mux alc883_capture_source = {
6578 { "Front Mic", 0x1 },
6584 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6592 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6602 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6610 #define alc883_mux_enum_info alc_mux_enum_info
6611 #define alc883_mux_enum_get alc_mux_enum_get
6612 /* ALC883 has the ALC882-type input selection */
6613 #define alc883_mux_enum_put alc882_mux_enum_put
6618 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6625 static struct hda_verb alc883_3ST_ch2_init[] = {
6626 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6627 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6628 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6629 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6636 static struct hda_verb alc883_3ST_ch4_init[] = {
6637 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6638 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6639 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6640 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6641 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6648 static struct hda_verb alc883_3ST_ch6_init[] = {
6649 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6650 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6651 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6652 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6653 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6654 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6658 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6659 { 2, alc883_3ST_ch2_init },
6660 { 4, alc883_3ST_ch4_init },
6661 { 6, alc883_3ST_ch6_init },
6667 static struct hda_verb alc883_sixstack_ch6_init[] = {
6668 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6669 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6670 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6671 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6678 static struct hda_verb alc883_sixstack_ch8_init[] = {
6679 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6680 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6681 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6682 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6686 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6687 { 6, alc883_sixstack_ch6_init },
6688 { 8, alc883_sixstack_ch8_init },
6691 static struct hda_verb alc883_medion_eapd_verbs[] = {
6692 /* eanable EAPD on medion laptop */
6693 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6694 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6698 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6699 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6702 static struct snd_kcontrol_new alc883_base_mixer[] = {
6703 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6704 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6705 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6706 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6707 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6708 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6709 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6710 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6711 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6712 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6714 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6715 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6716 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6717 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6719 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6721 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6722 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6723 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6724 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6725 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6726 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6727 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6728 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6729 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6731 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6732 /* .name = "Capture Source", */
6733 .name = "Input Source",
6735 .info = alc883_mux_enum_info,
6736 .get = alc883_mux_enum_get,
6737 .put = alc883_mux_enum_put,
6742 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6743 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6744 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6745 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6746 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6747 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6748 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6749 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6751 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6752 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6753 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6754 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6755 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6756 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6757 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6758 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6759 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6761 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6762 /* .name = "Capture Source", */
6763 .name = "Input Source",
6765 .info = alc883_mux_enum_info,
6766 .get = alc883_mux_enum_get,
6767 .put = alc883_mux_enum_put,
6772 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6773 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6774 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6775 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6776 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6778 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6780 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6781 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6782 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6783 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6784 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6785 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6786 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6788 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6789 /* .name = "Capture Source", */
6790 .name = "Input Source",
6792 .info = alc883_mux_enum_info,
6793 .get = alc883_mux_enum_get,
6794 .put = alc883_mux_enum_put,
6799 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6800 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6801 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6802 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6803 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6805 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6806 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6807 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6808 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6809 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6810 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6811 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6812 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6813 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6815 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6816 /* .name = "Capture Source", */
6817 .name = "Input Source",
6819 .info = alc883_mux_enum_info,
6820 .get = alc883_mux_enum_get,
6821 .put = alc883_mux_enum_put,
6826 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6827 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6828 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6830 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6831 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6832 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6833 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6835 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6837 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6838 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6839 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6840 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6841 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6842 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6843 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6844 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6845 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6847 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6848 /* .name = "Capture Source", */
6849 .name = "Input Source",
6851 .info = alc883_mux_enum_info,
6852 .get = alc883_mux_enum_get,
6853 .put = alc883_mux_enum_put,
6858 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6860 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6861 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6862 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6863 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6864 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6865 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6866 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6867 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6868 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6869 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6870 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6871 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6873 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6876 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6878 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6879 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6880 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6881 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6882 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6883 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6885 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6886 /* .name = "Capture Source", */
6887 .name = "Input Source",
6889 .info = alc883_mux_enum_info,
6890 .get = alc883_mux_enum_get,
6891 .put = alc883_mux_enum_put,
6896 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6897 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6898 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6899 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6900 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6901 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6902 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6903 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6904 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6905 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6906 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6907 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6908 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6909 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6911 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6913 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6914 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6915 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6916 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6917 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6918 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6919 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6922 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6923 /* .name = "Capture Source", */
6924 .name = "Input Source",
6926 .info = alc883_mux_enum_info,
6927 .get = alc883_mux_enum_get,
6928 .put = alc883_mux_enum_put,
6933 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6934 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6935 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6936 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6937 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6938 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6939 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6940 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6941 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6942 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6943 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6944 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6951 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6952 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6953 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6955 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6956 /* .name = "Capture Source", */
6957 .name = "Input Source",
6959 .info = alc883_mux_enum_info,
6960 .get = alc883_mux_enum_get,
6961 .put = alc883_mux_enum_put,
6966 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6967 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6969 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6970 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6971 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6974 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6975 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6976 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6977 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6978 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6979 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6980 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6981 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6983 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6984 /* .name = "Capture Source", */
6985 .name = "Input Source",
6987 .info = alc883_mux_enum_info,
6988 .get = alc883_mux_enum_get,
6989 .put = alc883_mux_enum_put,
6994 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6995 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6996 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6997 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6998 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7003 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7004 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7007 /* .name = "Capture Source", */
7008 .name = "Input Source",
7010 .info = alc883_mux_enum_info,
7011 .get = alc883_mux_enum_get,
7012 .put = alc883_mux_enum_put,
7017 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7019 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7021 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7022 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7024 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7025 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7026 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7027 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7028 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7029 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7030 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7032 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7033 /* .name = "Capture Source", */
7034 .name = "Input Source",
7036 .info = alc883_mux_enum_info,
7037 .get = alc883_mux_enum_get,
7038 .put = alc883_mux_enum_put,
7043 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7044 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7046 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7051 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7052 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7053 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7054 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7055 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7056 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7059 /* .name = "Capture Source", */
7060 .name = "Input Source",
7062 .info = alc883_mux_enum_info,
7063 .get = alc883_mux_enum_get,
7064 .put = alc883_mux_enum_put,
7069 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7070 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7071 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7073 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7074 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7076 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7079 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7080 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7081 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7084 /* .name = "Capture Source", */
7085 .name = "Input Source",
7087 .info = alc883_mux_enum_info,
7088 .get = alc883_mux_enum_get,
7089 .put = alc883_mux_enum_put,
7094 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7096 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7097 .name = "Channel Mode",
7098 .info = alc_ch_mode_info,
7099 .get = alc_ch_mode_get,
7100 .put = alc_ch_mode_put,
7105 static struct hda_verb alc883_init_verbs[] = {
7106 /* ADC1: mute amp left and right */
7107 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7108 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7109 /* ADC2: mute amp left and right */
7110 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7111 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7112 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7113 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7114 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7122 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7123 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7125 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7126 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7127 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7129 /* mute analog input loopbacks */
7130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7136 /* Front Pin: output 0 (0x0c) */
7137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7138 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7139 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7140 /* Rear Pin: output 1 (0x0d) */
7141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7143 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7144 /* CLFE Pin: output 2 (0x0e) */
7145 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7146 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7147 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7148 /* Side Pin: output 3 (0x0f) */
7149 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7150 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7151 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7152 /* Mic (rear) pin: input vref at 80% */
7153 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7154 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7155 /* Front Mic pin: input vref at 80% */
7156 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7157 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7158 /* Line In pin: input */
7159 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7160 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7161 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7163 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7164 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7165 /* CD pin widget for input */
7166 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7168 /* FIXME: use matrix-type input source selection */
7169 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7171 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7172 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7183 /* toggle speaker-output according to the hp-jack state */
7184 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7186 unsigned int present;
7188 present = snd_hda_codec_read(codec, 0x15, 0,
7189 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7190 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7191 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7192 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7193 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7196 /* auto-toggle front mic */
7198 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7200 unsigned int present;
7203 present = snd_hda_codec_read(codec, 0x18, 0,
7204 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7205 bits = present ? HDA_AMP_MUTE : 0;
7206 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7210 static void alc883_mitac_automute(struct hda_codec *codec)
7212 alc883_mitac_hp_automute(codec);
7213 /* alc883_mitac_mic_automute(codec); */
7216 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7219 switch (res >> 26) {
7220 case ALC880_HP_EVENT:
7221 alc883_mitac_hp_automute(codec);
7223 case ALC880_MIC_EVENT:
7224 /* alc883_mitac_mic_automute(codec); */
7229 static struct hda_verb alc883_mitac_verbs[] = {
7231 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7234 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7235 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7237 /* enable unsolicited event */
7238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7239 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7244 static struct hda_verb alc883_clevo_m720_verbs[] = {
7246 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7249 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7250 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7252 /* enable unsolicited event */
7253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7254 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7259 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7261 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7264 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7265 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7267 /* enable unsolicited event */
7268 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7273 static struct hda_verb alc883_tagra_verbs[] = {
7274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7280 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7281 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7282 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7284 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7285 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7286 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7287 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7292 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7293 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7294 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7295 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7299 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7300 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7302 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7307 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7310 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7311 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7312 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7316 static struct hda_verb alc883_haier_w66_verbs[] = {
7317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7322 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7323 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7324 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7325 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7329 static struct hda_verb alc888_3st_hp_verbs[] = {
7330 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7331 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7332 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7336 static struct hda_verb alc888_6st_dell_verbs[] = {
7337 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7341 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7342 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7343 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7344 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7345 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7349 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7350 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7351 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7352 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7353 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7357 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7358 { 2, alc888_3st_hp_2ch_init },
7359 { 6, alc888_3st_hp_6ch_init },
7362 /* toggle front-jack and RCA according to the hp-jack state */
7363 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7365 unsigned int present;
7367 present = snd_hda_codec_read(codec, 0x1b, 0,
7368 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7369 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7370 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7371 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7372 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7375 /* toggle RCA according to the front-jack state */
7376 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7378 unsigned int present;
7380 present = snd_hda_codec_read(codec, 0x14, 0,
7381 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7382 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7383 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7386 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7389 if ((res >> 26) == ALC880_HP_EVENT)
7390 alc888_lenovo_ms7195_front_automute(codec);
7391 if ((res >> 26) == ALC880_FRONT_EVENT)
7392 alc888_lenovo_ms7195_rca_automute(codec);
7395 static struct hda_verb alc883_medion_md2_verbs[] = {
7396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7401 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7405 /* toggle speaker-output according to the hp-jack state */
7406 static void alc883_medion_md2_automute(struct hda_codec *codec)
7408 unsigned int present;
7410 present = snd_hda_codec_read(codec, 0x14, 0,
7411 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7412 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7413 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7416 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7419 if ((res >> 26) == ALC880_HP_EVENT)
7420 alc883_medion_md2_automute(codec);
7423 /* toggle speaker-output according to the hp-jack state */
7424 static void alc883_tagra_automute(struct hda_codec *codec)
7426 unsigned int present;
7429 present = snd_hda_codec_read(codec, 0x14, 0,
7430 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7431 bits = present ? HDA_AMP_MUTE : 0;
7432 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7433 HDA_AMP_MUTE, bits);
7434 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7438 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7440 if ((res >> 26) == ALC880_HP_EVENT)
7441 alc883_tagra_automute(codec);
7444 /* toggle speaker-output according to the hp-jack state */
7445 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7447 unsigned int present;
7450 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7451 & AC_PINSENSE_PRESENCE;
7452 bits = present ? HDA_AMP_MUTE : 0;
7453 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7454 HDA_AMP_MUTE, bits);
7457 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7459 unsigned int present;
7461 present = snd_hda_codec_read(codec, 0x18, 0,
7462 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7463 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7464 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7467 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7469 alc883_clevo_m720_hp_automute(codec);
7470 alc883_clevo_m720_mic_automute(codec);
7473 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7476 switch (res >> 26) {
7477 case ALC880_HP_EVENT:
7478 alc883_clevo_m720_hp_automute(codec);
7480 case ALC880_MIC_EVENT:
7481 alc883_clevo_m720_mic_automute(codec);
7486 /* toggle speaker-output according to the hp-jack state */
7487 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7489 unsigned int present;
7492 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7493 & AC_PINSENSE_PRESENCE;
7494 bits = present ? HDA_AMP_MUTE : 0;
7495 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7496 HDA_AMP_MUTE, bits);
7499 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7502 if ((res >> 26) == ALC880_HP_EVENT)
7503 alc883_2ch_fujitsu_pi2515_automute(codec);
7506 static void alc883_haier_w66_automute(struct hda_codec *codec)
7508 unsigned int present;
7511 present = snd_hda_codec_read(codec, 0x1b, 0,
7512 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7513 bits = present ? 0x80 : 0;
7514 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7518 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7521 if ((res >> 26) == ALC880_HP_EVENT)
7522 alc883_haier_w66_automute(codec);
7525 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7527 unsigned int present;
7530 present = snd_hda_codec_read(codec, 0x14, 0,
7531 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7532 bits = present ? HDA_AMP_MUTE : 0;
7533 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7534 HDA_AMP_MUTE, bits);
7537 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7539 unsigned int present;
7542 present = snd_hda_codec_read(codec, 0x1b, 0,
7543 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7544 bits = present ? HDA_AMP_MUTE : 0;
7545 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7546 HDA_AMP_MUTE, bits);
7547 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7548 HDA_AMP_MUTE, bits);
7551 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7554 if ((res >> 26) == ALC880_HP_EVENT)
7555 alc883_lenovo_101e_all_automute(codec);
7556 if ((res >> 26) == ALC880_FRONT_EVENT)
7557 alc883_lenovo_101e_ispeaker_automute(codec);
7560 /* toggle speaker-output according to the hp-jack state */
7561 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7563 unsigned int present;
7565 present = snd_hda_codec_read(codec, 0x14, 0,
7566 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7567 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7568 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7569 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7570 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7573 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7576 if ((res >> 26) == ALC880_HP_EVENT)
7577 alc883_acer_aspire_automute(codec);
7580 static struct hda_verb alc883_acer_eapd_verbs[] = {
7581 /* HP Pin: output 0 (0x0c) */
7582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7584 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7585 /* Front Pin: output 0 (0x0c) */
7586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7587 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7588 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7589 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7590 /* eanable EAPD on medion laptop */
7591 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7592 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7593 /* enable unsolicited event */
7594 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7598 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7600 unsigned int present;
7602 present = snd_hda_codec_read(codec, 0x1b, 0,
7603 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7604 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7605 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7606 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7607 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7608 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7609 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7610 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7611 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7614 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7617 switch (res >> 26) {
7618 case ALC880_HP_EVENT:
7619 printk("hp_event\n");
7620 alc888_6st_dell_front_automute(codec);
7626 * generic initialization of ADC, input mixers and output mixers
7628 static struct hda_verb alc883_auto_init_verbs[] = {
7630 * Unmute ADC0-2 and set the default input to mic-in
7632 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7634 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7635 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7637 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7639 * Note: PASD motherboards uses the Line In 2 as the input for
7640 * front panel mic (mic 2)
7642 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7650 * Set up output mixers (0x0c - 0x0f)
7652 /* set vol=0 to output mixers */
7653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7654 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7656 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7657 /* set up input amps for analog loopback */
7658 /* Amp Indices: DAC = 0, mixer = 1 */
7659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7665 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7667 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7668 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7670 /* FIXME: use matrix-type input source selection */
7671 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7673 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7675 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7676 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7682 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7688 /* capture mixer elements */
7689 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7690 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7691 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7692 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7693 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7695 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7696 /* The multiple "Capture Source" controls confuse alsamixer
7697 * So call somewhat different..
7699 /* .name = "Capture Source", */
7700 .name = "Input Source",
7702 .info = alc882_mux_enum_info,
7703 .get = alc882_mux_enum_get,
7704 .put = alc882_mux_enum_put,
7709 #ifdef CONFIG_SND_HDA_POWER_SAVE
7710 #define alc883_loopbacks alc880_loopbacks
7713 /* pcm configuration: identiacal with ALC880 */
7714 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7715 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7716 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7717 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7718 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7721 * configuration and preset
7723 static const char *alc883_models[ALC883_MODEL_LAST] = {
7724 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7725 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7726 [ALC883_3ST_6ch] = "3stack-6ch",
7727 [ALC883_6ST_DIG] = "6stack-dig",
7728 [ALC883_TARGA_DIG] = "targa-dig",
7729 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7730 [ALC883_ACER] = "acer",
7731 [ALC883_ACER_ASPIRE] = "acer-aspire",
7732 [ALC883_MEDION] = "medion",
7733 [ALC883_MEDION_MD2] = "medion-md2",
7734 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7735 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7736 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7737 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7738 [ALC883_HAIER_W66] = "haier-w66",
7739 [ALC888_3ST_HP] = "3stack-hp",
7740 [ALC888_6ST_DELL] = "6stack-dell",
7741 [ALC883_MITAC] = "mitac",
7742 [ALC883_CLEVO_M720] = "clevo-m720",
7743 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7744 [ALC883_AUTO] = "auto",
7747 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7748 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7749 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7750 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7751 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7752 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7753 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7754 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7755 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7756 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7757 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7758 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7759 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
7760 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7761 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7762 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7763 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7764 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7765 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7766 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7767 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7768 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7769 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7770 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7771 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7772 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7773 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7774 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7775 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7776 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7777 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7778 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7779 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7780 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7781 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7782 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7783 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7784 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7785 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7786 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7787 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7788 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7789 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7790 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7791 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7792 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7793 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7794 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7795 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7796 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7797 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7798 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7799 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7800 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7801 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7805 static struct alc_config_preset alc883_presets[] = {
7806 [ALC883_3ST_2ch_DIG] = {
7807 .mixers = { alc883_3ST_2ch_mixer },
7808 .init_verbs = { alc883_init_verbs },
7809 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7810 .dac_nids = alc883_dac_nids,
7811 .dig_out_nid = ALC883_DIGOUT_NID,
7812 .dig_in_nid = ALC883_DIGIN_NID,
7813 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7814 .channel_mode = alc883_3ST_2ch_modes,
7815 .input_mux = &alc883_capture_source,
7817 [ALC883_3ST_6ch_DIG] = {
7818 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7819 .init_verbs = { alc883_init_verbs },
7820 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7821 .dac_nids = alc883_dac_nids,
7822 .dig_out_nid = ALC883_DIGOUT_NID,
7823 .dig_in_nid = ALC883_DIGIN_NID,
7824 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7825 .channel_mode = alc883_3ST_6ch_modes,
7827 .input_mux = &alc883_capture_source,
7829 [ALC883_3ST_6ch] = {
7830 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7831 .init_verbs = { alc883_init_verbs },
7832 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7833 .dac_nids = alc883_dac_nids,
7834 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7835 .channel_mode = alc883_3ST_6ch_modes,
7837 .input_mux = &alc883_capture_source,
7839 [ALC883_6ST_DIG] = {
7840 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7841 .init_verbs = { alc883_init_verbs },
7842 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7843 .dac_nids = alc883_dac_nids,
7844 .dig_out_nid = ALC883_DIGOUT_NID,
7845 .dig_in_nid = ALC883_DIGIN_NID,
7846 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7847 .channel_mode = alc883_sixstack_modes,
7848 .input_mux = &alc883_capture_source,
7850 [ALC883_TARGA_DIG] = {
7851 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7852 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7853 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7854 .dac_nids = alc883_dac_nids,
7855 .dig_out_nid = ALC883_DIGOUT_NID,
7856 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7857 .channel_mode = alc883_3ST_6ch_modes,
7859 .input_mux = &alc883_capture_source,
7860 .unsol_event = alc883_tagra_unsol_event,
7861 .init_hook = alc883_tagra_automute,
7863 [ALC883_TARGA_2ch_DIG] = {
7864 .mixers = { alc883_tagra_2ch_mixer},
7865 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7866 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7867 .dac_nids = alc883_dac_nids,
7868 .dig_out_nid = ALC883_DIGOUT_NID,
7869 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7870 .channel_mode = alc883_3ST_2ch_modes,
7871 .input_mux = &alc883_capture_source,
7872 .unsol_event = alc883_tagra_unsol_event,
7873 .init_hook = alc883_tagra_automute,
7876 .mixers = { alc883_base_mixer },
7877 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7878 * and the headphone jack. Turn this on and rely on the
7879 * standard mute methods whenever the user wants to turn
7880 * these outputs off.
7882 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7883 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7884 .dac_nids = alc883_dac_nids,
7885 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7886 .channel_mode = alc883_3ST_2ch_modes,
7887 .input_mux = &alc883_capture_source,
7889 [ALC883_ACER_ASPIRE] = {
7890 .mixers = { alc883_acer_aspire_mixer },
7891 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7892 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7893 .dac_nids = alc883_dac_nids,
7894 .dig_out_nid = ALC883_DIGOUT_NID,
7895 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7896 .channel_mode = alc883_3ST_2ch_modes,
7897 .input_mux = &alc883_capture_source,
7898 .unsol_event = alc883_acer_aspire_unsol_event,
7899 .init_hook = alc883_acer_aspire_automute,
7902 .mixers = { alc883_fivestack_mixer,
7903 alc883_chmode_mixer },
7904 .init_verbs = { alc883_init_verbs,
7905 alc883_medion_eapd_verbs },
7906 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7907 .dac_nids = alc883_dac_nids,
7908 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7909 .channel_mode = alc883_sixstack_modes,
7910 .input_mux = &alc883_capture_source,
7912 [ALC883_MEDION_MD2] = {
7913 .mixers = { alc883_medion_md2_mixer},
7914 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7915 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7916 .dac_nids = alc883_dac_nids,
7917 .dig_out_nid = ALC883_DIGOUT_NID,
7918 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7919 .channel_mode = alc883_3ST_2ch_modes,
7920 .input_mux = &alc883_capture_source,
7921 .unsol_event = alc883_medion_md2_unsol_event,
7922 .init_hook = alc883_medion_md2_automute,
7924 [ALC883_LAPTOP_EAPD] = {
7925 .mixers = { alc883_base_mixer },
7926 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7927 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7928 .dac_nids = alc883_dac_nids,
7929 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7930 .channel_mode = alc883_3ST_2ch_modes,
7931 .input_mux = &alc883_capture_source,
7933 [ALC883_CLEVO_M720] = {
7934 .mixers = { alc883_clevo_m720_mixer },
7935 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
7936 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7937 .dac_nids = alc883_dac_nids,
7938 .dig_out_nid = ALC883_DIGOUT_NID,
7939 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7940 .channel_mode = alc883_3ST_2ch_modes,
7941 .input_mux = &alc883_capture_source,
7942 .unsol_event = alc883_clevo_m720_unsol_event,
7943 .init_hook = alc883_clevo_m720_automute,
7945 [ALC883_LENOVO_101E_2ch] = {
7946 .mixers = { alc883_lenovo_101e_2ch_mixer},
7947 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7948 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7949 .dac_nids = alc883_dac_nids,
7950 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7951 .channel_mode = alc883_3ST_2ch_modes,
7952 .input_mux = &alc883_lenovo_101e_capture_source,
7953 .unsol_event = alc883_lenovo_101e_unsol_event,
7954 .init_hook = alc883_lenovo_101e_all_automute,
7956 [ALC883_LENOVO_NB0763] = {
7957 .mixers = { alc883_lenovo_nb0763_mixer },
7958 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7959 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7960 .dac_nids = alc883_dac_nids,
7961 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7962 .channel_mode = alc883_3ST_2ch_modes,
7964 .input_mux = &alc883_lenovo_nb0763_capture_source,
7965 .unsol_event = alc883_medion_md2_unsol_event,
7966 .init_hook = alc883_medion_md2_automute,
7968 [ALC888_LENOVO_MS7195_DIG] = {
7969 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7970 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7971 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7972 .dac_nids = alc883_dac_nids,
7973 .dig_out_nid = ALC883_DIGOUT_NID,
7974 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7975 .channel_mode = alc883_3ST_6ch_modes,
7977 .input_mux = &alc883_capture_source,
7978 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7979 .init_hook = alc888_lenovo_ms7195_front_automute,
7981 [ALC883_HAIER_W66] = {
7982 .mixers = { alc883_tagra_2ch_mixer},
7983 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7984 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7985 .dac_nids = alc883_dac_nids,
7986 .dig_out_nid = ALC883_DIGOUT_NID,
7987 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7988 .channel_mode = alc883_3ST_2ch_modes,
7989 .input_mux = &alc883_capture_source,
7990 .unsol_event = alc883_haier_w66_unsol_event,
7991 .init_hook = alc883_haier_w66_automute,
7994 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7995 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7996 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7997 .dac_nids = alc883_dac_nids,
7998 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7999 .channel_mode = alc888_3st_hp_modes,
8001 .input_mux = &alc883_capture_source,
8003 [ALC888_6ST_DELL] = {
8004 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8005 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8006 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8007 .dac_nids = alc883_dac_nids,
8008 .dig_out_nid = ALC883_DIGOUT_NID,
8009 .dig_in_nid = ALC883_DIGIN_NID,
8010 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8011 .channel_mode = alc883_sixstack_modes,
8012 .input_mux = &alc883_capture_source,
8013 .unsol_event = alc888_6st_dell_unsol_event,
8014 .init_hook = alc888_6st_dell_front_automute,
8017 .mixers = { alc883_mitac_mixer },
8018 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8019 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8020 .dac_nids = alc883_dac_nids,
8021 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8022 .channel_mode = alc883_3ST_2ch_modes,
8023 .input_mux = &alc883_capture_source,
8024 .unsol_event = alc883_mitac_unsol_event,
8025 .init_hook = alc883_mitac_automute,
8027 [ALC883_FUJITSU_PI2515] = {
8028 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8029 .init_verbs = { alc883_init_verbs,
8030 alc883_2ch_fujitsu_pi2515_verbs},
8031 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8032 .dac_nids = alc883_dac_nids,
8033 .dig_out_nid = ALC883_DIGOUT_NID,
8034 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8035 .channel_mode = alc883_3ST_2ch_modes,
8036 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8037 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8038 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8044 * BIOS auto configuration
8046 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8047 hda_nid_t nid, int pin_type,
8051 struct alc_spec *spec = codec->spec;
8054 alc_set_pin_output(codec, nid, pin_type);
8055 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8058 idx = spec->multiout.dac_nids[dac_idx] - 2;
8059 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8063 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8065 struct alc_spec *spec = codec->spec;
8068 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8069 for (i = 0; i <= HDA_SIDE; i++) {
8070 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8071 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8073 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8078 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8080 struct alc_spec *spec = codec->spec;
8083 pin = spec->autocfg.hp_pins[0];
8084 if (pin) /* connect to front */
8086 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8087 pin = spec->autocfg.speaker_pins[0];
8089 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8092 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8093 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8095 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8097 struct alc_spec *spec = codec->spec;
8100 for (i = 0; i < AUTO_PIN_LAST; i++) {
8101 hda_nid_t nid = spec->autocfg.input_pins[i];
8102 if (alc883_is_input_pin(nid)) {
8103 snd_hda_codec_write(codec, nid, 0,
8104 AC_VERB_SET_PIN_WIDGET_CONTROL,
8105 (i <= AUTO_PIN_FRONT_MIC ?
8106 PIN_VREF80 : PIN_IN));
8107 if (nid != ALC883_PIN_CD_NID)
8108 snd_hda_codec_write(codec, nid, 0,
8109 AC_VERB_SET_AMP_GAIN_MUTE,
8115 /* almost identical with ALC880 parser... */
8116 static int alc883_parse_auto_config(struct hda_codec *codec)
8118 struct alc_spec *spec = codec->spec;
8119 int err = alc880_parse_auto_config(codec);
8124 return 0; /* no config found */
8126 err = alc_auto_add_mic_boost(codec);
8130 /* hack - override the init verbs */
8131 spec->init_verbs[0] = alc883_auto_init_verbs;
8132 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8135 return 1; /* config found */
8138 /* additional initialization for auto-configuration model */
8139 static void alc883_auto_init(struct hda_codec *codec)
8141 struct alc_spec *spec = codec->spec;
8142 alc883_auto_init_multi_out(codec);
8143 alc883_auto_init_hp_out(codec);
8144 alc883_auto_init_analog_input(codec);
8145 if (spec->unsol_event)
8146 alc_sku_automute(codec);
8149 static int patch_alc883(struct hda_codec *codec)
8151 struct alc_spec *spec;
8152 int err, board_config;
8154 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8160 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8163 if (board_config < 0) {
8164 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8165 "trying auto-probe from BIOS...\n");
8166 board_config = ALC883_AUTO;
8169 if (board_config == ALC883_AUTO) {
8170 /* automatic parse from the BIOS config */
8171 err = alc883_parse_auto_config(codec);
8177 "hda_codec: Cannot set up configuration "
8178 "from BIOS. Using base mode...\n");
8179 board_config = ALC883_3ST_2ch_DIG;
8183 if (board_config != ALC883_AUTO)
8184 setup_preset(spec, &alc883_presets[board_config]);
8186 switch (codec->vendor_id) {
8188 spec->stream_name_analog = "ALC888 Analog";
8189 spec->stream_name_digital = "ALC888 Digital";
8192 spec->stream_name_analog = "ALC889 Analog";
8193 spec->stream_name_digital = "ALC889 Digital";
8196 spec->stream_name_analog = "ALC883 Analog";
8197 spec->stream_name_digital = "ALC883 Digital";
8201 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8202 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8203 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8205 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8206 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8208 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8209 spec->adc_nids = alc883_adc_nids;
8210 spec->capsrc_nids = alc883_capsrc_nids;
8212 spec->vmaster_nid = 0x0c;
8214 codec->patch_ops = alc_patch_ops;
8215 if (board_config == ALC883_AUTO)
8216 spec->init_hook = alc883_auto_init;
8217 #ifdef CONFIG_SND_HDA_POWER_SAVE
8218 if (!spec->loopback.amplist)
8219 spec->loopback.amplist = alc883_loopbacks;
8229 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8230 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8232 #define alc262_dac_nids alc260_dac_nids
8233 #define alc262_adc_nids alc882_adc_nids
8234 #define alc262_adc_nids_alt alc882_adc_nids_alt
8235 #define alc262_capsrc_nids alc882_capsrc_nids
8236 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8238 #define alc262_modes alc260_modes
8239 #define alc262_capture_source alc882_capture_source
8241 static struct snd_kcontrol_new alc262_base_mixer[] = {
8242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8243 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8252 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8254 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8255 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8256 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8257 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8258 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8259 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8263 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8265 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8266 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8267 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8269 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8273 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8275 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8276 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8277 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8278 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8279 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8283 /* update HP, line and mono-out pins according to the master switch */
8284 static void alc262_hp_master_update(struct hda_codec *codec)
8286 struct alc_spec *spec = codec->spec;
8287 int val = spec->master_sw;
8290 snd_hda_codec_write_cache(codec, 0x1b, 0,
8291 AC_VERB_SET_PIN_WIDGET_CONTROL,
8293 snd_hda_codec_write_cache(codec, 0x15, 0,
8294 AC_VERB_SET_PIN_WIDGET_CONTROL,
8296 /* mono (speaker) depending on the HP jack sense */
8297 val = val && !spec->jack_present;
8298 snd_hda_codec_write_cache(codec, 0x16, 0,
8299 AC_VERB_SET_PIN_WIDGET_CONTROL,
8303 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8305 struct alc_spec *spec = codec->spec;
8306 unsigned int presence;
8307 presence = snd_hda_codec_read(codec, 0x1b, 0,
8308 AC_VERB_GET_PIN_SENSE, 0);
8309 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8310 alc262_hp_master_update(codec);
8313 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8315 if ((res >> 26) != ALC880_HP_EVENT)
8317 alc262_hp_bpc_automute(codec);
8320 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8322 struct alc_spec *spec = codec->spec;
8323 unsigned int presence;
8324 presence = snd_hda_codec_read(codec, 0x15, 0,
8325 AC_VERB_GET_PIN_SENSE, 0);
8326 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8327 alc262_hp_master_update(codec);
8330 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8333 if ((res >> 26) != ALC880_HP_EVENT)
8335 alc262_hp_wildwest_automute(codec);
8338 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8339 struct snd_ctl_elem_value *ucontrol)
8341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8342 struct alc_spec *spec = codec->spec;
8343 *ucontrol->value.integer.value = spec->master_sw;
8347 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8348 struct snd_ctl_elem_value *ucontrol)
8350 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8351 struct alc_spec *spec = codec->spec;
8352 int val = !!*ucontrol->value.integer.value;
8354 if (val == spec->master_sw)
8356 spec->master_sw = val;
8357 alc262_hp_master_update(codec);
8361 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8364 .name = "Master Playback Switch",
8365 .info = snd_ctl_boolean_mono_info,
8366 .get = alc262_hp_master_sw_get,
8367 .put = alc262_hp_master_sw_put,
8369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8370 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8371 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8372 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8374 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8381 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8384 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8385 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8386 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8387 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8388 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8389 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8393 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8395 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8396 .name = "Master Playback Switch",
8397 .info = snd_ctl_boolean_mono_info,
8398 .get = alc262_hp_master_sw_get,
8399 .put = alc262_hp_master_sw_put,
8401 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8402 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8403 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8405 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8407 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8409 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8410 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8411 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8412 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8413 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8414 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8415 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8416 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8417 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8421 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8422 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8423 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8424 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8428 /* mute/unmute internal speaker according to the hp jack and mute state */
8429 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8431 struct alc_spec *spec = codec->spec;
8433 if (force || !spec->sense_updated) {
8434 unsigned int present;
8435 present = snd_hda_codec_read(codec, 0x15, 0,
8436 AC_VERB_GET_PIN_SENSE, 0);
8437 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8438 spec->sense_updated = 1;
8440 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8441 spec->jack_present ? HDA_AMP_MUTE : 0);
8444 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8447 if ((res >> 26) != ALC880_HP_EVENT)
8449 alc262_hp_t5735_automute(codec, 1);
8452 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8454 alc262_hp_t5735_automute(codec, 1);
8457 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8459 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8460 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8461 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8464 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8468 static struct hda_verb alc262_hp_t5735_verbs[] = {
8469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8472 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8476 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8477 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8478 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8479 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8480 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8486 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8487 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8488 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8490 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8492 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8493 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8500 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8507 /* bind hp and internal speaker mute (with plug check) */
8508 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8509 struct snd_ctl_elem_value *ucontrol)
8511 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8512 long *valp = ucontrol->value.integer.value;
8515 /* change hp mute */
8516 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8518 valp[0] ? 0 : HDA_AMP_MUTE);
8519 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8521 valp[1] ? 0 : HDA_AMP_MUTE);
8523 /* change speaker according to HP jack state */
8524 struct alc_spec *spec = codec->spec;
8526 if (spec->jack_present)
8527 mute = HDA_AMP_MUTE;
8529 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8531 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8532 HDA_AMP_MUTE, mute);
8537 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8538 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8541 .name = "Master Playback Switch",
8542 .info = snd_hda_mixer_amp_switch_info,
8543 .get = snd_hda_mixer_amp_switch_get,
8544 .put = alc262_sony_master_sw_put,
8545 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8548 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8549 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8550 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8554 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8555 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8556 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8560 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8561 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8565 #define alc262_capture_mixer alc882_capture_mixer
8566 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8569 * generic initialization of ADC, input mixers and output mixers
8571 static struct hda_verb alc262_init_verbs[] = {
8573 * Unmute ADC0-2 and set the default input to mic-in
8575 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8577 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8578 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8579 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8582 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8584 * Note: PASD motherboards uses the Line In 2 as the input for
8585 * front panel mic (mic 2)
8587 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8591 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8595 * Set up output mixers (0x0c - 0x0e)
8597 /* set vol=0 to output mixers */
8598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8601 /* set up input amps for analog loopback */
8602 /* Amp Indices: DAC = 0, mixer = 1 */
8603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8613 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8614 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8615 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8618 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8619 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8621 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8623 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8624 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8626 /* FIXME: use matrix-type input source selection */
8627 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8628 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8629 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8630 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8631 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8632 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8635 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8637 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8647 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8648 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8653 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8654 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8655 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8656 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8658 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8659 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8663 static struct hda_verb alc262_sony_unsol_verbs[] = {
8664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8665 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8668 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8673 /* mute/unmute internal speaker according to the hp jack and mute state */
8674 static void alc262_hippo_automute(struct hda_codec *codec)
8676 struct alc_spec *spec = codec->spec;
8678 unsigned int present;
8680 /* need to execute and sync at first */
8681 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8682 present = snd_hda_codec_read(codec, 0x15, 0,
8683 AC_VERB_GET_PIN_SENSE, 0);
8684 spec->jack_present = (present & 0x80000000) != 0;
8685 if (spec->jack_present) {
8686 /* mute internal speaker */
8687 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8688 HDA_AMP_MUTE, HDA_AMP_MUTE);
8690 /* unmute internal speaker if necessary */
8691 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8692 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8693 HDA_AMP_MUTE, mute);
8697 /* unsolicited event for HP jack sensing */
8698 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8701 if ((res >> 26) != ALC880_HP_EVENT)
8703 alc262_hippo_automute(codec);
8706 static void alc262_hippo1_automute(struct hda_codec *codec)
8709 unsigned int present;
8711 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8712 present = snd_hda_codec_read(codec, 0x1b, 0,
8713 AC_VERB_GET_PIN_SENSE, 0);
8714 present = (present & 0x80000000) != 0;
8716 /* mute internal speaker */
8717 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8718 HDA_AMP_MUTE, HDA_AMP_MUTE);
8720 /* unmute internal speaker if necessary */
8721 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8722 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8723 HDA_AMP_MUTE, mute);
8727 /* unsolicited event for HP jack sensing */
8728 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8731 if ((res >> 26) != ALC880_HP_EVENT)
8733 alc262_hippo1_automute(codec);
8738 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8739 * 0x1b = port replicator headphone out
8742 #define ALC_HP_EVENT 0x37
8744 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8745 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8747 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8748 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8752 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8753 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8758 static struct hda_input_mux alc262_fujitsu_capture_source = {
8767 static struct hda_input_mux alc262_HP_capture_source = {
8771 { "Front Mic", 0x1 },
8778 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8782 { "Front Mic", 0x2 },
8788 /* mute/unmute internal speaker according to the hp jacks and mute state */
8789 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8791 struct alc_spec *spec = codec->spec;
8794 if (force || !spec->sense_updated) {
8795 unsigned int present;
8796 /* need to execute and sync at first */
8797 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8798 /* check laptop HP jack */
8799 present = snd_hda_codec_read(codec, 0x14, 0,
8800 AC_VERB_GET_PIN_SENSE, 0);
8801 /* need to execute and sync at first */
8802 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8803 /* check docking HP jack */
8804 present |= snd_hda_codec_read(codec, 0x1b, 0,
8805 AC_VERB_GET_PIN_SENSE, 0);
8806 if (present & AC_PINSENSE_PRESENCE)
8807 spec->jack_present = 1;
8809 spec->jack_present = 0;
8810 spec->sense_updated = 1;
8812 /* unmute internal speaker only if both HPs are unplugged and
8813 * master switch is on
8815 if (spec->jack_present)
8816 mute = HDA_AMP_MUTE;
8818 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8819 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8820 HDA_AMP_MUTE, mute);
8823 /* unsolicited event for HP jack sensing */
8824 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8827 if ((res >> 26) != ALC_HP_EVENT)
8829 alc262_fujitsu_automute(codec, 1);
8832 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
8834 alc262_fujitsu_automute(codec, 1);
8837 /* bind volumes of both NID 0x0c and 0x0d */
8838 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8839 .ops = &snd_hda_bind_vol,
8841 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8842 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8847 /* mute/unmute internal speaker according to the hp jack and mute state */
8848 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
8850 struct alc_spec *spec = codec->spec;
8853 if (force || !spec->sense_updated) {
8854 unsigned int present_int_hp;
8855 /* need to execute and sync at first */
8856 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8857 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
8858 AC_VERB_GET_PIN_SENSE, 0);
8859 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8860 spec->sense_updated = 1;
8862 if (spec->jack_present) {
8863 /* mute internal speaker */
8864 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8865 HDA_AMP_MUTE, HDA_AMP_MUTE);
8866 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8867 HDA_AMP_MUTE, HDA_AMP_MUTE);
8869 /* unmute internal speaker if necessary */
8870 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8871 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8872 HDA_AMP_MUTE, mute);
8873 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8874 HDA_AMP_MUTE, mute);
8878 /* unsolicited event for HP jack sensing */
8879 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
8882 if ((res >> 26) != ALC_HP_EVENT)
8884 alc262_lenovo_3000_automute(codec, 1);
8887 /* bind hp and internal speaker mute (with plug check) */
8888 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8889 struct snd_ctl_elem_value *ucontrol)
8891 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8892 long *valp = ucontrol->value.integer.value;
8895 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8897 valp ? 0 : HDA_AMP_MUTE);
8898 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8900 valp ? 0 : HDA_AMP_MUTE);
8903 alc262_fujitsu_automute(codec, 0);
8907 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8908 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8910 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8911 .name = "Master Playback Switch",
8912 .info = snd_hda_mixer_amp_switch_info,
8913 .get = snd_hda_mixer_amp_switch_get,
8914 .put = alc262_fujitsu_master_sw_put,
8915 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8917 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8918 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8919 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
8920 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
8921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8922 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8924 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8925 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8926 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8930 /* bind hp and internal speaker mute (with plug check) */
8931 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
8932 struct snd_ctl_elem_value *ucontrol)
8934 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8935 long *valp = ucontrol->value.integer.value;
8938 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8940 valp ? 0 : HDA_AMP_MUTE);
8943 alc262_lenovo_3000_automute(codec, 0);
8947 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
8948 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8950 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8951 .name = "Master Playback Switch",
8952 .info = snd_hda_mixer_amp_switch_info,
8953 .get = snd_hda_mixer_amp_switch_get,
8954 .put = alc262_lenovo_3000_master_sw_put,
8955 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8957 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8958 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8959 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8962 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8963 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8964 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8968 /* additional init verbs for Benq laptops */
8969 static struct hda_verb alc262_EAPD_verbs[] = {
8970 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8971 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8975 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8976 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8977 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8979 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8980 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8984 /* Samsung Q1 Ultra Vista model setup */
8985 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8986 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8987 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
8988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8990 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8991 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
8995 static struct hda_verb alc262_ultra_verbs[] = {
8997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9003 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9004 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9006 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9009 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9010 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9014 /* ADC, choose mic */
9015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9016 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9020 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9021 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9022 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9024 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9028 /* mute/unmute internal speaker according to the hp jack and mute state */
9029 static void alc262_ultra_automute(struct hda_codec *codec)
9031 struct alc_spec *spec = codec->spec;
9035 /* auto-mute only when HP is used as HP */
9036 if (!spec->cur_mux[0]) {
9037 unsigned int present;
9038 /* need to execute and sync at first */
9039 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9040 present = snd_hda_codec_read(codec, 0x15, 0,
9041 AC_VERB_GET_PIN_SENSE, 0);
9042 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9043 if (spec->jack_present)
9044 mute = HDA_AMP_MUTE;
9046 /* mute/unmute internal speaker */
9047 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9048 HDA_AMP_MUTE, mute);
9049 /* mute/unmute HP */
9050 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9051 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9054 /* unsolicited event for HP jack sensing */
9055 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9058 if ((res >> 26) != ALC880_HP_EVENT)
9060 alc262_ultra_automute(codec);
9063 static struct hda_input_mux alc262_ultra_capture_source = {
9067 { "Headphone", 0x7 },
9071 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9072 struct snd_ctl_elem_value *ucontrol)
9074 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9075 struct alc_spec *spec = codec->spec;
9078 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9081 /* reprogram the HP pin as mic or HP according to the input source */
9082 snd_hda_codec_write_cache(codec, 0x15, 0,
9083 AC_VERB_SET_PIN_WIDGET_CONTROL,
9084 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9085 alc262_ultra_automute(codec); /* mute/unmute HP */
9089 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9090 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9091 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9094 .name = "Capture Source",
9095 .info = alc882_mux_enum_info,
9096 .get = alc882_mux_enum_get,
9097 .put = alc262_ultra_mux_enum_put,
9102 /* add playback controls from the parsed DAC table */
9103 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9104 const struct auto_pin_cfg *cfg)
9109 spec->multiout.num_dacs = 1; /* only use one dac */
9110 spec->multiout.dac_nids = spec->private_dac_nids;
9111 spec->multiout.dac_nids[0] = 2;
9113 nid = cfg->line_out_pins[0];
9115 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9116 "Front Playback Volume",
9117 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9120 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9121 "Front Playback Switch",
9122 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9127 nid = cfg->speaker_pins[0];
9130 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9131 "Speaker Playback Volume",
9132 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9136 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9137 "Speaker Playback Switch",
9138 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9143 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9144 "Speaker Playback Switch",
9145 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9151 nid = cfg->hp_pins[0];
9153 /* spec->multiout.hp_nid = 2; */
9155 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9156 "Headphone Playback Volume",
9157 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9161 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9162 "Headphone Playback Switch",
9163 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9168 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9169 "Headphone Playback Switch",
9170 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9179 /* identical with ALC880 */
9180 #define alc262_auto_create_analog_input_ctls \
9181 alc880_auto_create_analog_input_ctls
9184 * generic initialization of ADC, input mixers and output mixers
9186 static struct hda_verb alc262_volume_init_verbs[] = {
9188 * Unmute ADC0-2 and set the default input to mic-in
9190 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9191 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9192 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9193 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9194 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9195 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9197 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9199 * Note: PASD motherboards uses the Line In 2 as the input for
9200 * front panel mic (mic 2)
9202 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9205 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9206 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9207 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9210 * Set up output mixers (0x0c - 0x0f)
9212 /* set vol=0 to output mixers */
9213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9214 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9215 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9217 /* set up input amps for analog loopback */
9218 /* Amp Indices: DAC = 0, mixer = 1 */
9219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9221 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9222 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9223 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9226 /* FIXME: use matrix-type input source selection */
9227 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9228 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9235 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9236 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9239 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9240 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9247 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9249 * Unmute ADC0-2 and set the default input to mic-in
9251 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9253 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9254 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9255 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9256 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9258 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9260 * Note: PASD motherboards uses the Line In 2 as the input for
9261 * front panel mic (mic 2)
9263 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9273 * Set up output mixers (0x0c - 0x0e)
9275 /* set vol=0 to output mixers */
9276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9277 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9280 /* set up input amps for analog loopback */
9281 /* Amp Indices: DAC = 0, mixer = 1 */
9282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9284 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9289 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9293 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9296 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9301 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9302 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9303 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9305 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9307 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9308 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9309 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9310 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9313 /* FIXME: use matrix-type input source selection */
9314 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9315 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9321 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9322 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9327 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9331 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9336 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9338 * Unmute ADC0-2 and set the default input to mic-in
9340 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9342 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9343 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9344 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9345 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9347 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9349 * Note: PASD motherboards uses the Line In 2 as the input for front
9352 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9360 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9362 * Set up output mixers (0x0c - 0x0e)
9364 /* set vol=0 to output mixers */
9365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9369 /* set up input amps for analog loopback */
9370 /* Amp Indices: DAC = 0, mixer = 1 */
9371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9380 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9382 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9383 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9385 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9387 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9390 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9393 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9394 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9395 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9396 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9397 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9398 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9400 /* FIXME: use matrix-type input source selection */
9401 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9402 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9408 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9414 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9416 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9424 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9427 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9432 #ifdef CONFIG_SND_HDA_POWER_SAVE
9433 #define alc262_loopbacks alc880_loopbacks
9436 /* pcm configuration: identiacal with ALC880 */
9437 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9438 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9439 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9440 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9443 * BIOS auto configuration
9445 static int alc262_parse_auto_config(struct hda_codec *codec)
9447 struct alc_spec *spec = codec->spec;
9449 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9451 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9455 if (!spec->autocfg.line_outs)
9456 return 0; /* can't find valid BIOS pin config */
9457 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9460 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9464 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9466 if (spec->autocfg.dig_out_pin)
9467 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9468 if (spec->autocfg.dig_in_pin)
9469 spec->dig_in_nid = ALC262_DIGIN_NID;
9471 if (spec->kctl_alloc)
9472 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9474 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9475 spec->num_mux_defs = 1;
9476 spec->input_mux = &spec->private_imux;
9478 err = alc_auto_add_mic_boost(codec);
9485 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9486 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9487 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9490 /* init callback for auto-configuration model -- overriding the default init */
9491 static void alc262_auto_init(struct hda_codec *codec)
9493 struct alc_spec *spec = codec->spec;
9494 alc262_auto_init_multi_out(codec);
9495 alc262_auto_init_hp_out(codec);
9496 alc262_auto_init_analog_input(codec);
9497 if (spec->unsol_event)
9498 alc_sku_automute(codec);
9502 * configuration and preset
9504 static const char *alc262_models[ALC262_MODEL_LAST] = {
9505 [ALC262_BASIC] = "basic",
9506 [ALC262_HIPPO] = "hippo",
9507 [ALC262_HIPPO_1] = "hippo_1",
9508 [ALC262_FUJITSU] = "fujitsu",
9509 [ALC262_HP_BPC] = "hp-bpc",
9510 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9511 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9512 [ALC262_HP_RP5700] = "hp-rp5700",
9513 [ALC262_BENQ_ED8] = "benq",
9514 [ALC262_BENQ_T31] = "benq-t31",
9515 [ALC262_SONY_ASSAMD] = "sony-assamd",
9516 [ALC262_ULTRA] = "ultra",
9517 [ALC262_LENOVO_3000] = "lenovo-3000",
9518 [ALC262_AUTO] = "auto",
9521 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9522 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9523 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9524 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9525 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9526 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9527 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9528 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9529 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9530 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9531 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9532 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9533 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9534 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9535 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9536 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9537 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9538 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9539 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9540 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9541 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9542 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9543 ALC262_HP_TC_T5735),
9544 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9545 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9546 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9547 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9548 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9549 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9550 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9551 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9552 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9553 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9554 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9555 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9556 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9557 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9561 static struct alc_config_preset alc262_presets[] = {
9563 .mixers = { alc262_base_mixer },
9564 .init_verbs = { alc262_init_verbs },
9565 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9566 .dac_nids = alc262_dac_nids,
9568 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9569 .channel_mode = alc262_modes,
9570 .input_mux = &alc262_capture_source,
9573 .mixers = { alc262_base_mixer },
9574 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9575 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9576 .dac_nids = alc262_dac_nids,
9578 .dig_out_nid = ALC262_DIGOUT_NID,
9579 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9580 .channel_mode = alc262_modes,
9581 .input_mux = &alc262_capture_source,
9582 .unsol_event = alc262_hippo_unsol_event,
9583 .init_hook = alc262_hippo_automute,
9585 [ALC262_HIPPO_1] = {
9586 .mixers = { alc262_hippo1_mixer },
9587 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9588 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9589 .dac_nids = alc262_dac_nids,
9591 .dig_out_nid = ALC262_DIGOUT_NID,
9592 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9593 .channel_mode = alc262_modes,
9594 .input_mux = &alc262_capture_source,
9595 .unsol_event = alc262_hippo1_unsol_event,
9596 .init_hook = alc262_hippo1_automute,
9598 [ALC262_FUJITSU] = {
9599 .mixers = { alc262_fujitsu_mixer },
9600 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9601 alc262_fujitsu_unsol_verbs },
9602 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9603 .dac_nids = alc262_dac_nids,
9605 .dig_out_nid = ALC262_DIGOUT_NID,
9606 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9607 .channel_mode = alc262_modes,
9608 .input_mux = &alc262_fujitsu_capture_source,
9609 .unsol_event = alc262_fujitsu_unsol_event,
9610 .init_hook = alc262_fujitsu_init_hook,
9613 .mixers = { alc262_HP_BPC_mixer },
9614 .init_verbs = { alc262_HP_BPC_init_verbs },
9615 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9616 .dac_nids = alc262_dac_nids,
9618 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9619 .channel_mode = alc262_modes,
9620 .input_mux = &alc262_HP_capture_source,
9621 .unsol_event = alc262_hp_bpc_unsol_event,
9622 .init_hook = alc262_hp_bpc_automute,
9624 [ALC262_HP_BPC_D7000_WF] = {
9625 .mixers = { alc262_HP_BPC_WildWest_mixer },
9626 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9627 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9628 .dac_nids = alc262_dac_nids,
9630 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9631 .channel_mode = alc262_modes,
9632 .input_mux = &alc262_HP_D7000_capture_source,
9633 .unsol_event = alc262_hp_wildwest_unsol_event,
9634 .init_hook = alc262_hp_wildwest_automute,
9636 [ALC262_HP_BPC_D7000_WL] = {
9637 .mixers = { alc262_HP_BPC_WildWest_mixer,
9638 alc262_HP_BPC_WildWest_option_mixer },
9639 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9640 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9641 .dac_nids = alc262_dac_nids,
9643 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9644 .channel_mode = alc262_modes,
9645 .input_mux = &alc262_HP_D7000_capture_source,
9646 .unsol_event = alc262_hp_wildwest_unsol_event,
9647 .init_hook = alc262_hp_wildwest_automute,
9649 [ALC262_HP_TC_T5735] = {
9650 .mixers = { alc262_hp_t5735_mixer },
9651 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9652 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9653 .dac_nids = alc262_dac_nids,
9655 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9656 .channel_mode = alc262_modes,
9657 .input_mux = &alc262_capture_source,
9658 .unsol_event = alc262_hp_t5735_unsol_event,
9659 .init_hook = alc262_hp_t5735_init_hook,
9661 [ALC262_HP_RP5700] = {
9662 .mixers = { alc262_hp_rp5700_mixer },
9663 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9664 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9665 .dac_nids = alc262_dac_nids,
9666 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9667 .channel_mode = alc262_modes,
9668 .input_mux = &alc262_hp_rp5700_capture_source,
9670 [ALC262_BENQ_ED8] = {
9671 .mixers = { alc262_base_mixer },
9672 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9673 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9674 .dac_nids = alc262_dac_nids,
9676 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9677 .channel_mode = alc262_modes,
9678 .input_mux = &alc262_capture_source,
9680 [ALC262_SONY_ASSAMD] = {
9681 .mixers = { alc262_sony_mixer },
9682 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9683 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9684 .dac_nids = alc262_dac_nids,
9686 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9687 .channel_mode = alc262_modes,
9688 .input_mux = &alc262_capture_source,
9689 .unsol_event = alc262_hippo_unsol_event,
9690 .init_hook = alc262_hippo_automute,
9692 [ALC262_BENQ_T31] = {
9693 .mixers = { alc262_benq_t31_mixer },
9694 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9695 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9696 .dac_nids = alc262_dac_nids,
9698 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9699 .channel_mode = alc262_modes,
9700 .input_mux = &alc262_capture_source,
9701 .unsol_event = alc262_hippo_unsol_event,
9702 .init_hook = alc262_hippo_automute,
9705 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9706 .init_verbs = { alc262_ultra_verbs },
9707 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9708 .dac_nids = alc262_dac_nids,
9709 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9710 .channel_mode = alc262_modes,
9711 .input_mux = &alc262_ultra_capture_source,
9712 .adc_nids = alc262_adc_nids, /* ADC0 */
9713 .capsrc_nids = alc262_capsrc_nids,
9714 .num_adc_nids = 1, /* single ADC */
9715 .unsol_event = alc262_ultra_unsol_event,
9716 .init_hook = alc262_ultra_automute,
9718 [ALC262_LENOVO_3000] = {
9719 .mixers = { alc262_lenovo_3000_mixer },
9720 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9721 alc262_lenovo_3000_unsol_verbs },
9722 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9723 .dac_nids = alc262_dac_nids,
9725 .dig_out_nid = ALC262_DIGOUT_NID,
9726 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9727 .channel_mode = alc262_modes,
9728 .input_mux = &alc262_fujitsu_capture_source,
9729 .unsol_event = alc262_lenovo_3000_unsol_event,
9733 static int patch_alc262(struct hda_codec *codec)
9735 struct alc_spec *spec;
9739 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9745 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9750 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9751 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9752 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9753 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9757 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9761 if (board_config < 0) {
9762 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9763 "trying auto-probe from BIOS...\n");
9764 board_config = ALC262_AUTO;
9767 if (board_config == ALC262_AUTO) {
9768 /* automatic parse from the BIOS config */
9769 err = alc262_parse_auto_config(codec);
9775 "hda_codec: Cannot set up configuration "
9776 "from BIOS. Using base mode...\n");
9777 board_config = ALC262_BASIC;
9781 if (board_config != ALC262_AUTO)
9782 setup_preset(spec, &alc262_presets[board_config]);
9784 spec->stream_name_analog = "ALC262 Analog";
9785 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9786 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9788 spec->stream_name_digital = "ALC262 Digital";
9789 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9790 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9792 if (!spec->adc_nids && spec->input_mux) {
9793 /* check whether NID 0x07 is valid */
9794 unsigned int wcap = get_wcaps(codec, 0x07);
9797 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9798 if (wcap != AC_WID_AUD_IN) {
9799 spec->adc_nids = alc262_adc_nids_alt;
9800 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9801 spec->capsrc_nids = alc262_capsrc_nids_alt;
9802 spec->mixers[spec->num_mixers] =
9803 alc262_capture_alt_mixer;
9806 spec->adc_nids = alc262_adc_nids;
9807 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9808 spec->capsrc_nids = alc262_capsrc_nids;
9809 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9814 spec->vmaster_nid = 0x0c;
9816 codec->patch_ops = alc_patch_ops;
9817 if (board_config == ALC262_AUTO)
9818 spec->init_hook = alc262_auto_init;
9819 #ifdef CONFIG_SND_HDA_POWER_SAVE
9820 if (!spec->loopback.amplist)
9821 spec->loopback.amplist = alc262_loopbacks;
9828 * ALC268 channel source setting (2 channel)
9830 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9831 #define alc268_modes alc260_modes
9833 static hda_nid_t alc268_dac_nids[2] = {
9838 static hda_nid_t alc268_adc_nids[2] = {
9843 static hda_nid_t alc268_adc_nids_alt[1] = {
9848 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
9850 static struct snd_kcontrol_new alc268_base_mixer[] = {
9851 /* output mixer control */
9852 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9853 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9854 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9855 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9856 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9857 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9858 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9862 /* bind Beep switches of both NID 0x0f and 0x10 */
9863 static struct hda_bind_ctls alc268_bind_beep_sw = {
9864 .ops = &snd_hda_bind_sw,
9866 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9867 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9872 static struct snd_kcontrol_new alc268_beep_mixer[] = {
9873 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9874 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9878 static struct hda_verb alc268_eapd_verbs[] = {
9879 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9880 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9884 /* Toshiba specific */
9885 #define alc268_toshiba_automute alc262_hippo_automute
9887 static struct hda_verb alc268_toshiba_verbs[] = {
9888 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9893 /* bind volumes of both NID 0x02 and 0x03 */
9894 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9895 .ops = &snd_hda_bind_vol,
9897 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9898 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9903 /* mute/unmute internal speaker according to the hp jack and mute state */
9904 static void alc268_acer_automute(struct hda_codec *codec, int force)
9906 struct alc_spec *spec = codec->spec;
9909 if (force || !spec->sense_updated) {
9910 unsigned int present;
9911 present = snd_hda_codec_read(codec, 0x14, 0,
9912 AC_VERB_GET_PIN_SENSE, 0);
9913 spec->jack_present = (present & 0x80000000) != 0;
9914 spec->sense_updated = 1;
9916 if (spec->jack_present)
9917 mute = HDA_AMP_MUTE; /* mute internal speaker */
9918 else /* unmute internal speaker if necessary */
9919 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9920 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9921 HDA_AMP_MUTE, mute);
9925 /* bind hp and internal speaker mute (with plug check) */
9926 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9927 struct snd_ctl_elem_value *ucontrol)
9929 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9930 long *valp = ucontrol->value.integer.value;
9933 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9935 valp[0] ? 0 : HDA_AMP_MUTE);
9936 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9938 valp[1] ? 0 : HDA_AMP_MUTE);
9940 alc268_acer_automute(codec, 0);
9944 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9945 /* output mixer control */
9946 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9948 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9949 .name = "Master Playback Switch",
9950 .info = snd_hda_mixer_amp_switch_info,
9951 .get = snd_hda_mixer_amp_switch_get,
9952 .put = alc268_acer_master_sw_put,
9953 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9955 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9956 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9957 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9961 static struct hda_verb alc268_acer_verbs[] = {
9962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
9963 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9966 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9967 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9969 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9973 /* unsolicited event for HP jack sensing */
9974 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9977 if ((res >> 26) != ALC880_HP_EVENT)
9979 alc268_toshiba_automute(codec);
9982 static void alc268_acer_unsol_event(struct hda_codec *codec,
9985 if ((res >> 26) != ALC880_HP_EVENT)
9987 alc268_acer_automute(codec, 1);
9990 static void alc268_acer_init_hook(struct hda_codec *codec)
9992 alc268_acer_automute(codec, 1);
9995 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9996 /* output mixer control */
9997 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9998 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9999 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10002 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10006 static struct hda_verb alc268_dell_verbs[] = {
10007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10013 /* mute/unmute internal speaker according to the hp jack and mute state */
10014 static void alc268_dell_automute(struct hda_codec *codec)
10016 unsigned int present;
10019 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10020 if (present & 0x80000000)
10021 mute = HDA_AMP_MUTE;
10023 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10024 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10025 HDA_AMP_MUTE, mute);
10028 static void alc268_dell_unsol_event(struct hda_codec *codec,
10031 if ((res >> 26) != ALC880_HP_EVENT)
10033 alc268_dell_automute(codec);
10036 #define alc268_dell_init_hook alc268_dell_automute
10038 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10040 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10041 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10043 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10044 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10045 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10046 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10050 static struct hda_verb alc267_quanta_il1_verbs[] = {
10051 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10052 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10056 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10058 unsigned int present;
10060 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10061 & AC_PINSENSE_PRESENCE;
10062 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10063 present ? 0 : PIN_OUT);
10066 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10068 unsigned int present;
10070 present = snd_hda_codec_read(codec, 0x18, 0,
10071 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10072 snd_hda_codec_write(codec, 0x23, 0,
10073 AC_VERB_SET_CONNECT_SEL,
10074 present ? 0x00 : 0x01);
10077 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10079 alc267_quanta_il1_hp_automute(codec);
10080 alc267_quanta_il1_mic_automute(codec);
10083 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10086 switch (res >> 26) {
10087 case ALC880_HP_EVENT:
10088 alc267_quanta_il1_hp_automute(codec);
10090 case ALC880_MIC_EVENT:
10091 alc267_quanta_il1_mic_automute(codec);
10097 * generic initialization of ADC, input mixers and output mixers
10099 static struct hda_verb alc268_base_init_verbs[] = {
10100 /* Unmute DAC0-1 and set vol = 0 */
10101 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10102 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10103 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10104 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10105 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10106 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10109 * Set up output mixers (0x0c - 0x0e)
10111 /* set vol=0 to output mixers */
10112 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10114 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10115 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10117 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10118 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10120 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10121 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10122 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10123 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10124 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10125 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10126 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10127 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10129 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10131 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10133 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10134 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10135 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10137 /* set PCBEEP vol = 0, mute connections */
10138 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10139 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10140 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10142 /* Unmute Selector 23h,24h and set the default input to mic-in */
10144 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10145 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10146 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10153 * generic initialization of ADC, input mixers and output mixers
10155 static struct hda_verb alc268_volume_init_verbs[] = {
10156 /* set output DAC */
10157 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10158 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10159 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10160 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10162 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10163 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10164 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10165 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10166 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10168 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10169 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10171 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10172 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10174 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10175 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10176 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10177 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10179 /* set PCBEEP vol = 0, mute connections */
10180 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10181 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10182 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10187 #define alc268_mux_enum_info alc_mux_enum_info
10188 #define alc268_mux_enum_get alc_mux_enum_get
10189 #define alc268_mux_enum_put alc_mux_enum_put
10191 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10192 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10193 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10196 /* The multiple "Capture Source" controls confuse alsamixer
10197 * So call somewhat different..
10199 /* .name = "Capture Source", */
10200 .name = "Input Source",
10202 .info = alc268_mux_enum_info,
10203 .get = alc268_mux_enum_get,
10204 .put = alc268_mux_enum_put,
10209 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10210 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10211 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10212 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10213 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10216 /* The multiple "Capture Source" controls confuse alsamixer
10217 * So call somewhat different..
10219 /* .name = "Capture Source", */
10220 .name = "Input Source",
10222 .info = alc268_mux_enum_info,
10223 .get = alc268_mux_enum_get,
10224 .put = alc268_mux_enum_put,
10229 static struct hda_input_mux alc268_capture_source = {
10233 { "Front Mic", 0x1 },
10239 static struct hda_input_mux alc268_acer_capture_source = {
10243 { "Internal Mic", 0x6 },
10248 #ifdef CONFIG_SND_DEBUG
10249 static struct snd_kcontrol_new alc268_test_mixer[] = {
10250 /* Volume widgets */
10251 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10252 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10253 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10254 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10255 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10256 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10257 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10258 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10259 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10260 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10261 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10262 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10263 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10264 /* The below appears problematic on some hardwares */
10265 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10266 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10267 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10268 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10269 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10271 /* Modes for retasking pin widgets */
10272 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10273 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10274 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10275 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10277 /* Controls for GPIO pins, assuming they are configured as outputs */
10278 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10279 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10280 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10281 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10283 /* Switches to allow the digital SPDIF output pin to be enabled.
10284 * The ALC268 does not have an SPDIF input.
10286 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10288 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10289 * this output to turn on an external amplifier.
10291 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10292 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10298 /* create input playback/capture controls for the given pin */
10299 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10300 const char *ctlname, int idx)
10305 sprintf(name, "%s Playback Volume", ctlname);
10307 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10308 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10312 } else if (nid == 0x15) {
10313 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10314 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10320 sprintf(name, "%s Playback Switch", ctlname);
10321 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10322 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10328 /* add playback controls from the parsed DAC table */
10329 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10330 const struct auto_pin_cfg *cfg)
10335 spec->multiout.num_dacs = 2; /* only use one dac */
10336 spec->multiout.dac_nids = spec->private_dac_nids;
10337 spec->multiout.dac_nids[0] = 2;
10338 spec->multiout.dac_nids[1] = 3;
10340 nid = cfg->line_out_pins[0];
10342 alc268_new_analog_output(spec, nid, "Front", 0);
10344 nid = cfg->speaker_pins[0];
10346 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10347 "Speaker Playback Volume",
10348 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10352 nid = cfg->hp_pins[0];
10354 alc268_new_analog_output(spec, nid, "Headphone", 0);
10356 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10358 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10359 "Mono Playback Switch",
10360 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10367 /* create playback/capture controls for input pins */
10368 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10369 const struct auto_pin_cfg *cfg)
10371 struct hda_input_mux *imux = &spec->private_imux;
10374 for (i = 0; i < AUTO_PIN_LAST; i++) {
10375 switch(cfg->input_pins[i]) {
10377 idx1 = 0; /* Mic 1 */
10380 idx1 = 1; /* Mic 2 */
10383 idx1 = 2; /* Line In */
10390 idx1 = 6; /* digital mics */
10395 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10396 imux->items[imux->num_items].index = idx1;
10402 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10404 struct alc_spec *spec = codec->spec;
10405 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10406 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10407 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10408 unsigned int dac_vol1, dac_vol2;
10411 snd_hda_codec_write(codec, speaker_nid, 0,
10412 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10413 snd_hda_codec_write(codec, 0x0f, 0,
10414 AC_VERB_SET_AMP_GAIN_MUTE,
10416 snd_hda_codec_write(codec, 0x10, 0,
10417 AC_VERB_SET_AMP_GAIN_MUTE,
10420 snd_hda_codec_write(codec, 0x0f, 0,
10421 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10422 snd_hda_codec_write(codec, 0x10, 0,
10423 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10426 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10427 if (line_nid == 0x14)
10428 dac_vol2 = AMP_OUT_ZERO;
10429 else if (line_nid == 0x15)
10430 dac_vol1 = AMP_OUT_ZERO;
10431 if (hp_nid == 0x14)
10432 dac_vol2 = AMP_OUT_ZERO;
10433 else if (hp_nid == 0x15)
10434 dac_vol1 = AMP_OUT_ZERO;
10435 if (line_nid != 0x16 || hp_nid != 0x16 ||
10436 spec->autocfg.line_out_pins[1] != 0x16 ||
10437 spec->autocfg.line_out_pins[2] != 0x16)
10438 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10440 snd_hda_codec_write(codec, 0x02, 0,
10441 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10442 snd_hda_codec_write(codec, 0x03, 0,
10443 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10446 /* pcm configuration: identiacal with ALC880 */
10447 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10448 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10449 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10450 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10453 * BIOS auto configuration
10455 static int alc268_parse_auto_config(struct hda_codec *codec)
10457 struct alc_spec *spec = codec->spec;
10459 static hda_nid_t alc268_ignore[] = { 0 };
10461 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10465 if (!spec->autocfg.line_outs)
10466 return 0; /* can't find valid BIOS pin config */
10468 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10471 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10475 spec->multiout.max_channels = 2;
10477 /* digital only support output */
10478 if (spec->autocfg.dig_out_pin)
10479 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10481 if (spec->kctl_alloc)
10482 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10484 if (spec->autocfg.speaker_pins[0] != 0x1d)
10485 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10487 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10488 spec->num_mux_defs = 1;
10489 spec->input_mux = &spec->private_imux;
10491 err = alc_auto_add_mic_boost(codec);
10498 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10499 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10500 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10502 /* init callback for auto-configuration model -- overriding the default init */
10503 static void alc268_auto_init(struct hda_codec *codec)
10505 struct alc_spec *spec = codec->spec;
10506 alc268_auto_init_multi_out(codec);
10507 alc268_auto_init_hp_out(codec);
10508 alc268_auto_init_mono_speaker_out(codec);
10509 alc268_auto_init_analog_input(codec);
10510 if (spec->unsol_event)
10511 alc_sku_automute(codec);
10515 * configuration and preset
10517 static const char *alc268_models[ALC268_MODEL_LAST] = {
10518 [ALC267_QUANTA_IL1] = "quanta-il1",
10519 [ALC268_3ST] = "3stack",
10520 [ALC268_TOSHIBA] = "toshiba",
10521 [ALC268_ACER] = "acer",
10522 [ALC268_DELL] = "dell",
10523 [ALC268_ZEPTO] = "zepto",
10524 #ifdef CONFIG_SND_DEBUG
10525 [ALC268_TEST] = "test",
10527 [ALC268_AUTO] = "auto",
10530 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10531 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10532 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10533 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10534 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10535 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10536 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10537 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10538 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10539 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10540 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10541 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
10542 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10543 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10544 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10548 static struct alc_config_preset alc268_presets[] = {
10549 [ALC267_QUANTA_IL1] = {
10550 .mixers = { alc267_quanta_il1_mixer },
10551 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10552 alc267_quanta_il1_verbs },
10553 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10554 .dac_nids = alc268_dac_nids,
10555 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10556 .adc_nids = alc268_adc_nids_alt,
10558 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10559 .channel_mode = alc268_modes,
10560 .input_mux = &alc268_capture_source,
10561 .unsol_event = alc267_quanta_il1_unsol_event,
10562 .init_hook = alc267_quanta_il1_automute,
10565 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10566 alc268_beep_mixer },
10567 .init_verbs = { alc268_base_init_verbs },
10568 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10569 .dac_nids = alc268_dac_nids,
10570 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10571 .adc_nids = alc268_adc_nids_alt,
10572 .capsrc_nids = alc268_capsrc_nids,
10574 .dig_out_nid = ALC268_DIGOUT_NID,
10575 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10576 .channel_mode = alc268_modes,
10577 .input_mux = &alc268_capture_source,
10579 [ALC268_TOSHIBA] = {
10580 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10581 alc268_beep_mixer },
10582 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10583 alc268_toshiba_verbs },
10584 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10585 .dac_nids = alc268_dac_nids,
10586 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10587 .adc_nids = alc268_adc_nids_alt,
10588 .capsrc_nids = alc268_capsrc_nids,
10590 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10591 .channel_mode = alc268_modes,
10592 .input_mux = &alc268_capture_source,
10593 .unsol_event = alc268_toshiba_unsol_event,
10594 .init_hook = alc268_toshiba_automute,
10597 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10598 alc268_beep_mixer },
10599 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10600 alc268_acer_verbs },
10601 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10602 .dac_nids = alc268_dac_nids,
10603 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10604 .adc_nids = alc268_adc_nids_alt,
10605 .capsrc_nids = alc268_capsrc_nids,
10607 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10608 .channel_mode = alc268_modes,
10609 .input_mux = &alc268_acer_capture_source,
10610 .unsol_event = alc268_acer_unsol_event,
10611 .init_hook = alc268_acer_init_hook,
10614 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10615 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10616 alc268_dell_verbs },
10617 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10618 .dac_nids = alc268_dac_nids,
10620 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10621 .channel_mode = alc268_modes,
10622 .unsol_event = alc268_dell_unsol_event,
10623 .init_hook = alc268_dell_init_hook,
10624 .input_mux = &alc268_capture_source,
10627 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10628 alc268_beep_mixer },
10629 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10630 alc268_toshiba_verbs },
10631 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10632 .dac_nids = alc268_dac_nids,
10633 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10634 .adc_nids = alc268_adc_nids_alt,
10635 .capsrc_nids = alc268_capsrc_nids,
10637 .dig_out_nid = ALC268_DIGOUT_NID,
10638 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10639 .channel_mode = alc268_modes,
10640 .input_mux = &alc268_capture_source,
10641 .unsol_event = alc268_toshiba_unsol_event,
10642 .init_hook = alc268_toshiba_automute
10644 #ifdef CONFIG_SND_DEBUG
10646 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10647 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10648 alc268_volume_init_verbs },
10649 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10650 .dac_nids = alc268_dac_nids,
10651 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10652 .adc_nids = alc268_adc_nids_alt,
10653 .capsrc_nids = alc268_capsrc_nids,
10655 .dig_out_nid = ALC268_DIGOUT_NID,
10656 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10657 .channel_mode = alc268_modes,
10658 .input_mux = &alc268_capture_source,
10663 static int patch_alc268(struct hda_codec *codec)
10665 struct alc_spec *spec;
10669 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10673 codec->spec = spec;
10675 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10679 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10680 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10681 "trying auto-probe from BIOS...\n");
10682 board_config = ALC268_AUTO;
10685 if (board_config == ALC268_AUTO) {
10686 /* automatic parse from the BIOS config */
10687 err = alc268_parse_auto_config(codec);
10693 "hda_codec: Cannot set up configuration "
10694 "from BIOS. Using base mode...\n");
10695 board_config = ALC268_3ST;
10699 if (board_config != ALC268_AUTO)
10700 setup_preset(spec, &alc268_presets[board_config]);
10702 if (codec->vendor_id == 0x10ec0267) {
10703 spec->stream_name_analog = "ALC267 Analog";
10704 spec->stream_name_digital = "ALC267 Digital";
10706 spec->stream_name_analog = "ALC268 Analog";
10707 spec->stream_name_digital = "ALC268 Digital";
10710 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10711 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10712 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10714 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10716 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10717 /* override the amp caps for beep generator */
10718 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10719 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10720 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10721 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10722 (0 << AC_AMPCAP_MUTE_SHIFT));
10724 if (!spec->adc_nids && spec->input_mux) {
10725 /* check whether NID 0x07 is valid */
10726 unsigned int wcap = get_wcaps(codec, 0x07);
10730 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10731 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10732 spec->adc_nids = alc268_adc_nids_alt;
10733 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10734 spec->mixers[spec->num_mixers] =
10735 alc268_capture_alt_mixer;
10736 spec->num_mixers++;
10738 spec->adc_nids = alc268_adc_nids;
10739 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10740 spec->mixers[spec->num_mixers] =
10741 alc268_capture_mixer;
10742 spec->num_mixers++;
10744 spec->capsrc_nids = alc268_capsrc_nids;
10745 /* set default input source */
10746 for (i = 0; i < spec->num_adc_nids; i++)
10747 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10748 0, AC_VERB_SET_CONNECT_SEL,
10749 spec->input_mux->items[0].index);
10752 spec->vmaster_nid = 0x02;
10754 codec->patch_ops = alc_patch_ops;
10755 if (board_config == ALC268_AUTO)
10756 spec->init_hook = alc268_auto_init;
10762 * ALC269 channel source setting (2 channel)
10764 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10766 #define alc269_dac_nids alc260_dac_nids
10768 static hda_nid_t alc269_adc_nids[1] = {
10773 #define alc269_modes alc260_modes
10774 #define alc269_capture_source alc880_lg_lw_capture_source
10776 static struct snd_kcontrol_new alc269_base_mixer[] = {
10777 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10778 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10779 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10780 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10782 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10783 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10785 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10786 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10787 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10788 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10792 /* capture mixer elements */
10793 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10794 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10795 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10797 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10798 /* The multiple "Capture Source" controls confuse alsamixer
10799 * So call somewhat different..
10801 /* .name = "Capture Source", */
10802 .name = "Input Source",
10804 .info = alc_mux_enum_info,
10805 .get = alc_mux_enum_get,
10806 .put = alc_mux_enum_put,
10812 * generic initialization of ADC, input mixers and output mixers
10814 static struct hda_verb alc269_init_verbs[] = {
10816 * Unmute ADC0 and set the default input to mic-in
10818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10820 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10821 * analog-loopback mixer widget
10822 * Note: PASD motherboards uses the Line In 2 as the input for
10823 * front panel mic (mic 2)
10825 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10833 * Set up output mixers (0x0c - 0x0e)
10835 /* set vol=0 to output mixers */
10836 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10837 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10839 /* set up input amps for analog loopback */
10840 /* Amp Indices: DAC = 0, mixer = 1 */
10841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10848 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10849 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10850 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10851 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10852 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10853 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10854 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10856 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10857 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10858 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10859 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10860 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10861 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10862 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10864 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10865 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10867 /* FIXME: use matrix-type input source selection */
10868 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10869 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10870 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10871 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10872 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10873 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10876 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10877 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10881 /* add playback controls from the parsed DAC table */
10882 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10883 const struct auto_pin_cfg *cfg)
10888 spec->multiout.num_dacs = 1; /* only use one dac */
10889 spec->multiout.dac_nids = spec->private_dac_nids;
10890 spec->multiout.dac_nids[0] = 2;
10892 nid = cfg->line_out_pins[0];
10894 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10895 "Front Playback Volume",
10896 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10899 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10900 "Front Playback Switch",
10901 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10906 nid = cfg->speaker_pins[0];
10908 if (!cfg->line_out_pins[0]) {
10909 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10910 "Speaker Playback Volume",
10911 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10917 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10918 "Speaker Playback Switch",
10919 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10924 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10925 "Speaker Playback Switch",
10926 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10932 nid = cfg->hp_pins[0];
10934 /* spec->multiout.hp_nid = 2; */
10935 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10936 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10937 "Headphone Playback Volume",
10938 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10944 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10945 "Headphone Playback Switch",
10946 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10951 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10952 "Headphone Playback Switch",
10953 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10962 #define alc269_auto_create_analog_input_ctls \
10963 alc880_auto_create_analog_input_ctls
10965 #ifdef CONFIG_SND_HDA_POWER_SAVE
10966 #define alc269_loopbacks alc880_loopbacks
10969 /* pcm configuration: identiacal with ALC880 */
10970 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10971 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10972 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10973 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10976 * BIOS auto configuration
10978 static int alc269_parse_auto_config(struct hda_codec *codec)
10980 struct alc_spec *spec = codec->spec;
10982 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10984 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10989 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10992 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10996 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10998 if (spec->autocfg.dig_out_pin)
10999 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
11001 if (spec->kctl_alloc)
11002 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11004 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
11005 spec->num_mux_defs = 1;
11006 spec->input_mux = &spec->private_imux;
11008 err = alc_auto_add_mic_boost(codec);
11015 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11016 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11017 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11020 /* init callback for auto-configuration model -- overriding the default init */
11021 static void alc269_auto_init(struct hda_codec *codec)
11023 struct alc_spec *spec = codec->spec;
11024 alc269_auto_init_multi_out(codec);
11025 alc269_auto_init_hp_out(codec);
11026 alc269_auto_init_analog_input(codec);
11027 if (spec->unsol_event)
11028 alc_sku_automute(codec);
11032 * configuration and preset
11034 static const char *alc269_models[ALC269_MODEL_LAST] = {
11035 [ALC269_BASIC] = "basic",
11038 static struct snd_pci_quirk alc269_cfg_tbl[] = {
11042 static struct alc_config_preset alc269_presets[] = {
11044 .mixers = { alc269_base_mixer },
11045 .init_verbs = { alc269_init_verbs },
11046 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11047 .dac_nids = alc269_dac_nids,
11049 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11050 .channel_mode = alc269_modes,
11051 .input_mux = &alc269_capture_source,
11055 static int patch_alc269(struct hda_codec *codec)
11057 struct alc_spec *spec;
11061 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11065 codec->spec = spec;
11067 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11071 if (board_config < 0) {
11072 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11073 "trying auto-probe from BIOS...\n");
11074 board_config = ALC269_AUTO;
11077 if (board_config == ALC269_AUTO) {
11078 /* automatic parse from the BIOS config */
11079 err = alc269_parse_auto_config(codec);
11085 "hda_codec: Cannot set up configuration "
11086 "from BIOS. Using base mode...\n");
11087 board_config = ALC269_BASIC;
11091 if (board_config != ALC269_AUTO)
11092 setup_preset(spec, &alc269_presets[board_config]);
11094 spec->stream_name_analog = "ALC269 Analog";
11095 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11096 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11098 spec->stream_name_digital = "ALC269 Digital";
11099 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11100 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11102 spec->adc_nids = alc269_adc_nids;
11103 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11104 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11105 spec->num_mixers++;
11107 codec->patch_ops = alc_patch_ops;
11108 if (board_config == ALC269_AUTO)
11109 spec->init_hook = alc269_auto_init;
11110 #ifdef CONFIG_SND_HDA_POWER_SAVE
11111 if (!spec->loopback.amplist)
11112 spec->loopback.amplist = alc269_loopbacks;
11119 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11123 * set the path ways for 2 channel output
11124 * need to set the codec line out and mic 1 pin widgets to inputs
11126 static struct hda_verb alc861_threestack_ch2_init[] = {
11127 /* set pin widget 1Ah (line in) for input */
11128 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11129 /* set pin widget 18h (mic1/2) for input, for mic also enable
11132 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11134 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11136 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11137 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11143 * need to set the codec line out and mic 1 pin widgets to outputs
11145 static struct hda_verb alc861_threestack_ch6_init[] = {
11146 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11147 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11148 /* set pin widget 18h (mic1) for output (CLFE)*/
11149 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11151 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11152 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11154 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11156 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11157 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11162 static struct hda_channel_mode alc861_threestack_modes[2] = {
11163 { 2, alc861_threestack_ch2_init },
11164 { 6, alc861_threestack_ch6_init },
11166 /* Set mic1 as input and unmute the mixer */
11167 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11168 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11169 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11172 /* Set mic1 as output and mute mixer */
11173 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11174 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11175 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11179 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11180 { 2, alc861_uniwill_m31_ch2_init },
11181 { 4, alc861_uniwill_m31_ch4_init },
11184 /* Set mic1 and line-in as input and unmute the mixer */
11185 static struct hda_verb alc861_asus_ch2_init[] = {
11186 /* set pin widget 1Ah (line in) for input */
11187 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11188 /* set pin widget 18h (mic1/2) for input, for mic also enable
11191 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11193 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11195 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11196 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11200 /* Set mic1 nad line-in as output and mute mixer */
11201 static struct hda_verb alc861_asus_ch6_init[] = {
11202 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11203 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11204 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11205 /* set pin widget 18h (mic1) for output (CLFE)*/
11206 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11207 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11208 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11209 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11211 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11213 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11214 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11219 static struct hda_channel_mode alc861_asus_modes[2] = {
11220 { 2, alc861_asus_ch2_init },
11221 { 6, alc861_asus_ch6_init },
11226 static struct snd_kcontrol_new alc861_base_mixer[] = {
11227 /* output mixer control */
11228 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11229 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11230 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11231 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11232 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11234 /*Input mixer control */
11235 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11236 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11237 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11238 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11239 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11240 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11242 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11243 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11246 /* Capture mixer control */
11247 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11248 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11250 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11251 .name = "Capture Source",
11253 .info = alc_mux_enum_info,
11254 .get = alc_mux_enum_get,
11255 .put = alc_mux_enum_put,
11260 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11261 /* output mixer control */
11262 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11263 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11264 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11265 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11266 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11268 /* Input mixer control */
11269 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11270 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11271 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11272 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11273 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11274 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11276 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11277 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11278 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11280 /* Capture mixer control */
11281 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11282 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11284 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11285 .name = "Capture Source",
11287 .info = alc_mux_enum_info,
11288 .get = alc_mux_enum_get,
11289 .put = alc_mux_enum_put,
11292 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11293 .name = "Channel Mode",
11294 .info = alc_ch_mode_info,
11295 .get = alc_ch_mode_get,
11296 .put = alc_ch_mode_put,
11297 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11302 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11303 /* output mixer control */
11304 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11306 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11308 /*Capture mixer control */
11309 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11310 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11312 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11313 .name = "Capture Source",
11315 .info = alc_mux_enum_info,
11316 .get = alc_mux_enum_get,
11317 .put = alc_mux_enum_put,
11323 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11324 /* output mixer control */
11325 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11326 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11327 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11328 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11329 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11331 /* Input mixer control */
11332 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11333 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11334 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11335 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11336 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11337 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11339 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11340 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11343 /* Capture mixer control */
11344 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11345 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11348 .name = "Capture Source",
11350 .info = alc_mux_enum_info,
11351 .get = alc_mux_enum_get,
11352 .put = alc_mux_enum_put,
11355 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11356 .name = "Channel Mode",
11357 .info = alc_ch_mode_info,
11358 .get = alc_ch_mode_get,
11359 .put = alc_ch_mode_put,
11360 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11365 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11366 /* output mixer control */
11367 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11368 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11369 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11370 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11371 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11373 /* Input mixer control */
11374 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11375 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11376 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11377 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11378 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11379 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11381 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11382 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11383 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11385 /* Capture mixer control */
11386 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11387 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11389 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11390 .name = "Capture Source",
11392 .info = alc_mux_enum_info,
11393 .get = alc_mux_enum_get,
11394 .put = alc_mux_enum_put,
11397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11398 .name = "Channel Mode",
11399 .info = alc_ch_mode_info,
11400 .get = alc_ch_mode_get,
11401 .put = alc_ch_mode_put,
11402 .private_value = ARRAY_SIZE(alc861_asus_modes),
11407 /* additional mixer */
11408 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11409 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11410 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11411 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11412 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11417 * generic initialization of ADC, input mixers and output mixers
11419 static struct hda_verb alc861_base_init_verbs[] = {
11421 * Unmute ADC0 and set the default input to mic-in
11423 /* port-A for surround (rear panel) */
11424 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11425 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11426 /* port-B for mic-in (rear panel) with vref */
11427 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11428 /* port-C for line-in (rear panel) */
11429 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11430 /* port-D for Front */
11431 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11432 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11433 /* port-E for HP out (front panel) */
11434 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11435 /* route front PCM to HP */
11436 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11437 /* port-F for mic-in (front panel) with vref */
11438 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11439 /* port-G for CLFE (rear panel) */
11440 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11441 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11442 /* port-H for side (rear panel) */
11443 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11444 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11446 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11447 /* route front mic to ADC1*/
11448 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11451 /* Unmute DAC0~3 & spdif out*/
11452 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11453 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11454 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11455 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11458 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11459 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11460 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11461 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11462 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11464 /* Unmute Stereo Mixer 15 */
11465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11470 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11471 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11472 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11473 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11474 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11475 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11476 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11477 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11478 /* hp used DAC 3 (Front) */
11479 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11480 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11485 static struct hda_verb alc861_threestack_init_verbs[] = {
11487 * Unmute ADC0 and set the default input to mic-in
11489 /* port-A for surround (rear panel) */
11490 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11491 /* port-B for mic-in (rear panel) with vref */
11492 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11493 /* port-C for line-in (rear panel) */
11494 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11495 /* port-D for Front */
11496 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11497 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11498 /* port-E for HP out (front panel) */
11499 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11500 /* route front PCM to HP */
11501 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11502 /* port-F for mic-in (front panel) with vref */
11503 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11504 /* port-G for CLFE (rear panel) */
11505 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11506 /* port-H for side (rear panel) */
11507 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11509 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11510 /* route front mic to ADC1*/
11511 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11512 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11513 /* Unmute DAC0~3 & spdif out*/
11514 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11515 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11516 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11517 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11520 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11521 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11522 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11523 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11524 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11526 /* Unmute Stereo Mixer 15 */
11527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11529 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11530 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11532 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11533 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11534 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11535 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11536 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11537 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11538 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11539 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11540 /* hp used DAC 3 (Front) */
11541 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11542 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11546 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11548 * Unmute ADC0 and set the default input to mic-in
11550 /* port-A for surround (rear panel) */
11551 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11552 /* port-B for mic-in (rear panel) with vref */
11553 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11554 /* port-C for line-in (rear panel) */
11555 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11556 /* port-D for Front */
11557 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11558 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11559 /* port-E for HP out (front panel) */
11560 /* this has to be set to VREF80 */
11561 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11562 /* route front PCM to HP */
11563 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11564 /* port-F for mic-in (front panel) with vref */
11565 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11566 /* port-G for CLFE (rear panel) */
11567 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11568 /* port-H for side (rear panel) */
11569 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11571 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11572 /* route front mic to ADC1*/
11573 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11575 /* Unmute DAC0~3 & spdif out*/
11576 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11577 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11578 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11579 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11582 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11583 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11584 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11585 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11586 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11588 /* Unmute Stereo Mixer 15 */
11589 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11591 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11594 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11595 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11596 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11597 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11598 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11599 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11600 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11601 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11602 /* hp used DAC 3 (Front) */
11603 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11604 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11608 static struct hda_verb alc861_asus_init_verbs[] = {
11610 * Unmute ADC0 and set the default input to mic-in
11612 /* port-A for surround (rear panel)
11613 * according to codec#0 this is the HP jack
11615 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11616 /* route front PCM to HP */
11617 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11618 /* port-B for mic-in (rear panel) with vref */
11619 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11620 /* port-C for line-in (rear panel) */
11621 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11622 /* port-D for Front */
11623 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11624 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11625 /* port-E for HP out (front panel) */
11626 /* this has to be set to VREF80 */
11627 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11628 /* route front PCM to HP */
11629 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11630 /* port-F for mic-in (front panel) with vref */
11631 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11632 /* port-G for CLFE (rear panel) */
11633 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11634 /* port-H for side (rear panel) */
11635 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11637 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11638 /* route front mic to ADC1*/
11639 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11640 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11641 /* Unmute DAC0~3 & spdif out*/
11642 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11643 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11644 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11645 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11647 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11648 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11649 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11650 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11651 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11653 /* Unmute Stereo Mixer 15 */
11654 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11656 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11657 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11659 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11660 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11661 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11662 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11663 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11664 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11665 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11666 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11667 /* hp used DAC 3 (Front) */
11668 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11673 /* additional init verbs for ASUS laptops */
11674 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11675 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11676 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11681 * generic initialization of ADC, input mixers and output mixers
11683 static struct hda_verb alc861_auto_init_verbs[] = {
11685 * Unmute ADC0 and set the default input to mic-in
11687 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11688 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11690 /* Unmute DAC0~3 & spdif out*/
11691 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11692 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11693 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11694 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11697 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11698 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11699 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11700 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11701 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11703 /* Unmute Stereo Mixer 15 */
11704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11709 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11710 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11711 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11712 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11713 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11714 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11715 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11716 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11718 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11719 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11720 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11721 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11722 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11723 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11724 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11725 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11727 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11732 static struct hda_verb alc861_toshiba_init_verbs[] = {
11733 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11738 /* toggle speaker-output according to the hp-jack state */
11739 static void alc861_toshiba_automute(struct hda_codec *codec)
11741 unsigned int present;
11743 present = snd_hda_codec_read(codec, 0x0f, 0,
11744 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11745 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11746 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11747 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11748 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11751 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11754 if ((res >> 26) == ALC880_HP_EVENT)
11755 alc861_toshiba_automute(codec);
11758 /* pcm configuration: identiacal with ALC880 */
11759 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11760 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11761 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11762 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11765 #define ALC861_DIGOUT_NID 0x07
11767 static struct hda_channel_mode alc861_8ch_modes[1] = {
11771 static hda_nid_t alc861_dac_nids[4] = {
11772 /* front, surround, clfe, side */
11773 0x03, 0x06, 0x05, 0x04
11776 static hda_nid_t alc660_dac_nids[3] = {
11777 /* front, clfe, surround */
11781 static hda_nid_t alc861_adc_nids[1] = {
11786 static struct hda_input_mux alc861_capture_source = {
11790 { "Front Mic", 0x3 },
11797 /* fill in the dac_nids table from the parsed pin configuration */
11798 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11799 const struct auto_pin_cfg *cfg)
11804 spec->multiout.dac_nids = spec->private_dac_nids;
11805 for (i = 0; i < cfg->line_outs; i++) {
11806 nid = cfg->line_out_pins[i];
11808 if (i >= ARRAY_SIZE(alc861_dac_nids))
11810 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11813 spec->multiout.num_dacs = cfg->line_outs;
11817 /* add playback controls from the parsed DAC table */
11818 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11819 const struct auto_pin_cfg *cfg)
11822 static const char *chname[4] = {
11823 "Front", "Surround", NULL /*CLFE*/, "Side"
11828 for (i = 0; i < cfg->line_outs; i++) {
11829 nid = spec->multiout.dac_nids[i];
11834 err = add_control(spec, ALC_CTL_BIND_MUTE,
11835 "Center Playback Switch",
11836 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11840 err = add_control(spec, ALC_CTL_BIND_MUTE,
11841 "LFE Playback Switch",
11842 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11847 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11849 if (nid == alc861_dac_nids[idx])
11851 sprintf(name, "%s Playback Switch", chname[idx]);
11852 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11853 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11862 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11870 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11872 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11873 "Headphone Playback Switch",
11874 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11877 spec->multiout.hp_nid = nid;
11882 /* create playback/capture controls for input pins */
11883 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11884 const struct auto_pin_cfg *cfg)
11886 struct hda_input_mux *imux = &spec->private_imux;
11887 int i, err, idx, idx1;
11889 for (i = 0; i < AUTO_PIN_LAST; i++) {
11890 switch (cfg->input_pins[i]) {
11893 idx = 2; /* Line In */
11897 idx = 2; /* Line In */
11901 idx = 1; /* Mic In */
11905 idx = 1; /* Mic In */
11915 err = new_analog_input(spec, cfg->input_pins[i],
11916 auto_pin_cfg_labels[i], idx, 0x15);
11920 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11921 imux->items[imux->num_items].index = idx1;
11927 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11928 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11929 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11932 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11933 /* The multiple "Capture Source" controls confuse alsamixer
11934 * So call somewhat different..
11936 /* .name = "Capture Source", */
11937 .name = "Input Source",
11939 .info = alc_mux_enum_info,
11940 .get = alc_mux_enum_get,
11941 .put = alc_mux_enum_put,
11946 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11948 int pin_type, int dac_idx)
11950 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11952 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11956 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11958 struct alc_spec *spec = codec->spec;
11961 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11962 for (i = 0; i < spec->autocfg.line_outs; i++) {
11963 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11964 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11966 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11967 spec->multiout.dac_nids[i]);
11971 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11973 struct alc_spec *spec = codec->spec;
11976 pin = spec->autocfg.hp_pins[0];
11977 if (pin) /* connect to front */
11978 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11979 spec->multiout.dac_nids[0]);
11980 pin = spec->autocfg.speaker_pins[0];
11982 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11985 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11987 struct alc_spec *spec = codec->spec;
11990 for (i = 0; i < AUTO_PIN_LAST; i++) {
11991 hda_nid_t nid = spec->autocfg.input_pins[i];
11992 if (nid >= 0x0c && nid <= 0x11) {
11993 snd_hda_codec_write(codec, nid, 0,
11994 AC_VERB_SET_PIN_WIDGET_CONTROL,
11995 i <= AUTO_PIN_FRONT_MIC ?
11996 PIN_VREF80 : PIN_IN);
12001 /* parse the BIOS configuration and set up the alc_spec */
12002 /* return 1 if successful, 0 if the proper config is not found,
12003 * or a negative error code
12005 static int alc861_parse_auto_config(struct hda_codec *codec)
12007 struct alc_spec *spec = codec->spec;
12009 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
12011 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12015 if (!spec->autocfg.line_outs)
12016 return 0; /* can't find valid BIOS pin config */
12018 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
12021 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
12024 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
12027 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
12031 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12033 if (spec->autocfg.dig_out_pin)
12034 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
12036 if (spec->kctl_alloc)
12037 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12039 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
12041 spec->num_mux_defs = 1;
12042 spec->input_mux = &spec->private_imux;
12044 spec->adc_nids = alc861_adc_nids;
12045 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12046 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12047 spec->num_mixers++;
12052 /* additional initialization for auto-configuration model */
12053 static void alc861_auto_init(struct hda_codec *codec)
12055 struct alc_spec *spec = codec->spec;
12056 alc861_auto_init_multi_out(codec);
12057 alc861_auto_init_hp_out(codec);
12058 alc861_auto_init_analog_input(codec);
12059 if (spec->unsol_event)
12060 alc_sku_automute(codec);
12063 #ifdef CONFIG_SND_HDA_POWER_SAVE
12064 static struct hda_amp_list alc861_loopbacks[] = {
12065 { 0x15, HDA_INPUT, 0 },
12066 { 0x15, HDA_INPUT, 1 },
12067 { 0x15, HDA_INPUT, 2 },
12068 { 0x15, HDA_INPUT, 3 },
12075 * configuration and preset
12077 static const char *alc861_models[ALC861_MODEL_LAST] = {
12078 [ALC861_3ST] = "3stack",
12079 [ALC660_3ST] = "3stack-660",
12080 [ALC861_3ST_DIG] = "3stack-dig",
12081 [ALC861_6ST_DIG] = "6stack-dig",
12082 [ALC861_UNIWILL_M31] = "uniwill-m31",
12083 [ALC861_TOSHIBA] = "toshiba",
12084 [ALC861_ASUS] = "asus",
12085 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12086 [ALC861_AUTO] = "auto",
12089 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12090 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12091 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12092 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12093 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12094 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12095 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12096 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12097 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12098 * Any other models that need this preset?
12100 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12101 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12102 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12103 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12104 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12105 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12106 /* FIXME: the below seems conflict */
12107 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12108 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12109 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12113 static struct alc_config_preset alc861_presets[] = {
12115 .mixers = { alc861_3ST_mixer },
12116 .init_verbs = { alc861_threestack_init_verbs },
12117 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12118 .dac_nids = alc861_dac_nids,
12119 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12120 .channel_mode = alc861_threestack_modes,
12122 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12123 .adc_nids = alc861_adc_nids,
12124 .input_mux = &alc861_capture_source,
12126 [ALC861_3ST_DIG] = {
12127 .mixers = { alc861_base_mixer },
12128 .init_verbs = { alc861_threestack_init_verbs },
12129 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12130 .dac_nids = alc861_dac_nids,
12131 .dig_out_nid = ALC861_DIGOUT_NID,
12132 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12133 .channel_mode = alc861_threestack_modes,
12135 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12136 .adc_nids = alc861_adc_nids,
12137 .input_mux = &alc861_capture_source,
12139 [ALC861_6ST_DIG] = {
12140 .mixers = { alc861_base_mixer },
12141 .init_verbs = { alc861_base_init_verbs },
12142 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12143 .dac_nids = alc861_dac_nids,
12144 .dig_out_nid = ALC861_DIGOUT_NID,
12145 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12146 .channel_mode = alc861_8ch_modes,
12147 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12148 .adc_nids = alc861_adc_nids,
12149 .input_mux = &alc861_capture_source,
12152 .mixers = { alc861_3ST_mixer },
12153 .init_verbs = { alc861_threestack_init_verbs },
12154 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12155 .dac_nids = alc660_dac_nids,
12156 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12157 .channel_mode = alc861_threestack_modes,
12159 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12160 .adc_nids = alc861_adc_nids,
12161 .input_mux = &alc861_capture_source,
12163 [ALC861_UNIWILL_M31] = {
12164 .mixers = { alc861_uniwill_m31_mixer },
12165 .init_verbs = { alc861_uniwill_m31_init_verbs },
12166 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12167 .dac_nids = alc861_dac_nids,
12168 .dig_out_nid = ALC861_DIGOUT_NID,
12169 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12170 .channel_mode = alc861_uniwill_m31_modes,
12172 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12173 .adc_nids = alc861_adc_nids,
12174 .input_mux = &alc861_capture_source,
12176 [ALC861_TOSHIBA] = {
12177 .mixers = { alc861_toshiba_mixer },
12178 .init_verbs = { alc861_base_init_verbs,
12179 alc861_toshiba_init_verbs },
12180 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12181 .dac_nids = alc861_dac_nids,
12182 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12183 .channel_mode = alc883_3ST_2ch_modes,
12184 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12185 .adc_nids = alc861_adc_nids,
12186 .input_mux = &alc861_capture_source,
12187 .unsol_event = alc861_toshiba_unsol_event,
12188 .init_hook = alc861_toshiba_automute,
12191 .mixers = { alc861_asus_mixer },
12192 .init_verbs = { alc861_asus_init_verbs },
12193 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12194 .dac_nids = alc861_dac_nids,
12195 .dig_out_nid = ALC861_DIGOUT_NID,
12196 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12197 .channel_mode = alc861_asus_modes,
12200 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12201 .adc_nids = alc861_adc_nids,
12202 .input_mux = &alc861_capture_source,
12204 [ALC861_ASUS_LAPTOP] = {
12205 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12206 .init_verbs = { alc861_asus_init_verbs,
12207 alc861_asus_laptop_init_verbs },
12208 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12209 .dac_nids = alc861_dac_nids,
12210 .dig_out_nid = ALC861_DIGOUT_NID,
12211 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12212 .channel_mode = alc883_3ST_2ch_modes,
12214 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12215 .adc_nids = alc861_adc_nids,
12216 .input_mux = &alc861_capture_source,
12221 static int patch_alc861(struct hda_codec *codec)
12223 struct alc_spec *spec;
12227 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12231 codec->spec = spec;
12233 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12237 if (board_config < 0) {
12238 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12239 "trying auto-probe from BIOS...\n");
12240 board_config = ALC861_AUTO;
12243 if (board_config == ALC861_AUTO) {
12244 /* automatic parse from the BIOS config */
12245 err = alc861_parse_auto_config(codec);
12251 "hda_codec: Cannot set up configuration "
12252 "from BIOS. Using base mode...\n");
12253 board_config = ALC861_3ST_DIG;
12257 if (board_config != ALC861_AUTO)
12258 setup_preset(spec, &alc861_presets[board_config]);
12260 spec->stream_name_analog = "ALC861 Analog";
12261 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12262 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12264 spec->stream_name_digital = "ALC861 Digital";
12265 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12266 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12268 spec->vmaster_nid = 0x03;
12270 codec->patch_ops = alc_patch_ops;
12271 if (board_config == ALC861_AUTO)
12272 spec->init_hook = alc861_auto_init;
12273 #ifdef CONFIG_SND_HDA_POWER_SAVE
12274 if (!spec->loopback.amplist)
12275 spec->loopback.amplist = alc861_loopbacks;
12282 * ALC861-VD support
12286 * In addition, an independent DAC
12288 #define ALC861VD_DIGOUT_NID 0x06
12290 static hda_nid_t alc861vd_dac_nids[4] = {
12291 /* front, surr, clfe, side surr */
12292 0x02, 0x03, 0x04, 0x05
12295 /* dac_nids for ALC660vd are in a different order - according to
12296 * Realtek's driver.
12297 * This should probably tesult in a different mixer for 6stack models
12298 * of ALC660vd codecs, but for now there is only 3stack mixer
12299 * - and it is the same as in 861vd.
12300 * adc_nids in ALC660vd are (is) the same as in 861vd
12302 static hda_nid_t alc660vd_dac_nids[3] = {
12303 /* front, rear, clfe, rear_surr */
12307 static hda_nid_t alc861vd_adc_nids[1] = {
12312 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12315 /* FIXME: should be a matrix-type input source selection */
12316 static struct hda_input_mux alc861vd_capture_source = {
12320 { "Front Mic", 0x1 },
12326 static struct hda_input_mux alc861vd_dallas_capture_source = {
12329 { "Ext Mic", 0x0 },
12330 { "Int Mic", 0x1 },
12334 static struct hda_input_mux alc861vd_hp_capture_source = {
12337 { "Front Mic", 0x0 },
12338 { "ATAPI Mic", 0x1 },
12342 #define alc861vd_mux_enum_info alc_mux_enum_info
12343 #define alc861vd_mux_enum_get alc_mux_enum_get
12344 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12345 #define alc861vd_mux_enum_put alc882_mux_enum_put
12350 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12357 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12358 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12359 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12360 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12361 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12368 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12369 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12370 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12371 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12372 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12376 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12377 { 6, alc861vd_6stack_ch6_init },
12378 { 8, alc861vd_6stack_ch8_init },
12381 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12383 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12384 .name = "Channel Mode",
12385 .info = alc_ch_mode_info,
12386 .get = alc_ch_mode_get,
12387 .put = alc_ch_mode_put,
12392 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12393 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12394 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12398 /* The multiple "Capture Source" controls confuse alsamixer
12399 * So call somewhat different..
12401 /* .name = "Capture Source", */
12402 .name = "Input Source",
12404 .info = alc861vd_mux_enum_info,
12405 .get = alc861vd_mux_enum_get,
12406 .put = alc861vd_mux_enum_put,
12411 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12412 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12414 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12415 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12418 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12419 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12421 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12423 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12425 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12426 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12428 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12429 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12437 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12438 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12439 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12444 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12445 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12447 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12448 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12453 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12454 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12455 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12457 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12459 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12463 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12464 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12465 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12467 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12468 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12473 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12474 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12479 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12480 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12481 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12482 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12484 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12486 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12487 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12488 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12490 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12491 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12492 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12500 /* Pin assignment: Speaker=0x14, HP = 0x15,
12501 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12503 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12504 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12505 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12506 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12507 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12508 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12509 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12510 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12511 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12512 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12513 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12514 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12515 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12519 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12520 * Front Mic=0x18, ATAPI Mic = 0x19,
12522 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12523 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12524 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12525 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12526 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12527 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12528 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12529 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12530 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12536 * generic initialization of ADC, input mixers and output mixers
12538 static struct hda_verb alc861vd_volume_init_verbs[] = {
12540 * Unmute ADC0 and set the default input to mic-in
12542 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12543 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12545 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12546 * the analog-loopback mixer widget
12548 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12555 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12559 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12562 * Set up output mixers (0x02 - 0x05)
12564 /* set vol=0 to output mixers */
12565 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12566 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12567 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12568 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12570 /* set up input amps for analog loopback */
12571 /* Amp Indices: DAC = 0, mixer = 1 */
12572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12574 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12575 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12576 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12577 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12578 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12579 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12585 * 3-stack pin configuration:
12586 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12588 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12590 * Set pin mode and muting
12592 /* set front pin widgets 0x14 for output */
12593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12594 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12595 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12597 /* Mic (rear) pin: input vref at 80% */
12598 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12599 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12600 /* Front Mic pin: input vref at 80% */
12601 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12602 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12603 /* Line In pin: input */
12604 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12605 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12606 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12607 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12608 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12609 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12610 /* CD pin widget for input */
12611 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12617 * 6-stack pin configuration:
12619 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12621 * Set pin mode and muting
12623 /* set front pin widgets 0x14 for output */
12624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12625 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12626 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12628 /* Rear Pin: output 1 (0x0d) */
12629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12631 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12632 /* CLFE Pin: output 2 (0x0e) */
12633 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12634 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12635 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12636 /* Side Pin: output 3 (0x0f) */
12637 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12638 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12639 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12641 /* Mic (rear) pin: input vref at 80% */
12642 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12644 /* Front Mic pin: input vref at 80% */
12645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12647 /* Line In pin: input */
12648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12650 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12651 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12652 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12653 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12654 /* CD pin widget for input */
12655 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12660 static struct hda_verb alc861vd_eapd_verbs[] = {
12661 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12665 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12668 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12669 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12670 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12674 /* toggle speaker-output according to the hp-jack state */
12675 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12677 unsigned int present;
12678 unsigned char bits;
12680 present = snd_hda_codec_read(codec, 0x1b, 0,
12681 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12682 bits = present ? HDA_AMP_MUTE : 0;
12683 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12684 HDA_AMP_MUTE, bits);
12687 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12689 unsigned int present;
12690 unsigned char bits;
12692 present = snd_hda_codec_read(codec, 0x18, 0,
12693 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12694 bits = present ? HDA_AMP_MUTE : 0;
12695 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12696 HDA_AMP_MUTE, bits);
12699 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12701 alc861vd_lenovo_hp_automute(codec);
12702 alc861vd_lenovo_mic_automute(codec);
12705 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12708 switch (res >> 26) {
12709 case ALC880_HP_EVENT:
12710 alc861vd_lenovo_hp_automute(codec);
12712 case ALC880_MIC_EVENT:
12713 alc861vd_lenovo_mic_automute(codec);
12718 static struct hda_verb alc861vd_dallas_verbs[] = {
12719 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12720 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12721 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12722 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12726 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12728 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12731 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12738 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12739 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12740 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12742 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12743 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12744 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12745 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12746 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12748 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12749 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12756 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12757 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12758 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12763 /* toggle speaker-output according to the hp-jack state */
12764 static void alc861vd_dallas_automute(struct hda_codec *codec)
12766 unsigned int present;
12768 present = snd_hda_codec_read(codec, 0x15, 0,
12769 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12770 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12771 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12774 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12776 if ((res >> 26) == ALC880_HP_EVENT)
12777 alc861vd_dallas_automute(codec);
12780 #ifdef CONFIG_SND_HDA_POWER_SAVE
12781 #define alc861vd_loopbacks alc880_loopbacks
12784 /* pcm configuration: identiacal with ALC880 */
12785 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12786 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12787 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12788 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12791 * configuration and preset
12793 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12794 [ALC660VD_3ST] = "3stack-660",
12795 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12796 [ALC861VD_3ST] = "3stack",
12797 [ALC861VD_3ST_DIG] = "3stack-digout",
12798 [ALC861VD_6ST_DIG] = "6stack-digout",
12799 [ALC861VD_LENOVO] = "lenovo",
12800 [ALC861VD_DALLAS] = "dallas",
12801 [ALC861VD_HP] = "hp",
12802 [ALC861VD_AUTO] = "auto",
12805 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12806 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12807 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12808 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12809 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12810 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12811 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12812 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12813 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12814 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12815 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12816 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
12817 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12818 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12819 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12820 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12824 static struct alc_config_preset alc861vd_presets[] = {
12826 .mixers = { alc861vd_3st_mixer },
12827 .init_verbs = { alc861vd_volume_init_verbs,
12828 alc861vd_3stack_init_verbs },
12829 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12830 .dac_nids = alc660vd_dac_nids,
12831 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12832 .channel_mode = alc861vd_3stack_2ch_modes,
12833 .input_mux = &alc861vd_capture_source,
12835 [ALC660VD_3ST_DIG] = {
12836 .mixers = { alc861vd_3st_mixer },
12837 .init_verbs = { alc861vd_volume_init_verbs,
12838 alc861vd_3stack_init_verbs },
12839 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12840 .dac_nids = alc660vd_dac_nids,
12841 .dig_out_nid = ALC861VD_DIGOUT_NID,
12842 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12843 .channel_mode = alc861vd_3stack_2ch_modes,
12844 .input_mux = &alc861vd_capture_source,
12847 .mixers = { alc861vd_3st_mixer },
12848 .init_verbs = { alc861vd_volume_init_verbs,
12849 alc861vd_3stack_init_verbs },
12850 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12851 .dac_nids = alc861vd_dac_nids,
12852 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12853 .channel_mode = alc861vd_3stack_2ch_modes,
12854 .input_mux = &alc861vd_capture_source,
12856 [ALC861VD_3ST_DIG] = {
12857 .mixers = { alc861vd_3st_mixer },
12858 .init_verbs = { alc861vd_volume_init_verbs,
12859 alc861vd_3stack_init_verbs },
12860 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12861 .dac_nids = alc861vd_dac_nids,
12862 .dig_out_nid = ALC861VD_DIGOUT_NID,
12863 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12864 .channel_mode = alc861vd_3stack_2ch_modes,
12865 .input_mux = &alc861vd_capture_source,
12867 [ALC861VD_6ST_DIG] = {
12868 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12869 .init_verbs = { alc861vd_volume_init_verbs,
12870 alc861vd_6stack_init_verbs },
12871 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12872 .dac_nids = alc861vd_dac_nids,
12873 .dig_out_nid = ALC861VD_DIGOUT_NID,
12874 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12875 .channel_mode = alc861vd_6stack_modes,
12876 .input_mux = &alc861vd_capture_source,
12878 [ALC861VD_LENOVO] = {
12879 .mixers = { alc861vd_lenovo_mixer },
12880 .init_verbs = { alc861vd_volume_init_verbs,
12881 alc861vd_3stack_init_verbs,
12882 alc861vd_eapd_verbs,
12883 alc861vd_lenovo_unsol_verbs },
12884 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12885 .dac_nids = alc660vd_dac_nids,
12886 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12887 .channel_mode = alc861vd_3stack_2ch_modes,
12888 .input_mux = &alc861vd_capture_source,
12889 .unsol_event = alc861vd_lenovo_unsol_event,
12890 .init_hook = alc861vd_lenovo_automute,
12892 [ALC861VD_DALLAS] = {
12893 .mixers = { alc861vd_dallas_mixer },
12894 .init_verbs = { alc861vd_dallas_verbs },
12895 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12896 .dac_nids = alc861vd_dac_nids,
12897 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12898 .channel_mode = alc861vd_3stack_2ch_modes,
12899 .input_mux = &alc861vd_dallas_capture_source,
12900 .unsol_event = alc861vd_dallas_unsol_event,
12901 .init_hook = alc861vd_dallas_automute,
12904 .mixers = { alc861vd_hp_mixer },
12905 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12906 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12907 .dac_nids = alc861vd_dac_nids,
12908 .dig_out_nid = ALC861VD_DIGOUT_NID,
12909 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12910 .channel_mode = alc861vd_3stack_2ch_modes,
12911 .input_mux = &alc861vd_hp_capture_source,
12912 .unsol_event = alc861vd_dallas_unsol_event,
12913 .init_hook = alc861vd_dallas_automute,
12918 * BIOS auto configuration
12920 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12921 hda_nid_t nid, int pin_type, int dac_idx)
12923 alc_set_pin_output(codec, nid, pin_type);
12926 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12928 struct alc_spec *spec = codec->spec;
12931 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12932 for (i = 0; i <= HDA_SIDE; i++) {
12933 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12934 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12936 alc861vd_auto_set_output_and_unmute(codec, nid,
12942 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12944 struct alc_spec *spec = codec->spec;
12947 pin = spec->autocfg.hp_pins[0];
12948 if (pin) /* connect to front and use dac 0 */
12949 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12950 pin = spec->autocfg.speaker_pins[0];
12952 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12955 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12956 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12958 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12960 struct alc_spec *spec = codec->spec;
12963 for (i = 0; i < AUTO_PIN_LAST; i++) {
12964 hda_nid_t nid = spec->autocfg.input_pins[i];
12965 if (alc861vd_is_input_pin(nid)) {
12966 snd_hda_codec_write(codec, nid, 0,
12967 AC_VERB_SET_PIN_WIDGET_CONTROL,
12968 i <= AUTO_PIN_FRONT_MIC ?
12969 PIN_VREF80 : PIN_IN);
12970 if (nid != ALC861VD_PIN_CD_NID)
12971 snd_hda_codec_write(codec, nid, 0,
12972 AC_VERB_SET_AMP_GAIN_MUTE,
12978 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12979 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12981 /* add playback controls from the parsed DAC table */
12982 /* Based on ALC880 version. But ALC861VD has separate,
12983 * different NIDs for mute/unmute switch and volume control */
12984 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12985 const struct auto_pin_cfg *cfg)
12988 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12989 hda_nid_t nid_v, nid_s;
12992 for (i = 0; i < cfg->line_outs; i++) {
12993 if (!spec->multiout.dac_nids[i])
12995 nid_v = alc861vd_idx_to_mixer_vol(
12997 spec->multiout.dac_nids[i]));
12998 nid_s = alc861vd_idx_to_mixer_switch(
13000 spec->multiout.dac_nids[i]));
13004 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13005 "Center Playback Volume",
13006 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
13010 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13011 "LFE Playback Volume",
13012 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
13016 err = add_control(spec, ALC_CTL_BIND_MUTE,
13017 "Center Playback Switch",
13018 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
13022 err = add_control(spec, ALC_CTL_BIND_MUTE,
13023 "LFE Playback Switch",
13024 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
13029 sprintf(name, "%s Playback Volume", chname[i]);
13030 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13031 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
13035 sprintf(name, "%s Playback Switch", chname[i]);
13036 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13037 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13046 /* add playback controls for speaker and HP outputs */
13047 /* Based on ALC880 version. But ALC861VD has separate,
13048 * different NIDs for mute/unmute switch and volume control */
13049 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13050 hda_nid_t pin, const char *pfx)
13052 hda_nid_t nid_v, nid_s;
13059 if (alc880_is_fixed_pin(pin)) {
13060 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13061 /* specify the DAC as the extra output */
13062 if (!spec->multiout.hp_nid)
13063 spec->multiout.hp_nid = nid_v;
13065 spec->multiout.extra_out_nid[0] = nid_v;
13066 /* control HP volume/switch on the output mixer amp */
13067 nid_v = alc861vd_idx_to_mixer_vol(
13068 alc880_fixed_pin_idx(pin));
13069 nid_s = alc861vd_idx_to_mixer_switch(
13070 alc880_fixed_pin_idx(pin));
13072 sprintf(name, "%s Playback Volume", pfx);
13073 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13074 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13077 sprintf(name, "%s Playback Switch", pfx);
13078 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13079 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13082 } else if (alc880_is_multi_pin(pin)) {
13083 /* set manual connection */
13084 /* we have only a switch on HP-out PIN */
13085 sprintf(name, "%s Playback Switch", pfx);
13086 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13087 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13094 /* parse the BIOS configuration and set up the alc_spec
13095 * return 1 if successful, 0 if the proper config is not found,
13096 * or a negative error code
13097 * Based on ALC880 version - had to change it to override
13098 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13099 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13101 struct alc_spec *spec = codec->spec;
13103 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13105 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13109 if (!spec->autocfg.line_outs)
13110 return 0; /* can't find valid BIOS pin config */
13112 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13115 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13118 err = alc861vd_auto_create_extra_out(spec,
13119 spec->autocfg.speaker_pins[0],
13123 err = alc861vd_auto_create_extra_out(spec,
13124 spec->autocfg.hp_pins[0],
13128 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13132 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13134 if (spec->autocfg.dig_out_pin)
13135 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13137 if (spec->kctl_alloc)
13138 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13140 spec->init_verbs[spec->num_init_verbs++]
13141 = alc861vd_volume_init_verbs;
13143 spec->num_mux_defs = 1;
13144 spec->input_mux = &spec->private_imux;
13146 err = alc_auto_add_mic_boost(codec);
13153 /* additional initialization for auto-configuration model */
13154 static void alc861vd_auto_init(struct hda_codec *codec)
13156 struct alc_spec *spec = codec->spec;
13157 alc861vd_auto_init_multi_out(codec);
13158 alc861vd_auto_init_hp_out(codec);
13159 alc861vd_auto_init_analog_input(codec);
13160 if (spec->unsol_event)
13161 alc_sku_automute(codec);
13164 static int patch_alc861vd(struct hda_codec *codec)
13166 struct alc_spec *spec;
13167 int err, board_config;
13169 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13173 codec->spec = spec;
13175 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13179 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13180 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13181 "ALC861VD, trying auto-probe from BIOS...\n");
13182 board_config = ALC861VD_AUTO;
13185 if (board_config == ALC861VD_AUTO) {
13186 /* automatic parse from the BIOS config */
13187 err = alc861vd_parse_auto_config(codec);
13193 "hda_codec: Cannot set up configuration "
13194 "from BIOS. Using base mode...\n");
13195 board_config = ALC861VD_3ST;
13199 if (board_config != ALC861VD_AUTO)
13200 setup_preset(spec, &alc861vd_presets[board_config]);
13202 if (codec->vendor_id == 0x10ec0660) {
13203 spec->stream_name_analog = "ALC660-VD Analog";
13204 spec->stream_name_digital = "ALC660-VD Digital";
13206 spec->stream_name_analog = "ALC861VD Analog";
13207 spec->stream_name_digital = "ALC861VD Digital";
13210 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13211 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13213 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13214 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13216 spec->adc_nids = alc861vd_adc_nids;
13217 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13218 spec->capsrc_nids = alc861vd_capsrc_nids;
13220 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13221 spec->num_mixers++;
13223 spec->vmaster_nid = 0x02;
13225 codec->patch_ops = alc_patch_ops;
13227 if (board_config == ALC861VD_AUTO)
13228 spec->init_hook = alc861vd_auto_init;
13229 #ifdef CONFIG_SND_HDA_POWER_SAVE
13230 if (!spec->loopback.amplist)
13231 spec->loopback.amplist = alc861vd_loopbacks;
13240 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13241 * configuration. Each pin widget can choose any input DACs and a mixer.
13242 * Each ADC is connected from a mixer of all inputs. This makes possible
13243 * 6-channel independent captures.
13245 * In addition, an independent DAC for the multi-playback (not used in this
13248 #define ALC662_DIGOUT_NID 0x06
13249 #define ALC662_DIGIN_NID 0x0a
13251 static hda_nid_t alc662_dac_nids[4] = {
13252 /* front, rear, clfe, rear_surr */
13256 static hda_nid_t alc662_adc_nids[1] = {
13261 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13264 /* FIXME: should be a matrix-type input source selection */
13265 static struct hda_input_mux alc662_capture_source = {
13269 { "Front Mic", 0x1 },
13275 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13283 static struct hda_input_mux alc662_eeepc_capture_source = {
13291 static struct hda_input_mux alc663_capture_source = {
13295 { "Front Mic", 0x1 },
13300 static struct hda_input_mux alc663_m51va_capture_source = {
13303 { "Ext-Mic", 0x0 },
13308 #define alc662_mux_enum_info alc_mux_enum_info
13309 #define alc662_mux_enum_get alc_mux_enum_get
13310 #define alc662_mux_enum_put alc882_mux_enum_put
13315 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13322 static struct hda_verb alc662_3ST_ch2_init[] = {
13323 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13324 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13325 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13326 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13333 static struct hda_verb alc662_3ST_ch6_init[] = {
13334 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13335 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13336 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13337 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13338 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13339 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13343 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13344 { 2, alc662_3ST_ch2_init },
13345 { 6, alc662_3ST_ch6_init },
13351 static struct hda_verb alc662_sixstack_ch6_init[] = {
13352 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13353 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13354 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13361 static struct hda_verb alc662_sixstack_ch8_init[] = {
13362 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13363 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13364 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13368 static struct hda_channel_mode alc662_5stack_modes[2] = {
13369 { 2, alc662_sixstack_ch6_init },
13370 { 6, alc662_sixstack_ch8_init },
13373 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13374 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13377 static struct snd_kcontrol_new alc662_base_mixer[] = {
13378 /* output mixer control */
13379 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13380 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13381 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13382 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13383 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13384 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13385 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13386 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13389 /*Input mixer control */
13390 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13391 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13392 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13393 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13394 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13395 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13396 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13397 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13401 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13402 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13403 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13405 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13406 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13407 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13408 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13409 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13410 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13411 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13412 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13413 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13414 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13418 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13419 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13420 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13421 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13422 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13423 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13424 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13425 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13426 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13430 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13431 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13434 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13436 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13437 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13441 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13442 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13443 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13444 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13445 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13446 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13447 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13448 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13454 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13455 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13457 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13458 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13460 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13461 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13462 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13464 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13465 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13466 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13470 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13471 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13472 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13473 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13474 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13475 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13476 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13477 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13478 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13479 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13480 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13482 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13484 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13488 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
13489 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13490 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13491 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13494 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT),
13498 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
13499 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13500 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13501 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13502 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13503 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13506 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13507 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13508 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13512 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
13513 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13514 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13518 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13519 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13520 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13521 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13526 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13528 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13529 .name = "Channel Mode",
13530 .info = alc_ch_mode_info,
13531 .get = alc_ch_mode_get,
13532 .put = alc_ch_mode_put,
13537 static struct hda_verb alc662_init_verbs[] = {
13538 /* ADC: mute amp left and right */
13539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13540 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13541 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13553 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13556 /* Front Pin: output 0 (0x0c) */
13557 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13560 /* Rear Pin: output 1 (0x0d) */
13561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13564 /* CLFE Pin: output 2 (0x0e) */
13565 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13566 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13568 /* Mic (rear) pin: input vref at 80% */
13569 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13570 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13571 /* Front Mic pin: input vref at 80% */
13572 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13573 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13574 /* Line In pin: input */
13575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13577 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13578 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13579 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13580 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13581 /* CD pin widget for input */
13582 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13584 /* FIXME: use matrix-type input source selection */
13585 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13594 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13595 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13597 /* always trun on EAPD */
13598 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13599 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13604 static struct hda_verb alc662_sue_init_verbs[] = {
13605 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13606 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13610 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13611 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13612 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13616 /* Set Unsolicited Event*/
13617 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13618 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13619 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13624 * generic initialization of ADC, input mixers and output mixers
13626 static struct hda_verb alc662_auto_init_verbs[] = {
13628 * Unmute ADC and set the default input to mic-in
13630 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13633 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13635 * Note: PASD motherboards uses the Line In 2 as the input for front
13636 * panel mic (mic 2)
13638 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13639 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13646 * Set up output mixers (0x0c - 0x0f)
13648 /* set vol=0 to output mixers */
13649 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13650 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13651 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13653 /* set up input amps for analog loopback */
13654 /* Amp Indices: DAC = 0, mixer = 1 */
13655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13663 /* FIXME: use matrix-type input source selection */
13664 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13671 static struct hda_verb alc663_m51va_init_verbs[] = {
13672 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13673 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13674 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
13678 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13679 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13683 static struct hda_verb alc663_g71v_init_verbs[] = {
13684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13685 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
13686 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
13688 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13689 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13690 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13692 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13693 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
13694 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13698 static struct hda_verb alc663_g50v_init_verbs[] = {
13699 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13700 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13701 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
13703 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13704 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13708 /* capture mixer elements */
13709 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13710 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13711 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13713 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13714 /* The multiple "Capture Source" controls confuse alsamixer
13715 * So call somewhat different..
13717 /* .name = "Capture Source", */
13718 .name = "Input Source",
13720 .info = alc662_mux_enum_info,
13721 .get = alc662_mux_enum_get,
13722 .put = alc662_mux_enum_put,
13727 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13729 unsigned int present;
13730 unsigned char bits;
13732 present = snd_hda_codec_read(codec, 0x14, 0,
13733 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13734 bits = present ? HDA_AMP_MUTE : 0;
13735 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13736 HDA_AMP_MUTE, bits);
13739 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13741 unsigned int present;
13742 unsigned char bits;
13744 present = snd_hda_codec_read(codec, 0x1b, 0,
13745 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13746 bits = present ? HDA_AMP_MUTE : 0;
13747 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13748 HDA_AMP_MUTE, bits);
13749 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13750 HDA_AMP_MUTE, bits);
13753 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13756 if ((res >> 26) == ALC880_HP_EVENT)
13757 alc662_lenovo_101e_all_automute(codec);
13758 if ((res >> 26) == ALC880_FRONT_EVENT)
13759 alc662_lenovo_101e_ispeaker_automute(codec);
13762 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13764 unsigned int present;
13766 present = snd_hda_codec_read(codec, 0x18, 0,
13767 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13768 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13769 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13770 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13771 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13772 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13773 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13774 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13775 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13778 /* unsolicited event for HP jack sensing */
13779 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13782 if ((res >> 26) == ALC880_HP_EVENT)
13783 alc262_hippo1_automute( codec );
13785 if ((res >> 26) == ALC880_MIC_EVENT)
13786 alc662_eeepc_mic_automute(codec);
13789 static void alc662_eeepc_inithook(struct hda_codec *codec)
13791 alc262_hippo1_automute( codec );
13792 alc662_eeepc_mic_automute(codec);
13795 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13798 unsigned int present;
13800 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13801 present = snd_hda_codec_read(codec, 0x14, 0,
13802 AC_VERB_GET_PIN_SENSE, 0);
13803 present = (present & 0x80000000) != 0;
13805 /* mute internal speaker */
13806 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13807 HDA_AMP_MUTE, HDA_AMP_MUTE);
13809 /* unmute internal speaker if necessary */
13810 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13811 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13812 HDA_AMP_MUTE, mute);
13816 /* unsolicited event for HP jack sensing */
13817 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13820 if ((res >> 26) == ALC880_HP_EVENT)
13821 alc662_eeepc_ep20_automute(codec);
13824 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13826 alc662_eeepc_ep20_automute(codec);
13829 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
13831 unsigned int present;
13832 unsigned char bits;
13834 present = snd_hda_codec_read(codec, 0x21, 0,
13835 AC_VERB_GET_PIN_SENSE, 0)
13836 & AC_PINSENSE_PRESENCE;
13837 bits = present ? HDA_AMP_MUTE : 0;
13838 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13839 HDA_AMP_MUTE, bits);
13842 static void alc663_m51va_mic_automute(struct hda_codec *codec)
13844 unsigned int present;
13846 present = snd_hda_codec_read(codec, 0x18, 0,
13847 AC_VERB_GET_PIN_SENSE, 0)
13848 & AC_PINSENSE_PRESENCE;
13849 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13850 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13851 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13852 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13853 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13854 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
13855 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13856 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
13859 static void alc663_m51va_unsol_event(struct hda_codec *codec,
13862 switch (res >> 26) {
13863 case ALC880_HP_EVENT:
13864 alc663_m51va_speaker_automute(codec);
13866 case ALC880_MIC_EVENT:
13867 alc663_m51va_mic_automute(codec);
13872 static void alc663_m51va_inithook(struct hda_codec *codec)
13874 alc663_m51va_speaker_automute(codec);
13875 alc663_m51va_mic_automute(codec);
13878 static void alc663_g71v_hp_automute(struct hda_codec *codec)
13880 unsigned int present;
13881 unsigned char bits;
13883 present = snd_hda_codec_read(codec, 0x21, 0,
13884 AC_VERB_GET_PIN_SENSE, 0)
13885 & AC_PINSENSE_PRESENCE;
13886 bits = present ? HDA_AMP_MUTE : 0;
13887 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13888 HDA_AMP_MUTE, bits);
13889 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13890 HDA_AMP_MUTE, bits);
13893 static void alc663_g71v_front_automute(struct hda_codec *codec)
13895 unsigned int present;
13896 unsigned char bits;
13898 present = snd_hda_codec_read(codec, 0x15, 0,
13899 AC_VERB_GET_PIN_SENSE, 0)
13900 & AC_PINSENSE_PRESENCE;
13901 bits = present ? HDA_AMP_MUTE : 0;
13902 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13903 HDA_AMP_MUTE, bits);
13906 static void alc663_g71v_unsol_event(struct hda_codec *codec,
13909 switch (res >> 26) {
13910 case ALC880_HP_EVENT:
13911 alc663_g71v_hp_automute(codec);
13913 case ALC880_FRONT_EVENT:
13914 alc663_g71v_front_automute(codec);
13916 case ALC880_MIC_EVENT:
13917 alc662_eeepc_mic_automute(codec);
13922 static void alc663_g71v_inithook(struct hda_codec *codec)
13924 alc663_g71v_front_automute(codec);
13925 alc663_g71v_hp_automute(codec);
13926 alc662_eeepc_mic_automute(codec);
13929 static void alc663_g50v_unsol_event(struct hda_codec *codec,
13932 switch (res >> 26) {
13933 case ALC880_HP_EVENT:
13934 alc663_m51va_speaker_automute(codec);
13936 case ALC880_MIC_EVENT:
13937 alc662_eeepc_mic_automute(codec);
13942 static void alc663_g50v_inithook(struct hda_codec *codec)
13944 alc663_m51va_speaker_automute(codec);
13945 alc662_eeepc_mic_automute(codec);
13948 #ifdef CONFIG_SND_HDA_POWER_SAVE
13949 #define alc662_loopbacks alc880_loopbacks
13953 /* pcm configuration: identiacal with ALC880 */
13954 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13955 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13956 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13957 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13960 * configuration and preset
13962 static const char *alc662_models[ALC662_MODEL_LAST] = {
13963 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13964 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13965 [ALC662_3ST_6ch] = "3stack-6ch",
13966 [ALC662_5ST_DIG] = "6stack-dig",
13967 [ALC662_LENOVO_101E] = "lenovo-101e",
13968 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13969 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13970 [ALC663_ASUS_M51VA] = "m51va",
13971 [ALC663_ASUS_G71V] = "g71v",
13972 [ALC663_ASUS_H13] = "h13",
13973 [ALC663_ASUS_G50V] = "g50v",
13974 [ALC662_AUTO] = "auto",
13977 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13978 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V),
13979 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
13980 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V),
13981 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
13982 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13983 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13984 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13985 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
13986 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
13987 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
13991 static struct alc_config_preset alc662_presets[] = {
13992 [ALC662_3ST_2ch_DIG] = {
13993 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13994 .init_verbs = { alc662_init_verbs },
13995 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13996 .dac_nids = alc662_dac_nids,
13997 .dig_out_nid = ALC662_DIGOUT_NID,
13998 .dig_in_nid = ALC662_DIGIN_NID,
13999 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14000 .channel_mode = alc662_3ST_2ch_modes,
14001 .input_mux = &alc662_capture_source,
14003 [ALC662_3ST_6ch_DIG] = {
14004 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14005 alc662_capture_mixer },
14006 .init_verbs = { alc662_init_verbs },
14007 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14008 .dac_nids = alc662_dac_nids,
14009 .dig_out_nid = ALC662_DIGOUT_NID,
14010 .dig_in_nid = ALC662_DIGIN_NID,
14011 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14012 .channel_mode = alc662_3ST_6ch_modes,
14014 .input_mux = &alc662_capture_source,
14016 [ALC662_3ST_6ch] = {
14017 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
14018 alc662_capture_mixer },
14019 .init_verbs = { alc662_init_verbs },
14020 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14021 .dac_nids = alc662_dac_nids,
14022 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14023 .channel_mode = alc662_3ST_6ch_modes,
14025 .input_mux = &alc662_capture_source,
14027 [ALC662_5ST_DIG] = {
14028 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
14029 alc662_capture_mixer },
14030 .init_verbs = { alc662_init_verbs },
14031 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14032 .dac_nids = alc662_dac_nids,
14033 .dig_out_nid = ALC662_DIGOUT_NID,
14034 .dig_in_nid = ALC662_DIGIN_NID,
14035 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
14036 .channel_mode = alc662_5stack_modes,
14037 .input_mux = &alc662_capture_source,
14039 [ALC662_LENOVO_101E] = {
14040 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
14041 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
14042 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14043 .dac_nids = alc662_dac_nids,
14044 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14045 .channel_mode = alc662_3ST_2ch_modes,
14046 .input_mux = &alc662_lenovo_101e_capture_source,
14047 .unsol_event = alc662_lenovo_101e_unsol_event,
14048 .init_hook = alc662_lenovo_101e_all_automute,
14050 [ALC662_ASUS_EEEPC_P701] = {
14051 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
14052 .init_verbs = { alc662_init_verbs,
14053 alc662_eeepc_sue_init_verbs },
14054 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14055 .dac_nids = alc662_dac_nids,
14056 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14057 .channel_mode = alc662_3ST_2ch_modes,
14058 .input_mux = &alc662_eeepc_capture_source,
14059 .unsol_event = alc662_eeepc_unsol_event,
14060 .init_hook = alc662_eeepc_inithook,
14062 [ALC662_ASUS_EEEPC_EP20] = {
14063 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
14064 alc662_chmode_mixer },
14065 .init_verbs = { alc662_init_verbs,
14066 alc662_eeepc_ep20_sue_init_verbs },
14067 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14068 .dac_nids = alc662_dac_nids,
14069 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14070 .channel_mode = alc662_3ST_6ch_modes,
14071 .input_mux = &alc662_lenovo_101e_capture_source,
14072 .unsol_event = alc662_eeepc_ep20_unsol_event,
14073 .init_hook = alc662_eeepc_ep20_inithook,
14075 [ALC663_ASUS_M51VA] = {
14076 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14077 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14078 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14079 .dac_nids = alc662_dac_nids,
14080 .dig_out_nid = ALC662_DIGOUT_NID,
14081 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14082 .channel_mode = alc662_3ST_2ch_modes,
14083 .input_mux = &alc663_m51va_capture_source,
14084 .unsol_event = alc663_m51va_unsol_event,
14085 .init_hook = alc663_m51va_inithook,
14087 [ALC663_ASUS_G71V] = {
14088 .mixers = { alc663_g71v_mixer, alc662_capture_mixer},
14089 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
14090 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14091 .dac_nids = alc662_dac_nids,
14092 .dig_out_nid = ALC662_DIGOUT_NID,
14093 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14094 .channel_mode = alc662_3ST_2ch_modes,
14095 .input_mux = &alc662_eeepc_capture_source,
14096 .unsol_event = alc663_g71v_unsol_event,
14097 .init_hook = alc663_g71v_inithook,
14099 [ALC663_ASUS_H13] = {
14100 .mixers = { alc663_m51va_mixer, alc662_capture_mixer},
14101 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
14102 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14103 .dac_nids = alc662_dac_nids,
14104 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
14105 .channel_mode = alc662_3ST_2ch_modes,
14106 .input_mux = &alc663_m51va_capture_source,
14107 .unsol_event = alc663_m51va_unsol_event,
14108 .init_hook = alc663_m51va_inithook,
14110 [ALC663_ASUS_G50V] = {
14111 .mixers = { alc663_g50v_mixer, alc662_capture_mixer},
14112 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
14113 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
14114 .dac_nids = alc662_dac_nids,
14115 .dig_out_nid = ALC662_DIGOUT_NID,
14116 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
14117 .channel_mode = alc662_3ST_6ch_modes,
14118 .input_mux = &alc663_capture_source,
14119 .unsol_event = alc663_g50v_unsol_event,
14120 .init_hook = alc663_g50v_inithook,
14126 * BIOS auto configuration
14129 /* add playback controls from the parsed DAC table */
14130 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
14131 const struct auto_pin_cfg *cfg)
14134 static const char *chname[4] = {
14135 "Front", "Surround", NULL /*CLFE*/, "Side"
14140 for (i = 0; i < cfg->line_outs; i++) {
14141 if (!spec->multiout.dac_nids[i])
14143 nid = alc880_idx_to_dac(i);
14146 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14147 "Center Playback Volume",
14148 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14152 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14153 "LFE Playback Volume",
14154 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14158 err = add_control(spec, ALC_CTL_BIND_MUTE,
14159 "Center Playback Switch",
14160 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
14164 err = add_control(spec, ALC_CTL_BIND_MUTE,
14165 "LFE Playback Switch",
14166 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
14171 sprintf(name, "%s Playback Volume", chname[i]);
14172 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14173 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14177 sprintf(name, "%s Playback Switch", chname[i]);
14178 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14179 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
14188 /* add playback controls for speaker and HP outputs */
14189 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
14199 if (alc880_is_fixed_pin(pin)) {
14200 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14201 /* printk("DAC nid=%x\n",nid); */
14202 /* specify the DAC as the extra output */
14203 if (!spec->multiout.hp_nid)
14204 spec->multiout.hp_nid = nid;
14206 spec->multiout.extra_out_nid[0] = nid;
14207 /* control HP volume/switch on the output mixer amp */
14208 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14209 sprintf(name, "%s Playback Volume", pfx);
14210 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14211 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14214 sprintf(name, "%s Playback Switch", pfx);
14215 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14216 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
14219 } else if (alc880_is_multi_pin(pin)) {
14220 /* set manual connection */
14221 /* we have only a switch on HP-out PIN */
14222 sprintf(name, "%s Playback Switch", pfx);
14223 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14224 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14231 /* create playback/capture controls for input pins */
14232 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
14233 const struct auto_pin_cfg *cfg)
14235 struct hda_input_mux *imux = &spec->private_imux;
14238 for (i = 0; i < AUTO_PIN_LAST; i++) {
14239 if (alc880_is_input_pin(cfg->input_pins[i])) {
14240 idx = alc880_input_pin_idx(cfg->input_pins[i]);
14241 err = new_analog_input(spec, cfg->input_pins[i],
14242 auto_pin_cfg_labels[i],
14246 imux->items[imux->num_items].label =
14247 auto_pin_cfg_labels[i];
14248 imux->items[imux->num_items].index =
14249 alc880_input_pin_idx(cfg->input_pins[i]);
14256 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
14257 hda_nid_t nid, int pin_type,
14260 alc_set_pin_output(codec, nid, pin_type);
14261 /* need the manual connection? */
14262 if (alc880_is_multi_pin(nid)) {
14263 struct alc_spec *spec = codec->spec;
14264 int idx = alc880_multi_pin_idx(nid);
14265 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
14266 AC_VERB_SET_CONNECT_SEL,
14267 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
14271 static void alc662_auto_init_multi_out(struct hda_codec *codec)
14273 struct alc_spec *spec = codec->spec;
14276 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14277 for (i = 0; i <= HDA_SIDE; i++) {
14278 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14279 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14281 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
14286 static void alc662_auto_init_hp_out(struct hda_codec *codec)
14288 struct alc_spec *spec = codec->spec;
14291 pin = spec->autocfg.hp_pins[0];
14292 if (pin) /* connect to front */
14294 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14295 pin = spec->autocfg.speaker_pins[0];
14297 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14300 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14301 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14303 static void alc662_auto_init_analog_input(struct hda_codec *codec)
14305 struct alc_spec *spec = codec->spec;
14308 for (i = 0; i < AUTO_PIN_LAST; i++) {
14309 hda_nid_t nid = spec->autocfg.input_pins[i];
14310 if (alc662_is_input_pin(nid)) {
14311 snd_hda_codec_write(codec, nid, 0,
14312 AC_VERB_SET_PIN_WIDGET_CONTROL,
14313 (i <= AUTO_PIN_FRONT_MIC ?
14314 PIN_VREF80 : PIN_IN));
14315 if (nid != ALC662_PIN_CD_NID)
14316 snd_hda_codec_write(codec, nid, 0,
14317 AC_VERB_SET_AMP_GAIN_MUTE,
14323 static int alc662_parse_auto_config(struct hda_codec *codec)
14325 struct alc_spec *spec = codec->spec;
14327 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14329 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14333 if (!spec->autocfg.line_outs)
14334 return 0; /* can't find valid BIOS pin config */
14336 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14339 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14342 err = alc662_auto_create_extra_out(spec,
14343 spec->autocfg.speaker_pins[0],
14347 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14351 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14355 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14357 if (spec->autocfg.dig_out_pin)
14358 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14360 if (spec->kctl_alloc)
14361 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14363 spec->num_mux_defs = 1;
14364 spec->input_mux = &spec->private_imux;
14366 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14367 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14368 spec->num_mixers++;
14372 /* additional initialization for auto-configuration model */
14373 static void alc662_auto_init(struct hda_codec *codec)
14375 struct alc_spec *spec = codec->spec;
14376 alc662_auto_init_multi_out(codec);
14377 alc662_auto_init_hp_out(codec);
14378 alc662_auto_init_analog_input(codec);
14379 if (spec->unsol_event)
14380 alc_sku_automute(codec);
14383 static int patch_alc662(struct hda_codec *codec)
14385 struct alc_spec *spec;
14386 int err, board_config;
14388 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14392 codec->spec = spec;
14394 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14397 if (board_config < 0) {
14398 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14399 "trying auto-probe from BIOS...\n");
14400 board_config = ALC662_AUTO;
14403 if (board_config == ALC662_AUTO) {
14404 /* automatic parse from the BIOS config */
14405 err = alc662_parse_auto_config(codec);
14411 "hda_codec: Cannot set up configuration "
14412 "from BIOS. Using base mode...\n");
14413 board_config = ALC662_3ST_2ch_DIG;
14417 if (board_config != ALC662_AUTO)
14418 setup_preset(spec, &alc662_presets[board_config]);
14420 if (codec->vendor_id == 0x10ec0663) {
14421 spec->stream_name_analog = "ALC663 Analog";
14422 spec->stream_name_digital = "ALC663 Digital";
14424 spec->stream_name_analog = "ALC662 Analog";
14425 spec->stream_name_digital = "ALC662 Digital";
14428 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14429 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14431 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14432 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14434 spec->adc_nids = alc662_adc_nids;
14435 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14436 spec->capsrc_nids = alc662_capsrc_nids;
14438 spec->vmaster_nid = 0x02;
14440 codec->patch_ops = alc_patch_ops;
14441 if (board_config == ALC662_AUTO)
14442 spec->init_hook = alc662_auto_init;
14443 #ifdef CONFIG_SND_HDA_POWER_SAVE
14444 if (!spec->loopback.amplist)
14445 spec->loopback.amplist = alc662_loopbacks;
14454 struct hda_codec_preset snd_hda_preset_realtek[] = {
14455 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14456 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14457 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14458 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14459 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14460 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14461 .patch = patch_alc861 },
14462 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14463 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14464 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14465 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14466 .patch = patch_alc883 },
14467 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14468 .patch = patch_alc662 },
14469 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
14470 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14471 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14472 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14473 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14474 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14475 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14476 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14477 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14478 {} /* terminator */