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 */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST /* last tag */
79 #ifdef CONFIG_SND_DEBUG
83 ALC260_MODEL_LAST /* last tag */
93 ALC262_HP_BPC_D7000_WL,
94 ALC262_HP_BPC_D7000_WF,
103 ALC262_MODEL_LAST /* last tag */
113 #ifdef CONFIG_SND_DEBUG
117 ALC268_MODEL_LAST /* last tag */
124 ALC269_MODEL_LAST /* last tag */
141 /* ALC861-VD models */
162 ALC662_ASUS_EEEPC_P701,
163 ALC662_ASUS_EEEPC_EP20,
191 ALC883_TARGA_2ch_DIG,
197 ALC883_LENOVO_101E_2ch,
198 ALC883_LENOVO_NB0763,
199 ALC888_LENOVO_MS7195_DIG,
205 ALC883_FUJITSU_PI2515,
211 #define GPIO_MASK 0x03
214 /* codec parameterization */
215 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
216 unsigned int num_mixers;
218 const struct hda_verb *init_verbs[5]; /* initialization verbs
222 unsigned int num_init_verbs;
224 char *stream_name_analog; /* analog PCM stream */
225 struct hda_pcm_stream *stream_analog_playback;
226 struct hda_pcm_stream *stream_analog_capture;
227 struct hda_pcm_stream *stream_analog_alt_playback;
228 struct hda_pcm_stream *stream_analog_alt_capture;
230 char *stream_name_digital; /* digital PCM stream */
231 struct hda_pcm_stream *stream_digital_playback;
232 struct hda_pcm_stream *stream_digital_capture;
235 struct hda_multi_out multiout; /* playback set-up
236 * max_channels, dacs must be set
237 * dig_out_nid and hp_nid are optional
239 hda_nid_t alt_dac_nid;
242 unsigned int num_adc_nids;
244 hda_nid_t *capsrc_nids;
245 hda_nid_t dig_in_nid; /* digital-in NID; optional */
248 unsigned int num_mux_defs;
249 const struct hda_input_mux *input_mux;
250 unsigned int cur_mux[3];
253 const struct hda_channel_mode *channel_mode;
254 int num_channel_mode;
257 /* PCM information */
258 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
260 /* dynamic controls, init_verbs and input_mux */
261 struct auto_pin_cfg autocfg;
262 unsigned int num_kctl_alloc, num_kctl_used;
263 struct snd_kcontrol_new *kctl_alloc;
264 struct hda_input_mux private_imux;
265 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
268 void (*init_hook)(struct hda_codec *codec);
269 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
271 /* for pin sensing */
272 unsigned int sense_updated: 1;
273 unsigned int jack_present: 1;
274 unsigned int master_sw: 1;
276 /* for virtual master */
277 hda_nid_t vmaster_nid;
278 #ifdef CONFIG_SND_HDA_POWER_SAVE
279 struct hda_loopback_check loopback;
284 * configuration template - to be copied to the spec instance
286 struct alc_config_preset {
287 struct snd_kcontrol_new *mixers[5]; /* should be identical size
290 const struct hda_verb *init_verbs[5];
291 unsigned int num_dacs;
293 hda_nid_t dig_out_nid; /* optional */
294 hda_nid_t hp_nid; /* optional */
295 unsigned int num_adc_nids;
297 hda_nid_t *capsrc_nids;
298 hda_nid_t dig_in_nid;
299 unsigned int num_channel_mode;
300 const struct hda_channel_mode *channel_mode;
302 unsigned int num_mux_defs;
303 const struct hda_input_mux *input_mux;
304 void (*unsol_event)(struct hda_codec *, unsigned int);
305 void (*init_hook)(struct hda_codec *);
306 #ifdef CONFIG_SND_HDA_POWER_SAVE
307 struct hda_amp_list *loopbacks;
315 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
316 struct snd_ctl_elem_info *uinfo)
318 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
319 struct alc_spec *spec = codec->spec;
320 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
321 if (mux_idx >= spec->num_mux_defs)
323 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
326 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
327 struct snd_ctl_elem_value *ucontrol)
329 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
330 struct alc_spec *spec = codec->spec;
331 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
333 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
337 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
338 struct snd_ctl_elem_value *ucontrol)
340 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
341 struct alc_spec *spec = codec->spec;
342 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
343 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
344 hda_nid_t nid = spec->capsrc_nids ?
345 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
346 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
347 nid, &spec->cur_mux[adc_idx]);
352 * channel mode setting
354 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
355 struct snd_ctl_elem_info *uinfo)
357 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
358 struct alc_spec *spec = codec->spec;
359 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
360 spec->num_channel_mode);
363 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
364 struct snd_ctl_elem_value *ucontrol)
366 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
367 struct alc_spec *spec = codec->spec;
368 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
369 spec->num_channel_mode,
370 spec->multiout.max_channels);
373 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
374 struct snd_ctl_elem_value *ucontrol)
376 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
377 struct alc_spec *spec = codec->spec;
378 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
379 spec->num_channel_mode,
380 &spec->multiout.max_channels);
381 if (err >= 0 && spec->need_dac_fix)
382 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
387 * Control the mode of pin widget settings via the mixer. "pc" is used
388 * instead of "%" to avoid consequences of accidently treating the % as
389 * being part of a format specifier. Maximum allowed length of a value is
390 * 63 characters plus NULL terminator.
392 * Note: some retasking pin complexes seem to ignore requests for input
393 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
394 * are requested. Therefore order this list so that this behaviour will not
395 * cause problems when mixer clients move through the enum sequentially.
396 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
399 static char *alc_pin_mode_names[] = {
400 "Mic 50pc bias", "Mic 80pc bias",
401 "Line in", "Line out", "Headphone out",
403 static unsigned char alc_pin_mode_values[] = {
404 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
406 /* The control can present all 5 options, or it can limit the options based
407 * in the pin being assumed to be exclusively an input or an output pin. In
408 * addition, "input" pins may or may not process the mic bias option
409 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
410 * accept requests for bias as of chip versions up to March 2006) and/or
411 * wiring in the computer.
413 #define ALC_PIN_DIR_IN 0x00
414 #define ALC_PIN_DIR_OUT 0x01
415 #define ALC_PIN_DIR_INOUT 0x02
416 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
417 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
419 /* Info about the pin modes supported by the different pin direction modes.
420 * For each direction the minimum and maximum values are given.
422 static signed char alc_pin_mode_dir_info[5][2] = {
423 { 0, 2 }, /* ALC_PIN_DIR_IN */
424 { 3, 4 }, /* ALC_PIN_DIR_OUT */
425 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
426 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
427 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
429 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
430 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
431 #define alc_pin_mode_n_items(_dir) \
432 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
434 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_info *uinfo)
437 unsigned int item_num = uinfo->value.enumerated.item;
438 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
440 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
442 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
444 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
445 item_num = alc_pin_mode_min(dir);
446 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
450 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
451 struct snd_ctl_elem_value *ucontrol)
454 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
455 hda_nid_t nid = kcontrol->private_value & 0xffff;
456 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
457 long *valp = ucontrol->value.integer.value;
458 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
459 AC_VERB_GET_PIN_WIDGET_CONTROL,
462 /* Find enumerated value for current pinctl setting */
463 i = alc_pin_mode_min(dir);
464 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
466 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
470 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
471 struct snd_ctl_elem_value *ucontrol)
474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
475 hda_nid_t nid = kcontrol->private_value & 0xffff;
476 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
477 long val = *ucontrol->value.integer.value;
478 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
479 AC_VERB_GET_PIN_WIDGET_CONTROL,
482 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
483 val = alc_pin_mode_min(dir);
485 change = pinctl != alc_pin_mode_values[val];
487 /* Set pin mode to that requested */
488 snd_hda_codec_write_cache(codec, nid, 0,
489 AC_VERB_SET_PIN_WIDGET_CONTROL,
490 alc_pin_mode_values[val]);
492 /* Also enable the retasking pin's input/output as required
493 * for the requested pin mode. Enum values of 2 or less are
496 * Dynamically switching the input/output buffers probably
497 * reduces noise slightly (particularly on input) so we'll
498 * do it. However, having both input and output buffers
499 * enabled simultaneously doesn't seem to be problematic if
500 * this turns out to be necessary in the future.
503 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
504 HDA_AMP_MUTE, HDA_AMP_MUTE);
505 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
508 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
509 HDA_AMP_MUTE, HDA_AMP_MUTE);
510 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
517 #define ALC_PIN_MODE(xname, nid, dir) \
518 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
519 .info = alc_pin_mode_info, \
520 .get = alc_pin_mode_get, \
521 .put = alc_pin_mode_put, \
522 .private_value = nid | (dir<<16) }
524 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
525 * together using a mask with more than one bit set. This control is
526 * currently used only by the ALC260 test model. At this stage they are not
527 * needed for any "production" models.
529 #ifdef CONFIG_SND_DEBUG
530 #define alc_gpio_data_info snd_ctl_boolean_mono_info
532 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
533 struct snd_ctl_elem_value *ucontrol)
535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
536 hda_nid_t nid = kcontrol->private_value & 0xffff;
537 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
538 long *valp = ucontrol->value.integer.value;
539 unsigned int val = snd_hda_codec_read(codec, nid, 0,
540 AC_VERB_GET_GPIO_DATA, 0x00);
542 *valp = (val & mask) != 0;
545 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
546 struct snd_ctl_elem_value *ucontrol)
549 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
550 hda_nid_t nid = kcontrol->private_value & 0xffff;
551 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
552 long val = *ucontrol->value.integer.value;
553 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
554 AC_VERB_GET_GPIO_DATA,
557 /* Set/unset the masked GPIO bit(s) as needed */
558 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
563 snd_hda_codec_write_cache(codec, nid, 0,
564 AC_VERB_SET_GPIO_DATA, gpio_data);
568 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
569 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
570 .info = alc_gpio_data_info, \
571 .get = alc_gpio_data_get, \
572 .put = alc_gpio_data_put, \
573 .private_value = nid | (mask<<16) }
574 #endif /* CONFIG_SND_DEBUG */
576 /* A switch control to allow the enabling of the digital IO pins on the
577 * ALC260. This is incredibly simplistic; the intention of this control is
578 * to provide something in the test model allowing digital outputs to be
579 * identified if present. If models are found which can utilise these
580 * outputs a more complete mixer control can be devised for those models if
583 #ifdef CONFIG_SND_DEBUG
584 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
586 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
587 struct snd_ctl_elem_value *ucontrol)
589 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
590 hda_nid_t nid = kcontrol->private_value & 0xffff;
591 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
592 long *valp = ucontrol->value.integer.value;
593 unsigned int val = snd_hda_codec_read(codec, nid, 0,
594 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
596 *valp = (val & mask) != 0;
599 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
600 struct snd_ctl_elem_value *ucontrol)
603 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
604 hda_nid_t nid = kcontrol->private_value & 0xffff;
605 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
606 long val = *ucontrol->value.integer.value;
607 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
608 AC_VERB_GET_DIGI_CONVERT_1,
611 /* Set/unset the masked control bit(s) as needed */
612 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
617 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
622 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
623 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
624 .info = alc_spdif_ctrl_info, \
625 .get = alc_spdif_ctrl_get, \
626 .put = alc_spdif_ctrl_put, \
627 .private_value = nid | (mask<<16) }
628 #endif /* CONFIG_SND_DEBUG */
630 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
631 * Again, this is only used in the ALC26x test models to help identify when
632 * the EAPD line must be asserted for features to work.
634 #ifdef CONFIG_SND_DEBUG
635 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
637 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
638 struct snd_ctl_elem_value *ucontrol)
640 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
641 hda_nid_t nid = kcontrol->private_value & 0xffff;
642 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
643 long *valp = ucontrol->value.integer.value;
644 unsigned int val = snd_hda_codec_read(codec, nid, 0,
645 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
647 *valp = (val & mask) != 0;
651 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
652 struct snd_ctl_elem_value *ucontrol)
655 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
656 hda_nid_t nid = kcontrol->private_value & 0xffff;
657 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
658 long val = *ucontrol->value.integer.value;
659 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
660 AC_VERB_GET_EAPD_BTLENABLE,
663 /* Set/unset the masked control bit(s) as needed */
664 change = (!val ? 0 : mask) != (ctrl_data & mask);
669 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
675 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
676 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
677 .info = alc_eapd_ctrl_info, \
678 .get = alc_eapd_ctrl_get, \
679 .put = alc_eapd_ctrl_put, \
680 .private_value = nid | (mask<<16) }
681 #endif /* CONFIG_SND_DEBUG */
684 * set up from the preset table
686 static void setup_preset(struct alc_spec *spec,
687 const struct alc_config_preset *preset)
691 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
692 spec->mixers[spec->num_mixers++] = preset->mixers[i];
693 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
695 spec->init_verbs[spec->num_init_verbs++] =
696 preset->init_verbs[i];
698 spec->channel_mode = preset->channel_mode;
699 spec->num_channel_mode = preset->num_channel_mode;
700 spec->need_dac_fix = preset->need_dac_fix;
702 spec->multiout.max_channels = spec->channel_mode[0].channels;
704 spec->multiout.num_dacs = preset->num_dacs;
705 spec->multiout.dac_nids = preset->dac_nids;
706 spec->multiout.dig_out_nid = preset->dig_out_nid;
707 spec->multiout.hp_nid = preset->hp_nid;
709 spec->num_mux_defs = preset->num_mux_defs;
710 if (!spec->num_mux_defs)
711 spec->num_mux_defs = 1;
712 spec->input_mux = preset->input_mux;
714 spec->num_adc_nids = preset->num_adc_nids;
715 spec->adc_nids = preset->adc_nids;
716 spec->capsrc_nids = preset->capsrc_nids;
717 spec->dig_in_nid = preset->dig_in_nid;
719 spec->unsol_event = preset->unsol_event;
720 spec->init_hook = preset->init_hook;
721 #ifdef CONFIG_SND_HDA_POWER_SAVE
722 spec->loopback.amplist = preset->loopbacks;
726 /* Enable GPIO mask and set output */
727 static struct hda_verb alc_gpio1_init_verbs[] = {
728 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
729 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
730 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
734 static struct hda_verb alc_gpio2_init_verbs[] = {
735 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
736 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
737 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
741 static struct hda_verb alc_gpio3_init_verbs[] = {
742 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
743 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
744 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
748 static void alc_sku_automute(struct hda_codec *codec)
750 struct alc_spec *spec = codec->spec;
751 unsigned int present;
752 unsigned int hp_nid = spec->autocfg.hp_pins[0];
753 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
755 /* need to execute and sync at first */
756 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
757 present = snd_hda_codec_read(codec, hp_nid, 0,
758 AC_VERB_GET_PIN_SENSE, 0);
759 spec->jack_present = (present & 0x80000000) != 0;
760 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
761 spec->jack_present ? 0 : PIN_OUT);
764 /* unsolicited event for HP jack sensing */
765 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
767 if (codec->vendor_id == 0x10ec0880)
771 if (res != ALC880_HP_EVENT)
774 alc_sku_automute(codec);
777 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
778 * 31 ~ 16 : Manufacture ID
780 * 7 ~ 0 : Assembly ID
781 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
783 static void alc_subsystem_id(struct hda_codec *codec,
784 unsigned int porta, unsigned int porte,
787 unsigned int ass, tmp, i;
789 struct alc_spec *spec = codec->spec;
791 ass = codec->subsystem_id & 0xffff;
792 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
796 * 31~30 : port conetcivity
799 * 19~16 : Check sum (15:1)
804 if (codec->vendor_id == 0x10ec0260)
806 ass = snd_hda_codec_read(codec, nid, 0,
807 AC_VERB_GET_CONFIG_DEFAULT, 0);
808 if (!(ass & 1) && !(ass & 0x100000))
810 if ((ass >> 30) != 1) /* no physical connection */
815 for (i = 1; i < 16; i++) {
819 if (((ass >> 16) & 0xf) != tmp)
825 * 2 : 0 --> Desktop, 1 --> Laptop
826 * 3~5 : External Amplifier control
829 tmp = (ass & 0x38) >> 3; /* external Amp control */
832 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
835 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
838 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
840 case 5: /* set EAPD output high */
841 switch (codec->vendor_id) {
843 snd_hda_codec_write(codec, 0x0f, 0,
844 AC_VERB_SET_EAPD_BTLENABLE, 2);
845 snd_hda_codec_write(codec, 0x10, 0,
846 AC_VERB_SET_EAPD_BTLENABLE, 2);
854 snd_hda_codec_write(codec, 0x14, 0,
855 AC_VERB_SET_EAPD_BTLENABLE, 2);
856 snd_hda_codec_write(codec, 0x15, 0,
857 AC_VERB_SET_EAPD_BTLENABLE, 2);
860 switch (codec->vendor_id) {
862 snd_hda_codec_write(codec, 0x1a, 0,
863 AC_VERB_SET_COEF_INDEX, 7);
864 tmp = snd_hda_codec_read(codec, 0x1a, 0,
865 AC_VERB_GET_PROC_COEF, 0);
866 snd_hda_codec_write(codec, 0x1a, 0,
867 AC_VERB_SET_COEF_INDEX, 7);
868 snd_hda_codec_write(codec, 0x1a, 0,
869 AC_VERB_SET_PROC_COEF,
878 snd_hda_codec_write(codec, 0x20, 0,
879 AC_VERB_SET_COEF_INDEX, 7);
880 tmp = snd_hda_codec_read(codec, 0x20, 0,
881 AC_VERB_GET_PROC_COEF, 0);
882 snd_hda_codec_write(codec, 0x20, 0,
883 AC_VERB_SET_COEF_INDEX, 7);
884 snd_hda_codec_write(codec, 0x20, 0,
885 AC_VERB_SET_PROC_COEF,
890 snd_hda_codec_write(codec, 0x20, 0,
891 AC_VERB_SET_COEF_INDEX, 7);
892 tmp = snd_hda_codec_read(codec, 0x20, 0,
893 AC_VERB_GET_PROC_COEF, 0);
894 snd_hda_codec_write(codec, 0x20, 0,
895 AC_VERB_SET_COEF_INDEX, 7);
896 snd_hda_codec_write(codec, 0x20, 0,
897 AC_VERB_SET_PROC_COEF,
905 /* is laptop or Desktop and enable the function "Mute internal speaker
906 * when the external headphone out jack is plugged"
911 * 10~8 : Jack location
912 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
914 * 15 : 1 --> enable the function "Mute internal speaker
915 * when the external headphone out jack is plugged"
917 if (!spec->autocfg.speaker_pins[0]) {
918 if (spec->autocfg.line_out_pins[0])
919 spec->autocfg.speaker_pins[0] =
920 spec->autocfg.line_out_pins[0];
925 if (!spec->autocfg.hp_pins[0]) {
926 tmp = (ass >> 11) & 0x3; /* HP to chassis */
928 spec->autocfg.hp_pins[0] = porta;
930 spec->autocfg.hp_pins[0] = porte;
932 spec->autocfg.hp_pins[0] = portd;
937 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
938 AC_VERB_SET_UNSOLICITED_ENABLE,
939 AC_USRSP_EN | ALC880_HP_EVENT);
940 spec->unsol_event = alc_sku_unsol_event;
941 spec->init_hook = alc_sku_automute;
945 * Fix-up pin default configurations
953 static void alc_fix_pincfg(struct hda_codec *codec,
954 const struct snd_pci_quirk *quirk,
955 const struct alc_pincfg **pinfix)
957 const struct alc_pincfg *cfg;
959 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
963 cfg = pinfix[quirk->value];
964 for (; cfg->nid; cfg++) {
967 for (i = 0; i < 4; i++) {
968 snd_hda_codec_write(codec, cfg->nid, 0,
969 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
977 * ALC880 3-stack model
979 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
980 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
981 * F-Mic = 0x1b, HP = 0x19
984 static hda_nid_t alc880_dac_nids[4] = {
985 /* front, rear, clfe, rear_surr */
986 0x02, 0x05, 0x04, 0x03
989 static hda_nid_t alc880_adc_nids[3] = {
994 /* The datasheet says the node 0x07 is connected from inputs,
995 * but it shows zero connection in the real implementation on some devices.
996 * Note: this is a 915GAV bug, fixed on 915GLV
998 static hda_nid_t alc880_adc_nids_alt[2] = {
1003 #define ALC880_DIGOUT_NID 0x06
1004 #define ALC880_DIGIN_NID 0x0a
1006 static struct hda_input_mux alc880_capture_source = {
1010 { "Front Mic", 0x3 },
1016 /* channel source setting (2/6 channel selection for 3-stack) */
1018 static struct hda_verb alc880_threestack_ch2_init[] = {
1019 /* set line-in to input, mute it */
1020 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1021 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1022 /* set mic-in to input vref 80%, mute it */
1023 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1024 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1029 static struct hda_verb alc880_threestack_ch6_init[] = {
1030 /* set line-in to output, unmute it */
1031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1032 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1033 /* set mic-in to output, unmute it */
1034 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1035 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1039 static struct hda_channel_mode alc880_threestack_modes[2] = {
1040 { 2, alc880_threestack_ch2_init },
1041 { 6, alc880_threestack_ch6_init },
1044 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1047 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1048 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1051 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1052 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1053 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1054 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1055 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1056 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1059 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1060 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1061 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1062 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1065 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1066 .name = "Channel Mode",
1067 .info = alc_ch_mode_info,
1068 .get = alc_ch_mode_get,
1069 .put = alc_ch_mode_put,
1074 /* capture mixer elements */
1075 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1076 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1077 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1078 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1079 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1080 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1081 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1084 /* The multiple "Capture Source" controls confuse alsamixer
1085 * So call somewhat different..
1087 /* .name = "Capture Source", */
1088 .name = "Input Source",
1090 .info = alc_mux_enum_info,
1091 .get = alc_mux_enum_get,
1092 .put = alc_mux_enum_put,
1097 /* capture mixer elements (in case NID 0x07 not available) */
1098 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1099 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1100 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1101 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1102 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1105 /* The multiple "Capture Source" controls confuse alsamixer
1106 * So call somewhat different..
1108 /* .name = "Capture Source", */
1109 .name = "Input Source",
1111 .info = alc_mux_enum_info,
1112 .get = alc_mux_enum_get,
1113 .put = alc_mux_enum_put,
1121 * ALC880 5-stack model
1123 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1125 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1126 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1129 /* additional mixers to alc880_three_stack_mixer */
1130 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1131 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1132 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1136 /* channel source setting (6/8 channel selection for 5-stack) */
1138 static struct hda_verb alc880_fivestack_ch6_init[] = {
1139 /* set line-in to input, mute it */
1140 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1141 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1146 static struct hda_verb alc880_fivestack_ch8_init[] = {
1147 /* set line-in to output, unmute it */
1148 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1149 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1153 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1154 { 6, alc880_fivestack_ch6_init },
1155 { 8, alc880_fivestack_ch8_init },
1160 * ALC880 6-stack model
1162 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1163 * Side = 0x05 (0x0f)
1164 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1165 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1168 static hda_nid_t alc880_6st_dac_nids[4] = {
1169 /* front, rear, clfe, rear_surr */
1170 0x02, 0x03, 0x04, 0x05
1173 static struct hda_input_mux alc880_6stack_capture_source = {
1177 { "Front Mic", 0x1 },
1183 /* fixed 8-channels */
1184 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1188 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1189 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1190 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1191 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1192 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1193 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1195 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1196 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1197 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1198 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1199 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1200 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1201 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1202 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1207 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1208 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1211 .name = "Channel Mode",
1212 .info = alc_ch_mode_info,
1213 .get = alc_ch_mode_get,
1214 .put = alc_ch_mode_put,
1223 * W810 has rear IO for:
1226 * Center/LFE (DAC 04)
1229 * The system also has a pair of internal speakers, and a headphone jack.
1230 * These are both connected to Line2 on the codec, hence to DAC 02.
1232 * There is a variable resistor to control the speaker or headphone
1233 * volume. This is a hardware-only device without a software API.
1235 * Plugging headphones in will disable the internal speakers. This is
1236 * implemented in hardware, not via the driver using jack sense. In
1237 * a similar fashion, plugging into the rear socket marked "front" will
1238 * disable both the speakers and headphones.
1240 * For input, there's a microphone jack, and an "audio in" jack.
1241 * These may not do anything useful with this driver yet, because I
1242 * haven't setup any initialization verbs for these yet...
1245 static hda_nid_t alc880_w810_dac_nids[3] = {
1246 /* front, rear/surround, clfe */
1250 /* fixed 6 channels */
1251 static struct hda_channel_mode alc880_w810_modes[1] = {
1255 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1256 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1258 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1259 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1260 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1261 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1262 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1263 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1264 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1273 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1274 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1278 static hda_nid_t alc880_z71v_dac_nids[1] = {
1281 #define ALC880_Z71V_HP_DAC 0x03
1283 /* fixed 2 channels */
1284 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1288 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1289 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1290 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1291 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1292 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1294 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1302 * ALC880 F1734 model
1304 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1305 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1308 static hda_nid_t alc880_f1734_dac_nids[1] = {
1311 #define ALC880_F1734_HP_DAC 0x02
1313 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1314 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1315 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1316 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1317 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1318 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1319 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1325 static struct hda_input_mux alc880_f1734_capture_source = {
1337 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1338 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1339 * Mic = 0x18, Line = 0x1a
1342 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1343 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1345 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1346 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1347 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1348 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1349 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1350 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1351 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1352 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1353 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1356 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1357 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1358 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1359 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1361 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1362 .name = "Channel Mode",
1363 .info = alc_ch_mode_info,
1364 .get = alc_ch_mode_get,
1365 .put = alc_ch_mode_put,
1371 * ALC880 ASUS W1V model
1373 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1374 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1375 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1378 /* additional mixers to alc880_asus_mixer */
1379 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1380 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1381 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1385 /* additional mixers to alc880_asus_mixer */
1386 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1387 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1388 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1393 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1394 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1395 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1396 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1397 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1398 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1401 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1402 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1404 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1405 /* The multiple "Capture Source" controls confuse alsamixer
1406 * So call somewhat different..
1408 /* .name = "Capture Source", */
1409 .name = "Input Source",
1411 .info = alc_mux_enum_info,
1412 .get = alc_mux_enum_get,
1413 .put = alc_mux_enum_put,
1419 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1420 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1421 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1422 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1423 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1424 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1425 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1426 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1427 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1430 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1431 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1434 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1436 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1437 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1439 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1440 .name = "Channel Mode",
1441 .info = alc_ch_mode_info,
1442 .get = alc_ch_mode_get,
1443 .put = alc_ch_mode_put,
1448 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1449 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1450 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1451 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1452 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1453 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1454 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1455 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1456 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1457 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1458 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1462 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1463 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1464 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1465 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1466 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1473 * virtual master controls
1477 * slave controls for virtual master
1479 static const char *alc_slave_vols[] = {
1480 "Front Playback Volume",
1481 "Surround Playback Volume",
1482 "Center Playback Volume",
1483 "LFE Playback Volume",
1484 "Side Playback Volume",
1485 "Headphone Playback Volume",
1486 "Speaker Playback Volume",
1487 "Mono Playback Volume",
1488 "Line-Out Playback Volume",
1492 static const char *alc_slave_sws[] = {
1493 "Front Playback Switch",
1494 "Surround Playback Switch",
1495 "Center Playback Switch",
1496 "LFE Playback Switch",
1497 "Side Playback Switch",
1498 "Headphone Playback Switch",
1499 "Speaker Playback Switch",
1500 "Mono Playback Switch",
1501 "IEC958 Playback Switch",
1506 * build control elements
1508 static int alc_build_controls(struct hda_codec *codec)
1510 struct alc_spec *spec = codec->spec;
1514 for (i = 0; i < spec->num_mixers; i++) {
1515 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1520 if (spec->multiout.dig_out_nid) {
1521 err = snd_hda_create_spdif_out_ctls(codec,
1522 spec->multiout.dig_out_nid);
1525 err = snd_hda_create_spdif_share_sw(codec,
1529 spec->multiout.share_spdif = 1;
1531 if (spec->dig_in_nid) {
1532 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1537 /* if we have no master control, let's create it */
1538 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1539 unsigned int vmaster_tlv[4];
1540 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1541 HDA_OUTPUT, vmaster_tlv);
1542 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1543 vmaster_tlv, alc_slave_vols);
1547 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1548 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1549 NULL, alc_slave_sws);
1559 * initialize the codec volumes, etc
1563 * generic initialization of ADC, input mixers and output mixers
1565 static struct hda_verb alc880_volume_init_verbs[] = {
1567 * Unmute ADC0-2 and set the default input to mic-in
1569 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1571 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1573 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1576 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1578 * Note: PASD motherboards uses the Line In 2 as the input for front
1581 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1586 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1591 * Set up output mixers (0x0c - 0x0f)
1593 /* set vol=0 to output mixers */
1594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1596 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1598 /* set up input amps for analog loopback */
1599 /* Amp Indices: DAC = 0, mixer = 1 */
1600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1604 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1606 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1607 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1613 * 3-stack pin configuration:
1614 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1616 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1618 * preset connection lists of input pins
1619 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1621 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1622 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1623 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1626 * Set pin mode and muting
1628 /* set front pin widgets 0x14 for output */
1629 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1630 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1631 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1632 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1634 /* Mic2 (as headphone out) for HP output */
1635 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1636 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1637 /* Line In pin widget for input */
1638 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1640 /* Line2 (as front mic) pin widget for input and vref at 80% */
1641 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1642 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1643 /* CD pin widget for input */
1644 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1650 * 5-stack pin configuration:
1651 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1652 * line-in/side = 0x1a, f-mic = 0x1b
1654 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1656 * preset connection lists of input pins
1657 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1659 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1660 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1663 * Set pin mode and muting
1665 /* set pin widgets 0x14-0x17 for output */
1666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1668 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1669 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1670 /* unmute pins for output (no gain on this amp) */
1671 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1673 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1674 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1676 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1677 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1678 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1679 /* Mic2 (as headphone out) for HP output */
1680 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1681 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1682 /* Line In pin widget for input */
1683 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1685 /* Line2 (as front mic) pin widget for input and vref at 80% */
1686 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1687 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1688 /* CD pin widget for input */
1689 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1695 * W810 pin configuration:
1696 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1698 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1699 /* hphone/speaker input selector: front DAC */
1700 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1707 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1709 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1710 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1716 * Z71V pin configuration:
1717 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1719 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1720 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1721 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1725 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1728 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1734 * 6-stack pin configuration:
1735 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1736 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1738 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1739 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1741 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1742 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1745 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1747 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1748 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1752 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1756 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1757 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1764 * Uniwill pin configuration:
1765 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1768 static struct hda_verb alc880_uniwill_init_verbs[] = {
1769 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1775 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1777 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1778 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1780 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1781 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1782 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1784 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1786 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1787 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1788 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1789 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1790 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1791 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1792 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1793 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1797 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1804 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1806 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1807 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1809 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1810 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1813 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1814 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1822 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1824 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1826 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1829 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1830 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1835 static struct hda_verb alc880_beep_init_verbs[] = {
1836 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1840 /* toggle speaker-output according to the hp-jack state */
1841 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1843 unsigned int present;
1846 present = snd_hda_codec_read(codec, 0x14, 0,
1847 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1848 bits = present ? HDA_AMP_MUTE : 0;
1849 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1850 HDA_AMP_MUTE, bits);
1851 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1852 HDA_AMP_MUTE, bits);
1855 /* auto-toggle front mic */
1856 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1858 unsigned int present;
1861 present = snd_hda_codec_read(codec, 0x18, 0,
1862 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1863 bits = present ? HDA_AMP_MUTE : 0;
1864 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1867 static void alc880_uniwill_automute(struct hda_codec *codec)
1869 alc880_uniwill_hp_automute(codec);
1870 alc880_uniwill_mic_automute(codec);
1873 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1876 /* Looks like the unsol event is incompatible with the standard
1877 * definition. 4bit tag is placed at 28 bit!
1879 switch (res >> 28) {
1880 case ALC880_HP_EVENT:
1881 alc880_uniwill_hp_automute(codec);
1883 case ALC880_MIC_EVENT:
1884 alc880_uniwill_mic_automute(codec);
1889 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1891 unsigned int present;
1894 present = snd_hda_codec_read(codec, 0x14, 0,
1895 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1896 bits = present ? HDA_AMP_MUTE : 0;
1897 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1900 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1902 unsigned int present;
1904 present = snd_hda_codec_read(codec, 0x21, 0,
1905 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1906 present &= HDA_AMP_VOLMASK;
1907 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1908 HDA_AMP_VOLMASK, present);
1909 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1910 HDA_AMP_VOLMASK, present);
1913 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1916 /* Looks like the unsol event is incompatible with the standard
1917 * definition. 4bit tag is placed at 28 bit!
1919 if ((res >> 28) == ALC880_HP_EVENT)
1920 alc880_uniwill_p53_hp_automute(codec);
1921 if ((res >> 28) == ALC880_DCVOL_EVENT)
1922 alc880_uniwill_p53_dcvol_automute(codec);
1926 * F1734 pin configuration:
1927 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1929 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1930 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
1931 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1932 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1933 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1934 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1936 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1937 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1941 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1942 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1943 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1944 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1945 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1946 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1947 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1948 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1949 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1951 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
1952 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
1958 * ASUS pin configuration:
1959 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1961 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1962 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1963 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1964 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1965 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1967 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1968 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1970 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1971 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1972 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1973 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1976 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1978 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1979 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1980 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1981 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1982 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1984 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1989 /* Enable GPIO mask and set output */
1990 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1991 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1993 /* Clevo m520g init */
1994 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1995 /* headphone output */
1996 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1998 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1999 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2004 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2005 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2006 /* Mic1 (rear panel) */
2007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2009 /* Mic2 (front panel) */
2010 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2011 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2013 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2014 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2015 /* change to EAPD mode */
2016 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2017 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2022 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2023 /* change to EAPD mode */
2024 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2025 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2027 /* Headphone output */
2028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2030 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2031 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2033 /* Line In pin widget for input */
2034 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2035 /* CD pin widget for input */
2036 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2037 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2040 /* change to EAPD mode */
2041 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2042 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2048 * LG m1 express dual
2051 * Rear Line-In/Out (blue): 0x14
2052 * Build-in Mic-In: 0x15
2054 * HP-Out (green): 0x1b
2055 * Mic-In/Out (red): 0x19
2059 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2060 static hda_nid_t alc880_lg_dac_nids[3] = {
2064 /* seems analog CD is not working */
2065 static struct hda_input_mux alc880_lg_capture_source = {
2070 { "Internal Mic", 0x6 },
2074 /* 2,4,6 channel modes */
2075 static struct hda_verb alc880_lg_ch2_init[] = {
2076 /* set line-in and mic-in to input */
2077 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2078 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2082 static struct hda_verb alc880_lg_ch4_init[] = {
2083 /* set line-in to out and mic-in to input */
2084 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2085 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2089 static struct hda_verb alc880_lg_ch6_init[] = {
2090 /* set line-in and mic-in to output */
2091 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2092 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2096 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2097 { 2, alc880_lg_ch2_init },
2098 { 4, alc880_lg_ch4_init },
2099 { 6, alc880_lg_ch6_init },
2102 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2103 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2104 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2105 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2106 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2107 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2108 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2109 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2110 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2114 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2115 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2116 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2119 .name = "Channel Mode",
2120 .info = alc_ch_mode_info,
2121 .get = alc_ch_mode_get,
2122 .put = alc_ch_mode_put,
2127 static struct hda_verb alc880_lg_init_verbs[] = {
2128 /* set capture source to mic-in */
2129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2132 /* mute all amp mixer inputs */
2133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2136 /* line-in to input */
2137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2138 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2140 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2143 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2144 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2145 /* mic-in to input */
2146 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2147 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2148 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2150 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2151 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2152 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2154 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2158 /* toggle speaker-output according to the hp-jack state */
2159 static void alc880_lg_automute(struct hda_codec *codec)
2161 unsigned int present;
2164 present = snd_hda_codec_read(codec, 0x1b, 0,
2165 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2166 bits = present ? HDA_AMP_MUTE : 0;
2167 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2168 HDA_AMP_MUTE, bits);
2171 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2173 /* Looks like the unsol event is incompatible with the standard
2174 * definition. 4bit tag is placed at 28 bit!
2176 if ((res >> 28) == 0x01)
2177 alc880_lg_automute(codec);
2186 * Built-in Mic-In: 0x19
2192 static struct hda_input_mux alc880_lg_lw_capture_source = {
2196 { "Internal Mic", 0x1 },
2201 #define alc880_lg_lw_modes alc880_threestack_modes
2203 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2205 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2206 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2207 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2208 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2209 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2210 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2211 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2215 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2216 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2217 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2220 .name = "Channel Mode",
2221 .info = alc_ch_mode_info,
2222 .get = alc_ch_mode_get,
2223 .put = alc_ch_mode_put,
2228 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2229 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2230 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2231 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2233 /* set capture source to mic-in */
2234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2236 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2239 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2240 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2243 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2244 /* mic-in to input */
2245 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2246 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2248 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2249 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2251 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2255 /* toggle speaker-output according to the hp-jack state */
2256 static void alc880_lg_lw_automute(struct hda_codec *codec)
2258 unsigned int present;
2261 present = snd_hda_codec_read(codec, 0x1b, 0,
2262 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2263 bits = present ? HDA_AMP_MUTE : 0;
2264 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2265 HDA_AMP_MUTE, bits);
2268 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2270 /* Looks like the unsol event is incompatible with the standard
2271 * definition. 4bit tag is placed at 28 bit!
2273 if ((res >> 28) == 0x01)
2274 alc880_lg_lw_automute(codec);
2277 #ifdef CONFIG_SND_HDA_POWER_SAVE
2278 static struct hda_amp_list alc880_loopbacks[] = {
2279 { 0x0b, HDA_INPUT, 0 },
2280 { 0x0b, HDA_INPUT, 1 },
2281 { 0x0b, HDA_INPUT, 2 },
2282 { 0x0b, HDA_INPUT, 3 },
2283 { 0x0b, HDA_INPUT, 4 },
2287 static struct hda_amp_list alc880_lg_loopbacks[] = {
2288 { 0x0b, HDA_INPUT, 1 },
2289 { 0x0b, HDA_INPUT, 6 },
2290 { 0x0b, HDA_INPUT, 7 },
2299 static int alc_init(struct hda_codec *codec)
2301 struct alc_spec *spec = codec->spec;
2304 for (i = 0; i < spec->num_init_verbs; i++)
2305 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2307 if (spec->init_hook)
2308 spec->init_hook(codec);
2313 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2315 struct alc_spec *spec = codec->spec;
2317 if (spec->unsol_event)
2318 spec->unsol_event(codec, res);
2321 #ifdef CONFIG_SND_HDA_POWER_SAVE
2322 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2324 struct alc_spec *spec = codec->spec;
2325 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2330 * Analog playback callbacks
2332 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2333 struct hda_codec *codec,
2334 struct snd_pcm_substream *substream)
2336 struct alc_spec *spec = codec->spec;
2337 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2341 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2342 struct hda_codec *codec,
2343 unsigned int stream_tag,
2344 unsigned int format,
2345 struct snd_pcm_substream *substream)
2347 struct alc_spec *spec = codec->spec;
2348 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2349 stream_tag, format, substream);
2352 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2353 struct hda_codec *codec,
2354 struct snd_pcm_substream *substream)
2356 struct alc_spec *spec = codec->spec;
2357 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2363 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2364 struct hda_codec *codec,
2365 struct snd_pcm_substream *substream)
2367 struct alc_spec *spec = codec->spec;
2368 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2371 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2372 struct hda_codec *codec,
2373 unsigned int stream_tag,
2374 unsigned int format,
2375 struct snd_pcm_substream *substream)
2377 struct alc_spec *spec = codec->spec;
2378 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2379 stream_tag, format, substream);
2382 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2383 struct hda_codec *codec,
2384 struct snd_pcm_substream *substream)
2386 struct alc_spec *spec = codec->spec;
2387 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2393 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2394 struct hda_codec *codec,
2395 unsigned int stream_tag,
2396 unsigned int format,
2397 struct snd_pcm_substream *substream)
2399 struct alc_spec *spec = codec->spec;
2401 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2402 stream_tag, 0, format);
2406 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2407 struct hda_codec *codec,
2408 struct snd_pcm_substream *substream)
2410 struct alc_spec *spec = codec->spec;
2412 snd_hda_codec_cleanup_stream(codec,
2413 spec->adc_nids[substream->number + 1]);
2420 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2424 /* NID is set in alc_build_pcms */
2426 .open = alc880_playback_pcm_open,
2427 .prepare = alc880_playback_pcm_prepare,
2428 .cleanup = alc880_playback_pcm_cleanup
2432 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2436 /* NID is set in alc_build_pcms */
2439 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2443 /* NID is set in alc_build_pcms */
2446 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2447 .substreams = 2, /* can be overridden */
2450 /* NID is set in alc_build_pcms */
2452 .prepare = alc880_alt_capture_pcm_prepare,
2453 .cleanup = alc880_alt_capture_pcm_cleanup
2457 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2461 /* NID is set in alc_build_pcms */
2463 .open = alc880_dig_playback_pcm_open,
2464 .close = alc880_dig_playback_pcm_close,
2465 .prepare = alc880_dig_playback_pcm_prepare
2469 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2473 /* NID is set in alc_build_pcms */
2476 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2477 static struct hda_pcm_stream alc_pcm_null_stream = {
2483 static int alc_build_pcms(struct hda_codec *codec)
2485 struct alc_spec *spec = codec->spec;
2486 struct hda_pcm *info = spec->pcm_rec;
2489 codec->num_pcms = 1;
2490 codec->pcm_info = info;
2492 info->name = spec->stream_name_analog;
2493 if (spec->stream_analog_playback) {
2494 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2495 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2496 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2498 if (spec->stream_analog_capture) {
2499 snd_assert(spec->adc_nids, return -EINVAL);
2500 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2501 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2504 if (spec->channel_mode) {
2505 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2506 for (i = 0; i < spec->num_channel_mode; i++) {
2507 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2508 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2513 /* SPDIF for stream index #1 */
2514 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2515 codec->num_pcms = 2;
2516 info = spec->pcm_rec + 1;
2517 info->name = spec->stream_name_digital;
2518 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2519 if (spec->multiout.dig_out_nid &&
2520 spec->stream_digital_playback) {
2521 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2522 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2524 if (spec->dig_in_nid &&
2525 spec->stream_digital_capture) {
2526 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2527 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2531 /* If the use of more than one ADC is requested for the current
2532 * model, configure a second analog capture-only PCM.
2534 /* Additional Analaog capture for index #2 */
2535 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2536 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2537 codec->num_pcms = 3;
2538 info = spec->pcm_rec + 2;
2539 info->name = spec->stream_name_analog;
2540 if (spec->alt_dac_nid) {
2541 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2542 *spec->stream_analog_alt_playback;
2543 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2546 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2547 alc_pcm_null_stream;
2548 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2550 if (spec->num_adc_nids > 1) {
2551 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2552 *spec->stream_analog_alt_capture;
2553 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2555 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2556 spec->num_adc_nids - 1;
2558 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2559 alc_pcm_null_stream;
2560 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2567 static void alc_free(struct hda_codec *codec)
2569 struct alc_spec *spec = codec->spec;
2575 if (spec->kctl_alloc) {
2576 for (i = 0; i < spec->num_kctl_used; i++)
2577 kfree(spec->kctl_alloc[i].name);
2578 kfree(spec->kctl_alloc);
2585 static struct hda_codec_ops alc_patch_ops = {
2586 .build_controls = alc_build_controls,
2587 .build_pcms = alc_build_pcms,
2590 .unsol_event = alc_unsol_event,
2591 #ifdef CONFIG_SND_HDA_POWER_SAVE
2592 .check_power_status = alc_check_power_status,
2598 * Test configuration for debugging
2600 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2603 #ifdef CONFIG_SND_DEBUG
2604 static hda_nid_t alc880_test_dac_nids[4] = {
2605 0x02, 0x03, 0x04, 0x05
2608 static struct hda_input_mux alc880_test_capture_source = {
2617 { "Surround", 0x6 },
2621 static struct hda_channel_mode alc880_test_modes[4] = {
2628 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2629 struct snd_ctl_elem_info *uinfo)
2631 static char *texts[] = {
2632 "N/A", "Line Out", "HP Out",
2633 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2635 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2637 uinfo->value.enumerated.items = 8;
2638 if (uinfo->value.enumerated.item >= 8)
2639 uinfo->value.enumerated.item = 7;
2640 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2644 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2645 struct snd_ctl_elem_value *ucontrol)
2647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2648 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2649 unsigned int pin_ctl, item = 0;
2651 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2652 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2653 if (pin_ctl & AC_PINCTL_OUT_EN) {
2654 if (pin_ctl & AC_PINCTL_HP_EN)
2658 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2659 switch (pin_ctl & AC_PINCTL_VREFEN) {
2660 case AC_PINCTL_VREF_HIZ: item = 3; break;
2661 case AC_PINCTL_VREF_50: item = 4; break;
2662 case AC_PINCTL_VREF_GRD: item = 5; break;
2663 case AC_PINCTL_VREF_80: item = 6; break;
2664 case AC_PINCTL_VREF_100: item = 7; break;
2667 ucontrol->value.enumerated.item[0] = item;
2671 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2672 struct snd_ctl_elem_value *ucontrol)
2674 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2675 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2676 static unsigned int ctls[] = {
2677 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2678 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2679 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2680 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2681 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2682 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2684 unsigned int old_ctl, new_ctl;
2686 old_ctl = snd_hda_codec_read(codec, nid, 0,
2687 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2688 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2689 if (old_ctl != new_ctl) {
2691 snd_hda_codec_write_cache(codec, nid, 0,
2692 AC_VERB_SET_PIN_WIDGET_CONTROL,
2694 val = ucontrol->value.enumerated.item[0] >= 3 ?
2696 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2703 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2704 struct snd_ctl_elem_info *uinfo)
2706 static char *texts[] = {
2707 "Front", "Surround", "CLFE", "Side"
2709 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2711 uinfo->value.enumerated.items = 4;
2712 if (uinfo->value.enumerated.item >= 4)
2713 uinfo->value.enumerated.item = 3;
2714 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2718 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2719 struct snd_ctl_elem_value *ucontrol)
2721 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2722 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2725 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2726 ucontrol->value.enumerated.item[0] = sel & 3;
2730 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2731 struct snd_ctl_elem_value *ucontrol)
2733 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2734 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2737 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2738 if (ucontrol->value.enumerated.item[0] != sel) {
2739 sel = ucontrol->value.enumerated.item[0] & 3;
2740 snd_hda_codec_write_cache(codec, nid, 0,
2741 AC_VERB_SET_CONNECT_SEL, sel);
2747 #define PIN_CTL_TEST(xname,nid) { \
2748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2750 .info = alc_test_pin_ctl_info, \
2751 .get = alc_test_pin_ctl_get, \
2752 .put = alc_test_pin_ctl_put, \
2753 .private_value = nid \
2756 #define PIN_SRC_TEST(xname,nid) { \
2757 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2759 .info = alc_test_pin_src_info, \
2760 .get = alc_test_pin_src_get, \
2761 .put = alc_test_pin_src_put, \
2762 .private_value = nid \
2765 static struct snd_kcontrol_new alc880_test_mixer[] = {
2766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2767 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2768 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2769 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2770 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2771 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2772 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2773 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2774 PIN_CTL_TEST("Front Pin Mode", 0x14),
2775 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2776 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2777 PIN_CTL_TEST("Side Pin Mode", 0x17),
2778 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2779 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2780 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2781 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2782 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2783 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2784 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2785 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2786 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2787 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2788 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2789 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2790 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2791 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2792 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2793 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2794 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2795 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2797 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2798 .name = "Channel Mode",
2799 .info = alc_ch_mode_info,
2800 .get = alc_ch_mode_get,
2801 .put = alc_ch_mode_put,
2806 static struct hda_verb alc880_test_init_verbs[] = {
2807 /* Unmute inputs of 0x0c - 0x0f */
2808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2812 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2813 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2814 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2815 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2816 /* Vol output for 0x0c-0x0f */
2817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2820 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2821 /* Set output pins 0x14-0x17 */
2822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2824 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2825 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2826 /* Unmute output pins 0x14-0x17 */
2827 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2829 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2830 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2831 /* Set input pins 0x18-0x1c */
2832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2833 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2834 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2835 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2836 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2837 /* Mute input pins 0x18-0x1b */
2838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2840 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2841 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2844 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2845 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2846 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2847 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2848 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2849 /* Analog input/passthru */
2850 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2851 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2862 static const char *alc880_models[ALC880_MODEL_LAST] = {
2863 [ALC880_3ST] = "3stack",
2864 [ALC880_TCL_S700] = "tcl",
2865 [ALC880_3ST_DIG] = "3stack-digout",
2866 [ALC880_CLEVO] = "clevo",
2867 [ALC880_5ST] = "5stack",
2868 [ALC880_5ST_DIG] = "5stack-digout",
2869 [ALC880_W810] = "w810",
2870 [ALC880_Z71V] = "z71v",
2871 [ALC880_6ST] = "6stack",
2872 [ALC880_6ST_DIG] = "6stack-digout",
2873 [ALC880_ASUS] = "asus",
2874 [ALC880_ASUS_W1V] = "asus-w1v",
2875 [ALC880_ASUS_DIG] = "asus-dig",
2876 [ALC880_ASUS_DIG2] = "asus-dig2",
2877 [ALC880_UNIWILL_DIG] = "uniwill",
2878 [ALC880_UNIWILL_P53] = "uniwill-p53",
2879 [ALC880_FUJITSU] = "fujitsu",
2880 [ALC880_F1734] = "F1734",
2882 [ALC880_LG_LW] = "lg-lw",
2883 #ifdef CONFIG_SND_DEBUG
2884 [ALC880_TEST] = "test",
2886 [ALC880_AUTO] = "auto",
2889 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2890 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2891 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2892 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2893 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2894 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2895 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2896 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2897 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2898 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2899 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2900 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2901 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2902 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2903 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2904 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2905 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2906 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2907 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2908 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2909 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2910 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2911 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2912 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2913 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2914 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2915 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2916 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2917 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2918 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2919 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2920 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2921 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2922 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2923 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2924 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2925 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2926 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2927 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2928 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2929 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2930 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2931 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2932 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2933 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2934 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2935 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2936 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2937 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2938 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2939 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2940 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2941 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2942 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2943 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2944 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2945 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2946 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2947 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2948 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2949 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2950 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2951 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2952 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2953 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2954 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2955 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2956 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2957 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2958 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2963 * ALC880 codec presets
2965 static struct alc_config_preset alc880_presets[] = {
2967 .mixers = { alc880_three_stack_mixer },
2968 .init_verbs = { alc880_volume_init_verbs,
2969 alc880_pin_3stack_init_verbs },
2970 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2971 .dac_nids = alc880_dac_nids,
2972 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2973 .channel_mode = alc880_threestack_modes,
2975 .input_mux = &alc880_capture_source,
2977 [ALC880_3ST_DIG] = {
2978 .mixers = { alc880_three_stack_mixer },
2979 .init_verbs = { alc880_volume_init_verbs,
2980 alc880_pin_3stack_init_verbs },
2981 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2982 .dac_nids = alc880_dac_nids,
2983 .dig_out_nid = ALC880_DIGOUT_NID,
2984 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2985 .channel_mode = alc880_threestack_modes,
2987 .input_mux = &alc880_capture_source,
2989 [ALC880_TCL_S700] = {
2990 .mixers = { alc880_tcl_s700_mixer },
2991 .init_verbs = { alc880_volume_init_verbs,
2992 alc880_pin_tcl_S700_init_verbs,
2993 alc880_gpio2_init_verbs },
2994 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2995 .dac_nids = alc880_dac_nids,
2997 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2998 .channel_mode = alc880_2_jack_modes,
2999 .input_mux = &alc880_capture_source,
3002 .mixers = { alc880_three_stack_mixer,
3003 alc880_five_stack_mixer},
3004 .init_verbs = { alc880_volume_init_verbs,
3005 alc880_pin_5stack_init_verbs },
3006 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3007 .dac_nids = alc880_dac_nids,
3008 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3009 .channel_mode = alc880_fivestack_modes,
3010 .input_mux = &alc880_capture_source,
3012 [ALC880_5ST_DIG] = {
3013 .mixers = { alc880_three_stack_mixer,
3014 alc880_five_stack_mixer },
3015 .init_verbs = { alc880_volume_init_verbs,
3016 alc880_pin_5stack_init_verbs },
3017 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3018 .dac_nids = alc880_dac_nids,
3019 .dig_out_nid = ALC880_DIGOUT_NID,
3020 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3021 .channel_mode = alc880_fivestack_modes,
3022 .input_mux = &alc880_capture_source,
3025 .mixers = { alc880_six_stack_mixer },
3026 .init_verbs = { alc880_volume_init_verbs,
3027 alc880_pin_6stack_init_verbs },
3028 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3029 .dac_nids = alc880_6st_dac_nids,
3030 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3031 .channel_mode = alc880_sixstack_modes,
3032 .input_mux = &alc880_6stack_capture_source,
3034 [ALC880_6ST_DIG] = {
3035 .mixers = { alc880_six_stack_mixer },
3036 .init_verbs = { alc880_volume_init_verbs,
3037 alc880_pin_6stack_init_verbs },
3038 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3039 .dac_nids = alc880_6st_dac_nids,
3040 .dig_out_nid = ALC880_DIGOUT_NID,
3041 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3042 .channel_mode = alc880_sixstack_modes,
3043 .input_mux = &alc880_6stack_capture_source,
3046 .mixers = { alc880_w810_base_mixer },
3047 .init_verbs = { alc880_volume_init_verbs,
3048 alc880_pin_w810_init_verbs,
3049 alc880_gpio2_init_verbs },
3050 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3051 .dac_nids = alc880_w810_dac_nids,
3052 .dig_out_nid = ALC880_DIGOUT_NID,
3053 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3054 .channel_mode = alc880_w810_modes,
3055 .input_mux = &alc880_capture_source,
3058 .mixers = { alc880_z71v_mixer },
3059 .init_verbs = { alc880_volume_init_verbs,
3060 alc880_pin_z71v_init_verbs },
3061 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3062 .dac_nids = alc880_z71v_dac_nids,
3063 .dig_out_nid = ALC880_DIGOUT_NID,
3065 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3066 .channel_mode = alc880_2_jack_modes,
3067 .input_mux = &alc880_capture_source,
3070 .mixers = { alc880_f1734_mixer },
3071 .init_verbs = { alc880_volume_init_verbs,
3072 alc880_pin_f1734_init_verbs },
3073 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3074 .dac_nids = alc880_f1734_dac_nids,
3076 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3077 .channel_mode = alc880_2_jack_modes,
3078 .input_mux = &alc880_f1734_capture_source,
3079 .unsol_event = alc880_uniwill_p53_unsol_event,
3080 .init_hook = alc880_uniwill_p53_hp_automute,
3083 .mixers = { alc880_asus_mixer },
3084 .init_verbs = { alc880_volume_init_verbs,
3085 alc880_pin_asus_init_verbs,
3086 alc880_gpio1_init_verbs },
3087 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3088 .dac_nids = alc880_asus_dac_nids,
3089 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3090 .channel_mode = alc880_asus_modes,
3092 .input_mux = &alc880_capture_source,
3094 [ALC880_ASUS_DIG] = {
3095 .mixers = { alc880_asus_mixer },
3096 .init_verbs = { alc880_volume_init_verbs,
3097 alc880_pin_asus_init_verbs,
3098 alc880_gpio1_init_verbs },
3099 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3100 .dac_nids = alc880_asus_dac_nids,
3101 .dig_out_nid = ALC880_DIGOUT_NID,
3102 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3103 .channel_mode = alc880_asus_modes,
3105 .input_mux = &alc880_capture_source,
3107 [ALC880_ASUS_DIG2] = {
3108 .mixers = { alc880_asus_mixer },
3109 .init_verbs = { alc880_volume_init_verbs,
3110 alc880_pin_asus_init_verbs,
3111 alc880_gpio2_init_verbs }, /* use GPIO2 */
3112 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3113 .dac_nids = alc880_asus_dac_nids,
3114 .dig_out_nid = ALC880_DIGOUT_NID,
3115 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3116 .channel_mode = alc880_asus_modes,
3118 .input_mux = &alc880_capture_source,
3120 [ALC880_ASUS_W1V] = {
3121 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3122 .init_verbs = { alc880_volume_init_verbs,
3123 alc880_pin_asus_init_verbs,
3124 alc880_gpio1_init_verbs },
3125 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3126 .dac_nids = alc880_asus_dac_nids,
3127 .dig_out_nid = ALC880_DIGOUT_NID,
3128 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3129 .channel_mode = alc880_asus_modes,
3131 .input_mux = &alc880_capture_source,
3133 [ALC880_UNIWILL_DIG] = {
3134 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3135 .init_verbs = { alc880_volume_init_verbs,
3136 alc880_pin_asus_init_verbs },
3137 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3138 .dac_nids = alc880_asus_dac_nids,
3139 .dig_out_nid = ALC880_DIGOUT_NID,
3140 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3141 .channel_mode = alc880_asus_modes,
3143 .input_mux = &alc880_capture_source,
3145 [ALC880_UNIWILL] = {
3146 .mixers = { alc880_uniwill_mixer },
3147 .init_verbs = { alc880_volume_init_verbs,
3148 alc880_uniwill_init_verbs },
3149 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3150 .dac_nids = alc880_asus_dac_nids,
3151 .dig_out_nid = ALC880_DIGOUT_NID,
3152 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3153 .channel_mode = alc880_threestack_modes,
3155 .input_mux = &alc880_capture_source,
3156 .unsol_event = alc880_uniwill_unsol_event,
3157 .init_hook = alc880_uniwill_automute,
3159 [ALC880_UNIWILL_P53] = {
3160 .mixers = { alc880_uniwill_p53_mixer },
3161 .init_verbs = { alc880_volume_init_verbs,
3162 alc880_uniwill_p53_init_verbs },
3163 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3164 .dac_nids = alc880_asus_dac_nids,
3165 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3166 .channel_mode = alc880_threestack_modes,
3167 .input_mux = &alc880_capture_source,
3168 .unsol_event = alc880_uniwill_p53_unsol_event,
3169 .init_hook = alc880_uniwill_p53_hp_automute,
3171 [ALC880_FUJITSU] = {
3172 .mixers = { alc880_fujitsu_mixer,
3173 alc880_pcbeep_mixer, },
3174 .init_verbs = { alc880_volume_init_verbs,
3175 alc880_uniwill_p53_init_verbs,
3176 alc880_beep_init_verbs },
3177 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3178 .dac_nids = alc880_dac_nids,
3179 .dig_out_nid = ALC880_DIGOUT_NID,
3180 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3181 .channel_mode = alc880_2_jack_modes,
3182 .input_mux = &alc880_capture_source,
3183 .unsol_event = alc880_uniwill_p53_unsol_event,
3184 .init_hook = alc880_uniwill_p53_hp_automute,
3187 .mixers = { alc880_three_stack_mixer },
3188 .init_verbs = { alc880_volume_init_verbs,
3189 alc880_pin_clevo_init_verbs },
3190 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3191 .dac_nids = alc880_dac_nids,
3193 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3194 .channel_mode = alc880_threestack_modes,
3196 .input_mux = &alc880_capture_source,
3199 .mixers = { alc880_lg_mixer },
3200 .init_verbs = { alc880_volume_init_verbs,
3201 alc880_lg_init_verbs },
3202 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3203 .dac_nids = alc880_lg_dac_nids,
3204 .dig_out_nid = ALC880_DIGOUT_NID,
3205 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3206 .channel_mode = alc880_lg_ch_modes,
3208 .input_mux = &alc880_lg_capture_source,
3209 .unsol_event = alc880_lg_unsol_event,
3210 .init_hook = alc880_lg_automute,
3211 #ifdef CONFIG_SND_HDA_POWER_SAVE
3212 .loopbacks = alc880_lg_loopbacks,
3216 .mixers = { alc880_lg_lw_mixer },
3217 .init_verbs = { alc880_volume_init_verbs,
3218 alc880_lg_lw_init_verbs },
3219 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3220 .dac_nids = alc880_dac_nids,
3221 .dig_out_nid = ALC880_DIGOUT_NID,
3222 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3223 .channel_mode = alc880_lg_lw_modes,
3224 .input_mux = &alc880_lg_lw_capture_source,
3225 .unsol_event = alc880_lg_lw_unsol_event,
3226 .init_hook = alc880_lg_lw_automute,
3228 #ifdef CONFIG_SND_DEBUG
3230 .mixers = { alc880_test_mixer },
3231 .init_verbs = { alc880_test_init_verbs },
3232 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3233 .dac_nids = alc880_test_dac_nids,
3234 .dig_out_nid = ALC880_DIGOUT_NID,
3235 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3236 .channel_mode = alc880_test_modes,
3237 .input_mux = &alc880_test_capture_source,
3243 * Automatic parse of I/O pins from the BIOS configuration
3246 #define NUM_CONTROL_ALLOC 32
3247 #define NUM_VERB_ALLOC 32
3251 ALC_CTL_WIDGET_MUTE,
3254 static struct snd_kcontrol_new alc880_control_templates[] = {
3255 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3256 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3257 HDA_BIND_MUTE(NULL, 0, 0, 0),
3260 /* add dynamic controls */
3261 static int add_control(struct alc_spec *spec, int type, const char *name,
3264 struct snd_kcontrol_new *knew;
3266 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3267 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3269 /* array + terminator */
3270 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3273 if (spec->kctl_alloc) {
3274 memcpy(knew, spec->kctl_alloc,
3275 sizeof(*knew) * spec->num_kctl_alloc);
3276 kfree(spec->kctl_alloc);
3278 spec->kctl_alloc = knew;
3279 spec->num_kctl_alloc = num;
3282 knew = &spec->kctl_alloc[spec->num_kctl_used];
3283 *knew = alc880_control_templates[type];
3284 knew->name = kstrdup(name, GFP_KERNEL);
3287 knew->private_value = val;
3288 spec->num_kctl_used++;
3292 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3293 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3294 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3295 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3296 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3297 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3298 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3299 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3300 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3301 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3302 #define ALC880_PIN_CD_NID 0x1c
3304 /* fill in the dac_nids table from the parsed pin configuration */
3305 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3306 const struct auto_pin_cfg *cfg)
3312 memset(assigned, 0, sizeof(assigned));
3313 spec->multiout.dac_nids = spec->private_dac_nids;
3315 /* check the pins hardwired to audio widget */
3316 for (i = 0; i < cfg->line_outs; i++) {
3317 nid = cfg->line_out_pins[i];
3318 if (alc880_is_fixed_pin(nid)) {
3319 int idx = alc880_fixed_pin_idx(nid);
3320 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3324 /* left pins can be connect to any audio widget */
3325 for (i = 0; i < cfg->line_outs; i++) {
3326 nid = cfg->line_out_pins[i];
3327 if (alc880_is_fixed_pin(nid))
3329 /* search for an empty channel */
3330 for (j = 0; j < cfg->line_outs; j++) {
3332 spec->multiout.dac_nids[i] =
3333 alc880_idx_to_dac(j);
3339 spec->multiout.num_dacs = cfg->line_outs;
3343 /* add playback controls from the parsed DAC table */
3344 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3345 const struct auto_pin_cfg *cfg)
3348 static const char *chname[4] = {
3349 "Front", "Surround", NULL /*CLFE*/, "Side"
3354 for (i = 0; i < cfg->line_outs; i++) {
3355 if (!spec->multiout.dac_nids[i])
3357 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3360 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3361 "Center Playback Volume",
3362 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3366 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3367 "LFE Playback Volume",
3368 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3372 err = add_control(spec, ALC_CTL_BIND_MUTE,
3373 "Center Playback Switch",
3374 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3378 err = add_control(spec, ALC_CTL_BIND_MUTE,
3379 "LFE Playback Switch",
3380 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3385 sprintf(name, "%s Playback Volume", chname[i]);
3386 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3387 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3391 sprintf(name, "%s Playback Switch", chname[i]);
3392 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3393 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3402 /* add playback controls for speaker and HP outputs */
3403 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3413 if (alc880_is_fixed_pin(pin)) {
3414 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3415 /* specify the DAC as the extra output */
3416 if (!spec->multiout.hp_nid)
3417 spec->multiout.hp_nid = nid;
3419 spec->multiout.extra_out_nid[0] = nid;
3420 /* control HP volume/switch on the output mixer amp */
3421 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3422 sprintf(name, "%s Playback Volume", pfx);
3423 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3424 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3427 sprintf(name, "%s Playback Switch", pfx);
3428 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3429 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3432 } else if (alc880_is_multi_pin(pin)) {
3433 /* set manual connection */
3434 /* we have only a switch on HP-out PIN */
3435 sprintf(name, "%s Playback Switch", pfx);
3436 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3437 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3444 /* create input playback/capture controls for the given pin */
3445 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3446 const char *ctlname,
3447 int idx, hda_nid_t mix_nid)
3452 sprintf(name, "%s Playback Volume", ctlname);
3453 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3454 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3457 sprintf(name, "%s Playback Switch", ctlname);
3458 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3459 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3465 /* create playback/capture controls for input pins */
3466 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3467 const struct auto_pin_cfg *cfg)
3469 struct hda_input_mux *imux = &spec->private_imux;
3472 for (i = 0; i < AUTO_PIN_LAST; i++) {
3473 if (alc880_is_input_pin(cfg->input_pins[i])) {
3474 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3475 err = new_analog_input(spec, cfg->input_pins[i],
3476 auto_pin_cfg_labels[i],
3480 imux->items[imux->num_items].label =
3481 auto_pin_cfg_labels[i];
3482 imux->items[imux->num_items].index =
3483 alc880_input_pin_idx(cfg->input_pins[i]);
3490 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3491 unsigned int pin_type)
3493 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3496 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3500 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3501 hda_nid_t nid, int pin_type,
3504 alc_set_pin_output(codec, nid, pin_type);
3505 /* need the manual connection? */
3506 if (alc880_is_multi_pin(nid)) {
3507 struct alc_spec *spec = codec->spec;
3508 int idx = alc880_multi_pin_idx(nid);
3509 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3510 AC_VERB_SET_CONNECT_SEL,
3511 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3515 static int get_pin_type(int line_out_type)
3517 if (line_out_type == AUTO_PIN_HP_OUT)
3523 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3525 struct alc_spec *spec = codec->spec;
3528 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3529 for (i = 0; i < spec->autocfg.line_outs; i++) {
3530 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3531 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3532 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3536 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3538 struct alc_spec *spec = codec->spec;
3541 pin = spec->autocfg.speaker_pins[0];
3542 if (pin) /* connect to front */
3543 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3544 pin = spec->autocfg.hp_pins[0];
3545 if (pin) /* connect to front */
3546 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3549 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3551 struct alc_spec *spec = codec->spec;
3554 for (i = 0; i < AUTO_PIN_LAST; i++) {
3555 hda_nid_t nid = spec->autocfg.input_pins[i];
3556 if (alc880_is_input_pin(nid)) {
3557 snd_hda_codec_write(codec, nid, 0,
3558 AC_VERB_SET_PIN_WIDGET_CONTROL,
3559 i <= AUTO_PIN_FRONT_MIC ?
3560 PIN_VREF80 : PIN_IN);
3561 if (nid != ALC880_PIN_CD_NID)
3562 snd_hda_codec_write(codec, nid, 0,
3563 AC_VERB_SET_AMP_GAIN_MUTE,
3569 /* parse the BIOS configuration and set up the alc_spec */
3570 /* return 1 if successful, 0 if the proper config is not found,
3571 * or a negative error code
3573 static int alc880_parse_auto_config(struct hda_codec *codec)
3575 struct alc_spec *spec = codec->spec;
3577 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3579 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3583 if (!spec->autocfg.line_outs)
3584 return 0; /* can't find valid BIOS pin config */
3586 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3589 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3592 err = alc880_auto_create_extra_out(spec,
3593 spec->autocfg.speaker_pins[0],
3597 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3601 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3605 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3607 if (spec->autocfg.dig_out_pin)
3608 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3609 if (spec->autocfg.dig_in_pin)
3610 spec->dig_in_nid = ALC880_DIGIN_NID;
3612 if (spec->kctl_alloc)
3613 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3615 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3617 spec->num_mux_defs = 1;
3618 spec->input_mux = &spec->private_imux;
3623 /* additional initialization for auto-configuration model */
3624 static void alc880_auto_init(struct hda_codec *codec)
3626 struct alc_spec *spec = codec->spec;
3627 alc880_auto_init_multi_out(codec);
3628 alc880_auto_init_extra_out(codec);
3629 alc880_auto_init_analog_input(codec);
3630 if (spec->unsol_event)
3631 alc_sku_automute(codec);
3635 * OK, here we have finally the patch for ALC880
3638 static int patch_alc880(struct hda_codec *codec)
3640 struct alc_spec *spec;
3644 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3650 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3653 if (board_config < 0) {
3654 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3655 "trying auto-probe from BIOS...\n");
3656 board_config = ALC880_AUTO;
3659 if (board_config == ALC880_AUTO) {
3660 /* automatic parse from the BIOS config */
3661 err = alc880_parse_auto_config(codec);
3667 "hda_codec: Cannot set up configuration "
3668 "from BIOS. Using 3-stack mode...\n");
3669 board_config = ALC880_3ST;
3673 if (board_config != ALC880_AUTO)
3674 setup_preset(spec, &alc880_presets[board_config]);
3676 spec->stream_name_analog = "ALC880 Analog";
3677 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3678 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3679 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3681 spec->stream_name_digital = "ALC880 Digital";
3682 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3683 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3685 if (!spec->adc_nids && spec->input_mux) {
3686 /* check whether NID 0x07 is valid */
3687 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3689 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3690 if (wcap != AC_WID_AUD_IN) {
3691 spec->adc_nids = alc880_adc_nids_alt;
3692 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3693 spec->mixers[spec->num_mixers] =
3694 alc880_capture_alt_mixer;
3697 spec->adc_nids = alc880_adc_nids;
3698 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3699 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3704 spec->vmaster_nid = 0x0c;
3706 codec->patch_ops = alc_patch_ops;
3707 if (board_config == ALC880_AUTO)
3708 spec->init_hook = alc880_auto_init;
3709 #ifdef CONFIG_SND_HDA_POWER_SAVE
3710 if (!spec->loopback.amplist)
3711 spec->loopback.amplist = alc880_loopbacks;
3722 static hda_nid_t alc260_dac_nids[1] = {
3727 static hda_nid_t alc260_adc_nids[1] = {
3732 static hda_nid_t alc260_adc_nids_alt[1] = {
3737 static hda_nid_t alc260_hp_adc_nids[2] = {
3742 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3743 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3745 static hda_nid_t alc260_dual_adc_nids[2] = {
3750 #define ALC260_DIGOUT_NID 0x03
3751 #define ALC260_DIGIN_NID 0x06
3753 static struct hda_input_mux alc260_capture_source = {
3757 { "Front Mic", 0x1 },
3763 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3764 * headphone jack and the internal CD lines since these are the only pins at
3765 * which audio can appear. For flexibility, also allow the option of
3766 * recording the mixer output on the second ADC (ADC0 doesn't have a
3767 * connection to the mixer output).
3769 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3773 { "Mic/Line", 0x0 },
3775 { "Headphone", 0x2 },
3781 { "Mic/Line", 0x0 },
3783 { "Headphone", 0x2 },
3790 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3791 * the Fujitsu S702x, but jacks are marked differently.
3793 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3800 { "Headphone", 0x5 },
3809 { "Headphone", 0x6 },
3815 * This is just place-holder, so there's something for alc_build_pcms to look
3816 * at when it calculates the maximum number of channels. ALC260 has no mixer
3817 * element which allows changing the channel mode, so the verb list is
3820 static struct hda_channel_mode alc260_modes[1] = {
3825 /* Mixer combinations
3827 * basic: base_output + input + pc_beep + capture
3828 * HP: base_output + input + capture_alt
3829 * HP_3013: hp_3013 + input + capture
3830 * fujitsu: fujitsu + capture
3831 * acer: acer + capture
3834 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3835 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3836 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3837 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3838 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3839 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3840 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3844 static struct snd_kcontrol_new alc260_input_mixer[] = {
3845 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3846 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3847 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3848 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3849 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3850 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3851 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3852 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3856 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3857 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3858 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3862 /* update HP, line and mono out pins according to the master switch */
3863 static void alc260_hp_master_update(struct hda_codec *codec,
3864 hda_nid_t hp, hda_nid_t line,
3867 struct alc_spec *spec = codec->spec;
3868 unsigned int val = spec->master_sw ? PIN_HP : 0;
3869 /* change HP and line-out pins */
3870 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3872 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3874 /* mono (speaker) depending on the HP jack sense */
3875 val = (val && !spec->jack_present) ? PIN_OUT : 0;
3876 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3880 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
3881 struct snd_ctl_elem_value *ucontrol)
3883 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3884 struct alc_spec *spec = codec->spec;
3885 *ucontrol->value.integer.value = spec->master_sw;
3889 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
3890 struct snd_ctl_elem_value *ucontrol)
3892 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3893 struct alc_spec *spec = codec->spec;
3894 int val = !!*ucontrol->value.integer.value;
3895 hda_nid_t hp, line, mono;
3897 if (val == spec->master_sw)
3899 spec->master_sw = val;
3900 hp = (kcontrol->private_value >> 16) & 0xff;
3901 line = (kcontrol->private_value >> 8) & 0xff;
3902 mono = kcontrol->private_value & 0xff;
3903 alc260_hp_master_update(codec, hp, line, mono);
3907 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
3909 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3910 .name = "Master Playback Switch",
3911 .info = snd_ctl_boolean_mono_info,
3912 .get = alc260_hp_master_sw_get,
3913 .put = alc260_hp_master_sw_put,
3914 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
3916 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3917 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3918 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3919 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3920 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
3922 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3926 static struct hda_verb alc260_hp_unsol_verbs[] = {
3927 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3931 static void alc260_hp_automute(struct hda_codec *codec)
3933 struct alc_spec *spec = codec->spec;
3934 unsigned int present;
3936 present = snd_hda_codec_read(codec, 0x10, 0,
3937 AC_VERB_GET_PIN_SENSE, 0);
3938 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3939 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
3942 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
3944 if ((res >> 26) == ALC880_HP_EVENT)
3945 alc260_hp_automute(codec);
3948 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3950 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3951 .name = "Master Playback Switch",
3952 .info = snd_ctl_boolean_mono_info,
3953 .get = alc260_hp_master_sw_get,
3954 .put = alc260_hp_master_sw_put,
3955 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
3957 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3958 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3959 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3960 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3961 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3962 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3963 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3964 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3968 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
3969 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3973 static void alc260_hp_3013_automute(struct hda_codec *codec)
3975 struct alc_spec *spec = codec->spec;
3976 unsigned int present;
3978 present = snd_hda_codec_read(codec, 0x15, 0,
3979 AC_VERB_GET_PIN_SENSE, 0);
3980 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3981 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
3984 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
3987 if ((res >> 26) == ALC880_HP_EVENT)
3988 alc260_hp_3013_automute(codec);
3991 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3992 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3994 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3995 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3996 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3997 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3998 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3999 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4000 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4001 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4002 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4003 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4004 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4005 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4006 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4010 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4011 * versions of the ALC260 don't act on requests to enable mic bias from NID
4012 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4013 * datasheet doesn't mention this restriction. At this stage it's not clear
4014 * whether this behaviour is intentional or is a hardware bug in chip
4015 * revisions available in early 2006. Therefore for now allow the
4016 * "Headphone Jack Mode" control to span all choices, but if it turns out
4017 * that the lack of mic bias for this NID is intentional we could change the
4018 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4020 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4021 * don't appear to make the mic bias available from the "line" jack, even
4022 * though the NID used for this jack (0x14) can supply it. The theory is
4023 * that perhaps Acer have included blocking capacitors between the ALC260
4024 * and the output jack. If this turns out to be the case for all such
4025 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4026 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4028 * The C20x Tablet series have a mono internal speaker which is controlled
4029 * via the chip's Mono sum widget and pin complex, so include the necessary
4030 * controls for such models. On models without a "mono speaker" the control
4031 * won't do anything.
4033 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4034 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4035 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4036 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4037 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4039 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4041 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4042 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4044 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4045 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4046 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4047 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4048 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4049 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4050 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4054 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4055 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4057 static struct snd_kcontrol_new alc260_will_mixer[] = {
4058 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4059 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4061 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4062 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4063 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4064 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4065 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4066 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4067 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4068 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4069 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4073 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4074 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4076 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4077 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4078 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4080 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4081 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4082 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4083 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4084 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4085 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4086 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4090 /* capture mixer elements */
4091 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4092 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4093 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4094 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4095 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4097 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4098 /* The multiple "Capture Source" controls confuse alsamixer
4099 * So call somewhat different..
4101 /* .name = "Capture Source", */
4102 .name = "Input Source",
4104 .info = alc_mux_enum_info,
4105 .get = alc_mux_enum_get,
4106 .put = alc_mux_enum_put,
4111 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4112 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4113 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4116 /* The multiple "Capture Source" controls confuse alsamixer
4117 * So call somewhat different..
4119 /* .name = "Capture Source", */
4120 .name = "Input Source",
4122 .info = alc_mux_enum_info,
4123 .get = alc_mux_enum_get,
4124 .put = alc_mux_enum_put,
4130 * initialization verbs
4132 static struct hda_verb alc260_init_verbs[] = {
4133 /* Line In pin widget for input */
4134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4135 /* CD pin widget for input */
4136 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4137 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4138 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4139 /* Mic2 (front panel) pin widget for input and vref at 80% */
4140 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4141 /* LINE-2 is used for line-out in rear */
4142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4143 /* select line-out */
4144 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4146 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4148 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4150 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4151 /* mute capture amp left and right */
4152 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4153 /* set connection select to line in (default select for this ADC) */
4154 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4155 /* mute capture amp left and right */
4156 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4157 /* set connection select to line in (default select for this ADC) */
4158 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4159 /* set vol=0 Line-Out mixer amp left and right */
4160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4161 /* unmute pin widget amp left and right (no gain on this amp) */
4162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4163 /* set vol=0 HP mixer amp left and right */
4164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4165 /* unmute pin widget amp left and right (no gain on this amp) */
4166 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4167 /* set vol=0 Mono mixer amp left and right */
4168 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4169 /* unmute pin widget amp left and right (no gain on this amp) */
4170 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4171 /* unmute LINE-2 out pin */
4172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4173 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4176 /* mute analog inputs */
4177 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4181 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4182 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4183 /* mute Front out path */
4184 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4185 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4186 /* mute Headphone out path */
4187 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4188 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4189 /* mute Mono out path */
4190 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4191 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4195 #if 0 /* should be identical with alc260_init_verbs? */
4196 static struct hda_verb alc260_hp_init_verbs[] = {
4197 /* Headphone and output */
4198 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4200 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4201 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4202 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4203 /* Mic2 (front panel) pin widget for input and vref at 80% */
4204 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4205 /* Line In pin widget for input */
4206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4207 /* Line-2 pin widget for output */
4208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4209 /* CD pin widget for input */
4210 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4211 /* unmute amp left and right */
4212 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4213 /* set connection select to line in (default select for this ADC) */
4214 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4215 /* unmute Line-Out mixer amp left and right (volume = 0) */
4216 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4217 /* mute pin widget amp left and right (no gain on this amp) */
4218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4219 /* unmute HP mixer amp left and right (volume = 0) */
4220 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4221 /* mute pin widget amp left and right (no gain on this amp) */
4222 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4223 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4226 /* mute analog inputs */
4227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4232 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4233 /* Unmute Front out path */
4234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4236 /* Unmute Headphone out path */
4237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4239 /* Unmute Mono out path */
4240 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4241 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4246 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4247 /* Line out and output */
4248 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4250 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4251 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4252 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4253 /* Mic2 (front panel) pin widget for input and vref at 80% */
4254 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4255 /* Line In pin widget for input */
4256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4257 /* Headphone pin widget for output */
4258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4259 /* CD pin widget for input */
4260 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4261 /* unmute amp left and right */
4262 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4263 /* set connection select to line in (default select for this ADC) */
4264 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4265 /* unmute Line-Out mixer amp left and right (volume = 0) */
4266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4267 /* mute pin widget amp left and right (no gain on this amp) */
4268 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4269 /* unmute HP mixer amp left and right (volume = 0) */
4270 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4271 /* mute pin widget amp left and right (no gain on this amp) */
4272 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4273 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4276 /* mute analog inputs */
4277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4282 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4283 /* Unmute Front out path */
4284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4286 /* Unmute Headphone out path */
4287 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4288 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4289 /* Unmute Mono out path */
4290 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4291 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4295 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4296 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4297 * audio = 0x16, internal speaker = 0x10.
4299 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4300 /* Disable all GPIOs */
4301 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4302 /* Internal speaker is connected to headphone pin */
4303 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4304 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4306 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4307 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4308 /* Ensure all other unused pins are disabled and muted. */
4309 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4310 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4311 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4312 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4313 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4314 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4316 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4318 /* Disable digital (SPDIF) pins */
4319 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4320 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4322 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4323 * when acting as an output.
4325 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4327 /* Start with output sum widgets muted and their output gains at min */
4328 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4331 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4332 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4333 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4334 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4335 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4336 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4338 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4339 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4340 /* Unmute Line1 pin widget output buffer since it starts as an output.
4341 * If the pin mode is changed by the user the pin mode control will
4342 * take care of enabling the pin's input/output buffers as needed.
4343 * Therefore there's no need to enable the input buffer at this
4346 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4347 /* Unmute input buffer of pin widget used for Line-in (no equiv
4350 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4352 /* Mute capture amp left and right */
4353 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4354 /* Set ADC connection select to match default mixer setting - line
4357 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4359 /* Do the same for the second ADC: mute capture input amp and
4360 * set ADC connection to line in (on mic1 pin)
4362 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4363 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4365 /* Mute all inputs to mixer widget (even unconnected ones) */
4366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4370 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4371 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4378 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4379 * similar laptops (adapted from Fujitsu init verbs).
4381 static struct hda_verb alc260_acer_init_verbs[] = {
4382 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4383 * the headphone jack. Turn this on and rely on the standard mute
4384 * methods whenever the user wants to turn these outputs off.
4386 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4387 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4388 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4389 /* Internal speaker/Headphone jack is connected to Line-out pin */
4390 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4391 /* Internal microphone/Mic jack is connected to Mic1 pin */
4392 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4393 /* Line In jack is connected to Line1 pin */
4394 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4395 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4396 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4397 /* Ensure all other unused pins are disabled and muted. */
4398 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4399 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4400 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4401 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4402 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4403 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4404 /* Disable digital (SPDIF) pins */
4405 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4406 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4408 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4409 * bus when acting as outputs.
4411 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4412 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4414 /* Start with output sum widgets muted and their output gains at min */
4415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4416 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4417 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4420 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4421 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4422 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4423 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4425 /* Unmute Line-out pin widget amp left and right
4426 * (no equiv mixer ctrl)
4428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4429 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4430 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4431 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4432 * inputs. If the pin mode is changed by the user the pin mode control
4433 * will take care of enabling the pin's input/output buffers as needed.
4434 * Therefore there's no need to enable the input buffer at this
4437 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4440 /* Mute capture amp left and right */
4441 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4442 /* Set ADC connection select to match default mixer setting - mic
4445 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4447 /* Do similar with the second ADC: mute capture input amp and
4448 * set ADC connection to mic to match ALSA's default state.
4450 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4451 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4453 /* Mute all inputs to mixer widget (even unconnected ones) */
4454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4466 static struct hda_verb alc260_will_verbs[] = {
4467 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4468 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4469 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4470 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4471 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4472 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4476 static struct hda_verb alc260_replacer_672v_verbs[] = {
4477 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4478 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4479 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4481 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4482 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4483 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4485 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4489 /* toggle speaker-output according to the hp-jack state */
4490 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4492 unsigned int present;
4494 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4495 present = snd_hda_codec_read(codec, 0x0f, 0,
4496 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4498 snd_hda_codec_write_cache(codec, 0x01, 0,
4499 AC_VERB_SET_GPIO_DATA, 1);
4500 snd_hda_codec_write_cache(codec, 0x0f, 0,
4501 AC_VERB_SET_PIN_WIDGET_CONTROL,
4504 snd_hda_codec_write_cache(codec, 0x01, 0,
4505 AC_VERB_SET_GPIO_DATA, 0);
4506 snd_hda_codec_write_cache(codec, 0x0f, 0,
4507 AC_VERB_SET_PIN_WIDGET_CONTROL,
4512 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4515 if ((res >> 26) == ALC880_HP_EVENT)
4516 alc260_replacer_672v_automute(codec);
4519 /* Test configuration for debugging, modelled after the ALC880 test
4522 #ifdef CONFIG_SND_DEBUG
4523 static hda_nid_t alc260_test_dac_nids[1] = {
4526 static hda_nid_t alc260_test_adc_nids[2] = {
4529 /* For testing the ALC260, each input MUX needs its own definition since
4530 * the signal assignments are different. This assumes that the first ADC
4533 static struct hda_input_mux alc260_test_capture_sources[2] = {
4537 { "MIC1 pin", 0x0 },
4538 { "MIC2 pin", 0x1 },
4539 { "LINE1 pin", 0x2 },
4540 { "LINE2 pin", 0x3 },
4542 { "LINE-OUT pin", 0x5 },
4543 { "HP-OUT pin", 0x6 },
4549 { "MIC1 pin", 0x0 },
4550 { "MIC2 pin", 0x1 },
4551 { "LINE1 pin", 0x2 },
4552 { "LINE2 pin", 0x3 },
4555 { "LINE-OUT pin", 0x6 },
4556 { "HP-OUT pin", 0x7 },
4560 static struct snd_kcontrol_new alc260_test_mixer[] = {
4561 /* Output driver widgets */
4562 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4563 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4564 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4565 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4566 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4567 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4569 /* Modes for retasking pin widgets
4570 * Note: the ALC260 doesn't seem to act on requests to enable mic
4571 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4572 * mention this restriction. At this stage it's not clear whether
4573 * this behaviour is intentional or is a hardware bug in chip
4574 * revisions available at least up until early 2006. Therefore for
4575 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4576 * choices, but if it turns out that the lack of mic bias for these
4577 * NIDs is intentional we could change their modes from
4578 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4580 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4581 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4582 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4583 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4584 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4585 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4587 /* Loopback mixer controls */
4588 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4589 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4590 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4591 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4592 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4593 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4594 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4595 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4596 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4597 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4598 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4599 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4600 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4601 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4602 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4603 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4605 /* Controls for GPIO pins, assuming they are configured as outputs */
4606 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4607 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4608 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4609 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4611 /* Switches to allow the digital IO pins to be enabled. The datasheet
4612 * is ambigious as to which NID is which; testing on laptops which
4613 * make this output available should provide clarification.
4615 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4616 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4618 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4619 * this output to turn on an external amplifier.
4621 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4622 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4626 static struct hda_verb alc260_test_init_verbs[] = {
4627 /* Enable all GPIOs as outputs with an initial value of 0 */
4628 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4629 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4630 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4632 /* Enable retasking pins as output, initially without power amp */
4633 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4634 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4637 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4638 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4640 /* Disable digital (SPDIF) pins initially, but users can enable
4641 * them via a mixer switch. In the case of SPDIF-out, this initverb
4642 * payload also sets the generation to 0, output to be in "consumer"
4643 * PCM format, copyright asserted, no pre-emphasis and no validity
4646 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4647 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4649 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4650 * OUT1 sum bus when acting as an output.
4652 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4653 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4654 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4655 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4657 /* Start with output sum widgets muted and their output gains at min */
4658 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4659 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4660 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4661 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4662 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4663 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4664 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4665 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4666 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4668 /* Unmute retasking pin widget output buffers since the default
4669 * state appears to be output. As the pin mode is changed by the
4670 * user the pin mode control will take care of enabling the pin's
4671 * input/output buffers as needed.
4673 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4674 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4676 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4677 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4678 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4679 /* Also unmute the mono-out pin widget */
4680 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4682 /* Mute capture amp left and right */
4683 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4684 /* Set ADC connection select to match default mixer setting (mic1
4687 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4689 /* Do the same for the second ADC: mute capture input amp and
4690 * set ADC connection to mic1 pin
4692 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4693 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4695 /* Mute all inputs to mixer widget (even unconnected ones) */
4696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4709 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4710 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4712 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4713 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4716 * for BIOS auto-configuration
4719 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4723 unsigned long vol_val, sw_val;
4727 if (nid >= 0x0f && nid < 0x11) {
4728 nid_vol = nid - 0x7;
4729 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4730 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4731 } else if (nid == 0x11) {
4732 nid_vol = nid - 0x7;
4733 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4734 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4735 } else if (nid >= 0x12 && nid <= 0x15) {
4737 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4738 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4742 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4743 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4746 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4747 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4753 /* add playback controls from the parsed DAC table */
4754 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4755 const struct auto_pin_cfg *cfg)
4760 spec->multiout.num_dacs = 1;
4761 spec->multiout.dac_nids = spec->private_dac_nids;
4762 spec->multiout.dac_nids[0] = 0x02;
4764 nid = cfg->line_out_pins[0];
4766 err = alc260_add_playback_controls(spec, nid, "Front");
4771 nid = cfg->speaker_pins[0];
4773 err = alc260_add_playback_controls(spec, nid, "Speaker");
4778 nid = cfg->hp_pins[0];
4780 err = alc260_add_playback_controls(spec, nid, "Headphone");
4787 /* create playback/capture controls for input pins */
4788 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4789 const struct auto_pin_cfg *cfg)
4791 struct hda_input_mux *imux = &spec->private_imux;
4794 for (i = 0; i < AUTO_PIN_LAST; i++) {
4795 if (cfg->input_pins[i] >= 0x12) {
4796 idx = cfg->input_pins[i] - 0x12;
4797 err = new_analog_input(spec, cfg->input_pins[i],
4798 auto_pin_cfg_labels[i], idx,
4802 imux->items[imux->num_items].label =
4803 auto_pin_cfg_labels[i];
4804 imux->items[imux->num_items].index = idx;
4807 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4808 idx = cfg->input_pins[i] - 0x09;
4809 err = new_analog_input(spec, cfg->input_pins[i],
4810 auto_pin_cfg_labels[i], idx,
4814 imux->items[imux->num_items].label =
4815 auto_pin_cfg_labels[i];
4816 imux->items[imux->num_items].index = idx;
4823 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4824 hda_nid_t nid, int pin_type,
4827 alc_set_pin_output(codec, nid, pin_type);
4828 /* need the manual connection? */
4830 int idx = nid - 0x12;
4831 snd_hda_codec_write(codec, idx + 0x0b, 0,
4832 AC_VERB_SET_CONNECT_SEL, sel_idx);
4836 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4838 struct alc_spec *spec = codec->spec;
4841 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4842 nid = spec->autocfg.line_out_pins[0];
4844 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4845 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4848 nid = spec->autocfg.speaker_pins[0];
4850 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4852 nid = spec->autocfg.hp_pins[0];
4854 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4857 #define ALC260_PIN_CD_NID 0x16
4858 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4860 struct alc_spec *spec = codec->spec;
4863 for (i = 0; i < AUTO_PIN_LAST; i++) {
4864 hda_nid_t nid = spec->autocfg.input_pins[i];
4866 snd_hda_codec_write(codec, nid, 0,
4867 AC_VERB_SET_PIN_WIDGET_CONTROL,
4868 i <= AUTO_PIN_FRONT_MIC ?
4869 PIN_VREF80 : PIN_IN);
4870 if (nid != ALC260_PIN_CD_NID)
4871 snd_hda_codec_write(codec, nid, 0,
4872 AC_VERB_SET_AMP_GAIN_MUTE,
4879 * generic initialization of ADC, input mixers and output mixers
4881 static struct hda_verb alc260_volume_init_verbs[] = {
4883 * Unmute ADC0-1 and set the default input to mic-in
4885 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4886 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4887 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4888 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4890 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4892 * Note: PASD motherboards uses the Line In 2 as the input for
4893 * front panel mic (mic 2)
4895 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4896 /* mute analog inputs */
4897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4904 * Set up output mixers (0x08 - 0x0a)
4906 /* set vol=0 to output mixers */
4907 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4908 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4909 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4910 /* set up input amps for analog loopback */
4911 /* Amp Indices: DAC = 0, mixer = 1 */
4912 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4914 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4915 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4916 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4917 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4922 static int alc260_parse_auto_config(struct hda_codec *codec)
4924 struct alc_spec *spec = codec->spec;
4927 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4929 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4933 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4936 if (!spec->kctl_alloc)
4937 return 0; /* can't find valid BIOS pin config */
4938 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4942 spec->multiout.max_channels = 2;
4944 if (spec->autocfg.dig_out_pin)
4945 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4946 if (spec->kctl_alloc)
4947 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4949 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4951 spec->num_mux_defs = 1;
4952 spec->input_mux = &spec->private_imux;
4954 /* check whether NID 0x04 is valid */
4955 wcap = get_wcaps(codec, 0x04);
4956 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4957 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
4958 spec->adc_nids = alc260_adc_nids_alt;
4959 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4960 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4962 spec->adc_nids = alc260_adc_nids;
4963 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4964 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4971 /* additional initialization for auto-configuration model */
4972 static void alc260_auto_init(struct hda_codec *codec)
4974 struct alc_spec *spec = codec->spec;
4975 alc260_auto_init_multi_out(codec);
4976 alc260_auto_init_analog_input(codec);
4977 if (spec->unsol_event)
4978 alc_sku_automute(codec);
4981 #ifdef CONFIG_SND_HDA_POWER_SAVE
4982 static struct hda_amp_list alc260_loopbacks[] = {
4983 { 0x07, HDA_INPUT, 0 },
4984 { 0x07, HDA_INPUT, 1 },
4985 { 0x07, HDA_INPUT, 2 },
4986 { 0x07, HDA_INPUT, 3 },
4987 { 0x07, HDA_INPUT, 4 },
4993 * ALC260 configurations
4995 static const char *alc260_models[ALC260_MODEL_LAST] = {
4996 [ALC260_BASIC] = "basic",
4998 [ALC260_HP_3013] = "hp-3013",
4999 [ALC260_FUJITSU_S702X] = "fujitsu",
5000 [ALC260_ACER] = "acer",
5001 [ALC260_WILL] = "will",
5002 [ALC260_REPLACER_672V] = "replacer",
5003 #ifdef CONFIG_SND_DEBUG
5004 [ALC260_TEST] = "test",
5006 [ALC260_AUTO] = "auto",
5009 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5010 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5011 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5012 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5013 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5014 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5015 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
5016 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5017 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5018 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5019 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5020 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5021 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5022 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5023 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5024 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5025 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5026 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5027 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5031 static struct alc_config_preset alc260_presets[] = {
5033 .mixers = { alc260_base_output_mixer,
5035 alc260_pc_beep_mixer,
5036 alc260_capture_mixer },
5037 .init_verbs = { alc260_init_verbs },
5038 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5039 .dac_nids = alc260_dac_nids,
5040 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5041 .adc_nids = alc260_adc_nids,
5042 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5043 .channel_mode = alc260_modes,
5044 .input_mux = &alc260_capture_source,
5047 .mixers = { alc260_hp_output_mixer,
5049 alc260_capture_alt_mixer },
5050 .init_verbs = { alc260_init_verbs,
5051 alc260_hp_unsol_verbs },
5052 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5053 .dac_nids = alc260_dac_nids,
5054 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5055 .adc_nids = alc260_hp_adc_nids,
5056 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5057 .channel_mode = alc260_modes,
5058 .input_mux = &alc260_capture_source,
5059 .unsol_event = alc260_hp_unsol_event,
5060 .init_hook = alc260_hp_automute,
5062 [ALC260_HP_3013] = {
5063 .mixers = { alc260_hp_3013_mixer,
5065 alc260_capture_alt_mixer },
5066 .init_verbs = { alc260_hp_3013_init_verbs,
5067 alc260_hp_3013_unsol_verbs },
5068 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5069 .dac_nids = alc260_dac_nids,
5070 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5071 .adc_nids = alc260_hp_adc_nids,
5072 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5073 .channel_mode = alc260_modes,
5074 .input_mux = &alc260_capture_source,
5075 .unsol_event = alc260_hp_3013_unsol_event,
5076 .init_hook = alc260_hp_3013_automute,
5078 [ALC260_FUJITSU_S702X] = {
5079 .mixers = { alc260_fujitsu_mixer,
5080 alc260_capture_mixer },
5081 .init_verbs = { alc260_fujitsu_init_verbs },
5082 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5083 .dac_nids = alc260_dac_nids,
5084 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5085 .adc_nids = alc260_dual_adc_nids,
5086 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5087 .channel_mode = alc260_modes,
5088 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5089 .input_mux = alc260_fujitsu_capture_sources,
5092 .mixers = { alc260_acer_mixer,
5093 alc260_capture_mixer },
5094 .init_verbs = { alc260_acer_init_verbs },
5095 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5096 .dac_nids = alc260_dac_nids,
5097 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5098 .adc_nids = alc260_dual_adc_nids,
5099 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5100 .channel_mode = alc260_modes,
5101 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5102 .input_mux = alc260_acer_capture_sources,
5105 .mixers = { alc260_will_mixer,
5106 alc260_capture_mixer },
5107 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5108 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5109 .dac_nids = alc260_dac_nids,
5110 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5111 .adc_nids = alc260_adc_nids,
5112 .dig_out_nid = ALC260_DIGOUT_NID,
5113 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5114 .channel_mode = alc260_modes,
5115 .input_mux = &alc260_capture_source,
5117 [ALC260_REPLACER_672V] = {
5118 .mixers = { alc260_replacer_672v_mixer,
5119 alc260_capture_mixer },
5120 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5121 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5122 .dac_nids = alc260_dac_nids,
5123 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5124 .adc_nids = alc260_adc_nids,
5125 .dig_out_nid = ALC260_DIGOUT_NID,
5126 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5127 .channel_mode = alc260_modes,
5128 .input_mux = &alc260_capture_source,
5129 .unsol_event = alc260_replacer_672v_unsol_event,
5130 .init_hook = alc260_replacer_672v_automute,
5132 #ifdef CONFIG_SND_DEBUG
5134 .mixers = { alc260_test_mixer,
5135 alc260_capture_mixer },
5136 .init_verbs = { alc260_test_init_verbs },
5137 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5138 .dac_nids = alc260_test_dac_nids,
5139 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5140 .adc_nids = alc260_test_adc_nids,
5141 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5142 .channel_mode = alc260_modes,
5143 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5144 .input_mux = alc260_test_capture_sources,
5149 static int patch_alc260(struct hda_codec *codec)
5151 struct alc_spec *spec;
5152 int err, board_config;
5154 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5160 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5163 if (board_config < 0) {
5164 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5165 "trying auto-probe from BIOS...\n");
5166 board_config = ALC260_AUTO;
5169 if (board_config == ALC260_AUTO) {
5170 /* automatic parse from the BIOS config */
5171 err = alc260_parse_auto_config(codec);
5177 "hda_codec: Cannot set up configuration "
5178 "from BIOS. Using base mode...\n");
5179 board_config = ALC260_BASIC;
5183 if (board_config != ALC260_AUTO)
5184 setup_preset(spec, &alc260_presets[board_config]);
5186 spec->stream_name_analog = "ALC260 Analog";
5187 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5188 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5190 spec->stream_name_digital = "ALC260 Digital";
5191 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5192 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5194 spec->vmaster_nid = 0x08;
5196 codec->patch_ops = alc_patch_ops;
5197 if (board_config == ALC260_AUTO)
5198 spec->init_hook = alc260_auto_init;
5199 #ifdef CONFIG_SND_HDA_POWER_SAVE
5200 if (!spec->loopback.amplist)
5201 spec->loopback.amplist = alc260_loopbacks;
5211 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5212 * configuration. Each pin widget can choose any input DACs and a mixer.
5213 * Each ADC is connected from a mixer of all inputs. This makes possible
5214 * 6-channel independent captures.
5216 * In addition, an independent DAC for the multi-playback (not used in this
5219 #define ALC882_DIGOUT_NID 0x06
5220 #define ALC882_DIGIN_NID 0x0a
5222 static struct hda_channel_mode alc882_ch_modes[1] = {
5226 static hda_nid_t alc882_dac_nids[4] = {
5227 /* front, rear, clfe, rear_surr */
5228 0x02, 0x03, 0x04, 0x05
5231 /* identical with ALC880 */
5232 #define alc882_adc_nids alc880_adc_nids
5233 #define alc882_adc_nids_alt alc880_adc_nids_alt
5235 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5236 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5239 /* FIXME: should be a matrix-type input source selection */
5241 static struct hda_input_mux alc882_capture_source = {
5245 { "Front Mic", 0x1 },
5250 #define alc882_mux_enum_info alc_mux_enum_info
5251 #define alc882_mux_enum_get alc_mux_enum_get
5253 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5254 struct snd_ctl_elem_value *ucontrol)
5256 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5257 struct alc_spec *spec = codec->spec;
5258 const struct hda_input_mux *imux = spec->input_mux;
5259 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5260 hda_nid_t nid = spec->capsrc_nids ?
5261 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5262 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5263 unsigned int i, idx;
5265 idx = ucontrol->value.enumerated.item[0];
5266 if (idx >= imux->num_items)
5267 idx = imux->num_items - 1;
5268 if (*cur_val == idx)
5270 for (i = 0; i < imux->num_items; i++) {
5271 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5272 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5273 imux->items[i].index,
5283 static struct hda_verb alc882_3ST_ch2_init[] = {
5284 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5285 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5286 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5287 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5294 static struct hda_verb alc882_3ST_ch6_init[] = {
5295 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5296 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5297 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5298 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5299 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5300 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5304 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5305 { 2, alc882_3ST_ch2_init },
5306 { 6, alc882_3ST_ch6_init },
5312 static struct hda_verb alc882_sixstack_ch6_init[] = {
5313 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5314 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5315 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5316 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5323 static struct hda_verb alc882_sixstack_ch8_init[] = {
5324 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5325 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5326 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5327 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5331 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5332 { 6, alc882_sixstack_ch6_init },
5333 { 8, alc882_sixstack_ch8_init },
5337 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5343 static struct hda_verb alc885_mbp_ch2_init[] = {
5344 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5345 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5346 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5353 static struct hda_verb alc885_mbp_ch6_init[] = {
5354 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5355 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5356 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5357 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5358 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5362 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5363 { 2, alc885_mbp_ch2_init },
5364 { 6, alc885_mbp_ch6_init },
5368 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5369 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5371 static struct snd_kcontrol_new alc882_base_mixer[] = {
5372 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5373 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5374 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5375 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5376 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5377 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5378 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5379 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5380 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5381 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5383 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5384 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5385 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5386 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5388 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5390 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5391 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5392 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5393 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5394 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5398 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5399 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5400 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5401 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5402 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5403 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5404 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5406 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5407 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5408 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5411 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5413 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5414 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5415 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5416 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5417 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5419 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5420 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5421 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5422 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5426 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5427 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5428 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5429 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5430 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5431 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5432 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5433 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5436 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5437 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5438 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5439 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5443 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5444 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5446 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5447 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5448 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5449 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5450 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5451 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5452 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5453 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5454 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5455 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5456 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5459 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5463 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5464 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5465 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5466 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5467 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5468 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5472 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5474 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5475 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5479 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5481 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5482 .name = "Channel Mode",
5483 .info = alc_ch_mode_info,
5484 .get = alc_ch_mode_get,
5485 .put = alc_ch_mode_put,
5490 static struct hda_verb alc882_init_verbs[] = {
5491 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5496 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5497 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5498 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5500 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5501 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5502 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5504 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5505 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5506 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5508 /* Front Pin: output 0 (0x0c) */
5509 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5510 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5511 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5512 /* Rear Pin: output 1 (0x0d) */
5513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5514 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5515 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5516 /* CLFE Pin: output 2 (0x0e) */
5517 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5519 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5520 /* Side Pin: output 3 (0x0f) */
5521 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5522 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5523 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5524 /* Mic (rear) pin: input vref at 80% */
5525 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5526 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5527 /* Front Mic pin: input vref at 80% */
5528 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5529 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5530 /* Line In pin: input */
5531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5532 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5533 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5535 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5536 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5537 /* CD pin widget for input */
5538 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5540 /* FIXME: use matrix-type input source selection */
5541 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5542 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5551 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5557 /* ADC1: mute amp left and right */
5558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5559 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5560 /* ADC2: mute amp left and right */
5561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5562 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5563 /* ADC3: mute amp left and right */
5564 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5565 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5570 static struct hda_verb alc882_eapd_verbs[] = {
5571 /* change to EAPD mode */
5572 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5573 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5578 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5579 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5580 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5581 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5582 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5583 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5584 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5585 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5589 static struct hda_verb alc882_macpro_init_verbs[] = {
5590 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5594 /* Front Pin: output 0 (0x0c) */
5595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5596 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5597 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5598 /* Front Mic pin: input vref at 80% */
5599 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5600 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5601 /* Speaker: output */
5602 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5603 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5604 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5605 /* Headphone output (output 0 - 0x0c) */
5606 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5607 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5608 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5610 /* FIXME: use matrix-type input source selection */
5611 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5612 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5627 /* ADC1: mute amp left and right */
5628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5629 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5630 /* ADC2: mute amp left and right */
5631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5632 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5633 /* ADC3: mute amp left and right */
5634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5635 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5640 /* Macbook Pro rev3 */
5641 static struct hda_verb alc885_mbp3_init_verbs[] = {
5642 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5648 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5650 /* Front Pin: output 0 (0x0c) */
5651 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5652 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5653 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5654 /* HP Pin: output 0 (0x0d) */
5655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5656 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5657 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5658 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5659 /* Mic (rear) pin: input vref at 80% */
5660 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5661 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5662 /* Front Mic pin: input vref at 80% */
5663 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5664 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5665 /* Line In pin: use output 1 when in LineOut mode */
5666 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5667 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5668 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5670 /* FIXME: use matrix-type input source selection */
5671 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5672 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5676 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5679 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5681 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5686 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5687 /* ADC1: mute amp left and right */
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5689 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5690 /* ADC2: mute amp left and right */
5691 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5692 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5693 /* ADC3: mute amp left and right */
5694 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5695 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5700 /* iMac 24 mixer. */
5701 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5702 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5703 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5707 /* iMac 24 init verbs. */
5708 static struct hda_verb alc885_imac24_init_verbs[] = {
5709 /* Internal speakers: output 0 (0x0c) */
5710 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5711 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5712 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5713 /* Internal speakers: output 0 (0x0c) */
5714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5716 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5717 /* Headphone: output 0 (0x0c) */
5718 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5719 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5720 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5721 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5722 /* Front Mic: input vref at 80% */
5723 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5724 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5728 /* Toggle speaker-output according to the hp-jack state */
5729 static void alc885_imac24_automute(struct hda_codec *codec)
5731 unsigned int present;
5733 present = snd_hda_codec_read(codec, 0x14, 0,
5734 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5735 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5736 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5737 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5738 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5741 /* Processes unsolicited events. */
5742 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5745 /* Headphone insertion or removal. */
5746 if ((res >> 26) == ALC880_HP_EVENT)
5747 alc885_imac24_automute(codec);
5750 static void alc885_mbp3_automute(struct hda_codec *codec)
5752 unsigned int present;
5754 present = snd_hda_codec_read(codec, 0x15, 0,
5755 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5756 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5757 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5758 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5759 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5762 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5765 /* Headphone insertion or removal. */
5766 if ((res >> 26) == ALC880_HP_EVENT)
5767 alc885_mbp3_automute(codec);
5771 static struct hda_verb alc882_targa_verbs[] = {
5772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5773 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5775 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5776 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5778 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5779 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5780 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5782 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5783 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5784 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5785 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5789 /* toggle speaker-output according to the hp-jack state */
5790 static void alc882_targa_automute(struct hda_codec *codec)
5792 unsigned int present;
5794 present = snd_hda_codec_read(codec, 0x14, 0,
5795 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5796 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5797 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5798 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5802 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5804 /* Looks like the unsol event is incompatible with the standard
5805 * definition. 4bit tag is placed at 26 bit!
5807 if (((res >> 26) == ALC880_HP_EVENT)) {
5808 alc882_targa_automute(codec);
5812 static struct hda_verb alc882_asus_a7j_verbs[] = {
5813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5817 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5818 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5820 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5821 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5822 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5824 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5825 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5826 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5830 static struct hda_verb alc882_asus_a7m_verbs[] = {
5831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5838 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5839 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5840 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5842 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5843 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5844 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5848 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5850 unsigned int gpiostate, gpiomask, gpiodir;
5852 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5853 AC_VERB_GET_GPIO_DATA, 0);
5856 gpiostate |= (1 << pin);
5858 gpiostate &= ~(1 << pin);
5860 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5861 AC_VERB_GET_GPIO_MASK, 0);
5862 gpiomask |= (1 << pin);
5864 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5865 AC_VERB_GET_GPIO_DIRECTION, 0);
5866 gpiodir |= (1 << pin);
5869 snd_hda_codec_write(codec, codec->afg, 0,
5870 AC_VERB_SET_GPIO_MASK, gpiomask);
5871 snd_hda_codec_write(codec, codec->afg, 0,
5872 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5876 snd_hda_codec_write(codec, codec->afg, 0,
5877 AC_VERB_SET_GPIO_DATA, gpiostate);
5880 /* set up GPIO at initialization */
5881 static void alc885_macpro_init_hook(struct hda_codec *codec)
5883 alc882_gpio_mute(codec, 0, 0);
5884 alc882_gpio_mute(codec, 1, 0);
5887 /* set up GPIO and update auto-muting at initialization */
5888 static void alc885_imac24_init_hook(struct hda_codec *codec)
5890 alc885_macpro_init_hook(codec);
5891 alc885_imac24_automute(codec);
5895 * generic initialization of ADC, input mixers and output mixers
5897 static struct hda_verb alc882_auto_init_verbs[] = {
5899 * Unmute ADC0-2 and set the default input to mic-in
5901 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5902 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5903 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5904 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5905 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5906 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5908 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5910 * Note: PASD motherboards uses the Line In 2 as the input for
5911 * front panel mic (mic 2)
5913 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5914 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5915 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5916 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5917 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5918 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5921 * Set up output mixers (0x0c - 0x0f)
5923 /* set vol=0 to output mixers */
5924 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5925 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5926 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5927 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5928 /* set up input amps for analog loopback */
5929 /* Amp Indices: DAC = 0, mixer = 1 */
5930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5932 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5933 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5934 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5935 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5936 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5937 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5938 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5939 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5941 /* FIXME: use matrix-type input source selection */
5942 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5943 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5944 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5945 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5946 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5947 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5950 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5951 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5952 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5962 /* capture mixer elements */
5963 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5964 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5965 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5966 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5967 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5970 /* The multiple "Capture Source" controls confuse alsamixer
5971 * So call somewhat different..
5973 /* .name = "Capture Source", */
5974 .name = "Input Source",
5976 .info = alc882_mux_enum_info,
5977 .get = alc882_mux_enum_get,
5978 .put = alc882_mux_enum_put,
5983 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5984 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5985 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5986 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5987 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5988 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5989 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5992 /* The multiple "Capture Source" controls confuse alsamixer
5993 * So call somewhat different..
5995 /* .name = "Capture Source", */
5996 .name = "Input Source",
5998 .info = alc882_mux_enum_info,
5999 .get = alc882_mux_enum_get,
6000 .put = alc882_mux_enum_put,
6005 #ifdef CONFIG_SND_HDA_POWER_SAVE
6006 #define alc882_loopbacks alc880_loopbacks
6009 /* pcm configuration: identiacal with ALC880 */
6010 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6011 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6012 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6013 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6016 * configuration and preset
6018 static const char *alc882_models[ALC882_MODEL_LAST] = {
6019 [ALC882_3ST_DIG] = "3stack-dig",
6020 [ALC882_6ST_DIG] = "6stack-dig",
6021 [ALC882_ARIMA] = "arima",
6022 [ALC882_W2JC] = "w2jc",
6023 [ALC882_TARGA] = "targa",
6024 [ALC882_ASUS_A7J] = "asus-a7j",
6025 [ALC882_ASUS_A7M] = "asus-a7m",
6026 [ALC885_MACPRO] = "macpro",
6027 [ALC885_MBP3] = "mbp3",
6028 [ALC885_IMAC24] = "imac24",
6029 [ALC882_AUTO] = "auto",
6032 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6033 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6034 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6035 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6036 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6037 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6038 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6039 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6040 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6041 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6042 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6043 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6044 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6048 static struct alc_config_preset alc882_presets[] = {
6049 [ALC882_3ST_DIG] = {
6050 .mixers = { alc882_base_mixer },
6051 .init_verbs = { alc882_init_verbs },
6052 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6053 .dac_nids = alc882_dac_nids,
6054 .dig_out_nid = ALC882_DIGOUT_NID,
6055 .dig_in_nid = ALC882_DIGIN_NID,
6056 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6057 .channel_mode = alc882_ch_modes,
6059 .input_mux = &alc882_capture_source,
6061 [ALC882_6ST_DIG] = {
6062 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6063 .init_verbs = { alc882_init_verbs },
6064 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6065 .dac_nids = alc882_dac_nids,
6066 .dig_out_nid = ALC882_DIGOUT_NID,
6067 .dig_in_nid = ALC882_DIGIN_NID,
6068 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6069 .channel_mode = alc882_sixstack_modes,
6070 .input_mux = &alc882_capture_source,
6073 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6074 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6075 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6076 .dac_nids = alc882_dac_nids,
6077 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6078 .channel_mode = alc882_sixstack_modes,
6079 .input_mux = &alc882_capture_source,
6082 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6083 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6084 alc880_gpio1_init_verbs },
6085 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6086 .dac_nids = alc882_dac_nids,
6087 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6088 .channel_mode = alc880_threestack_modes,
6090 .input_mux = &alc882_capture_source,
6091 .dig_out_nid = ALC882_DIGOUT_NID,
6094 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6095 .init_verbs = { alc885_mbp3_init_verbs,
6096 alc880_gpio1_init_verbs },
6097 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6098 .dac_nids = alc882_dac_nids,
6099 .channel_mode = alc885_mbp_6ch_modes,
6100 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6101 .input_mux = &alc882_capture_source,
6102 .dig_out_nid = ALC882_DIGOUT_NID,
6103 .dig_in_nid = ALC882_DIGIN_NID,
6104 .unsol_event = alc885_mbp3_unsol_event,
6105 .init_hook = alc885_mbp3_automute,
6108 .mixers = { alc882_macpro_mixer },
6109 .init_verbs = { alc882_macpro_init_verbs },
6110 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6111 .dac_nids = alc882_dac_nids,
6112 .dig_out_nid = ALC882_DIGOUT_NID,
6113 .dig_in_nid = ALC882_DIGIN_NID,
6114 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6115 .channel_mode = alc882_ch_modes,
6116 .input_mux = &alc882_capture_source,
6117 .init_hook = alc885_macpro_init_hook,
6120 .mixers = { alc885_imac24_mixer },
6121 .init_verbs = { alc885_imac24_init_verbs },
6122 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6123 .dac_nids = alc882_dac_nids,
6124 .dig_out_nid = ALC882_DIGOUT_NID,
6125 .dig_in_nid = ALC882_DIGIN_NID,
6126 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6127 .channel_mode = alc882_ch_modes,
6128 .input_mux = &alc882_capture_source,
6129 .unsol_event = alc885_imac24_unsol_event,
6130 .init_hook = alc885_imac24_init_hook,
6133 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6134 alc882_capture_mixer },
6135 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6136 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6137 .dac_nids = alc882_dac_nids,
6138 .dig_out_nid = ALC882_DIGOUT_NID,
6139 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6140 .adc_nids = alc882_adc_nids,
6141 .capsrc_nids = alc882_capsrc_nids,
6142 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6143 .channel_mode = alc882_3ST_6ch_modes,
6145 .input_mux = &alc882_capture_source,
6146 .unsol_event = alc882_targa_unsol_event,
6147 .init_hook = alc882_targa_automute,
6149 [ALC882_ASUS_A7J] = {
6150 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6151 alc882_capture_mixer },
6152 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6153 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6154 .dac_nids = alc882_dac_nids,
6155 .dig_out_nid = ALC882_DIGOUT_NID,
6156 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6157 .adc_nids = alc882_adc_nids,
6158 .capsrc_nids = alc882_capsrc_nids,
6159 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6160 .channel_mode = alc882_3ST_6ch_modes,
6162 .input_mux = &alc882_capture_source,
6164 [ALC882_ASUS_A7M] = {
6165 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6166 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6167 alc880_gpio1_init_verbs,
6168 alc882_asus_a7m_verbs },
6169 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6170 .dac_nids = alc882_dac_nids,
6171 .dig_out_nid = ALC882_DIGOUT_NID,
6172 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6173 .channel_mode = alc880_threestack_modes,
6175 .input_mux = &alc882_capture_source,
6184 PINFIX_ABIT_AW9D_MAX
6187 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6188 { 0x15, 0x01080104 }, /* side */
6189 { 0x16, 0x01011012 }, /* rear */
6190 { 0x17, 0x01016011 }, /* clfe */
6194 static const struct alc_pincfg *alc882_pin_fixes[] = {
6195 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6198 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6199 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6204 * BIOS auto configuration
6206 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6207 hda_nid_t nid, int pin_type,
6211 struct alc_spec *spec = codec->spec;
6214 alc_set_pin_output(codec, nid, pin_type);
6215 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6218 idx = spec->multiout.dac_nids[dac_idx] - 2;
6219 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6223 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6225 struct alc_spec *spec = codec->spec;
6228 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6229 for (i = 0; i <= HDA_SIDE; i++) {
6230 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6231 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6233 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6238 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6240 struct alc_spec *spec = codec->spec;
6243 pin = spec->autocfg.hp_pins[0];
6244 if (pin) /* connect to front */
6246 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6247 pin = spec->autocfg.speaker_pins[0];
6249 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6252 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6253 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6255 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6257 struct alc_spec *spec = codec->spec;
6260 for (i = 0; i < AUTO_PIN_LAST; i++) {
6261 hda_nid_t nid = spec->autocfg.input_pins[i];
6266 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6267 if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) &
6271 snd_hda_codec_write(codec, nid, 0,
6272 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6273 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6274 snd_hda_codec_write(codec, nid, 0,
6275 AC_VERB_SET_AMP_GAIN_MUTE,
6280 /* add mic boosts if needed */
6281 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6283 struct alc_spec *spec = codec->spec;
6287 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6288 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6289 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6291 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6295 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6296 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6297 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6299 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6306 /* almost identical with ALC880 parser... */
6307 static int alc882_parse_auto_config(struct hda_codec *codec)
6309 struct alc_spec *spec = codec->spec;
6310 int err = alc880_parse_auto_config(codec);
6315 return 0; /* no config found */
6317 err = alc_auto_add_mic_boost(codec);
6321 /* hack - override the init verbs */
6322 spec->init_verbs[0] = alc882_auto_init_verbs;
6324 return 1; /* config found */
6327 /* additional initialization for auto-configuration model */
6328 static void alc882_auto_init(struct hda_codec *codec)
6330 struct alc_spec *spec = codec->spec;
6331 alc882_auto_init_multi_out(codec);
6332 alc882_auto_init_hp_out(codec);
6333 alc882_auto_init_analog_input(codec);
6334 if (spec->unsol_event)
6335 alc_sku_automute(codec);
6338 static int patch_alc882(struct hda_codec *codec)
6340 struct alc_spec *spec;
6341 int err, board_config;
6343 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6349 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6353 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6354 /* Pick up systems that don't supply PCI SSID */
6355 switch (codec->subsystem_id) {
6356 case 0x106b0c00: /* Mac Pro */
6357 board_config = ALC885_MACPRO;
6359 case 0x106b1000: /* iMac 24 */
6360 board_config = ALC885_IMAC24;
6362 case 0x106b00a1: /* Macbook */
6363 case 0x106b2c00: /* Macbook Pro rev3 */
6364 board_config = ALC885_MBP3;
6367 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6368 "trying auto-probe from BIOS...\n");
6369 board_config = ALC882_AUTO;
6373 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6375 if (board_config == ALC882_AUTO) {
6376 /* automatic parse from the BIOS config */
6377 err = alc882_parse_auto_config(codec);
6383 "hda_codec: Cannot set up configuration "
6384 "from BIOS. Using base mode...\n");
6385 board_config = ALC882_3ST_DIG;
6389 if (board_config != ALC882_AUTO)
6390 setup_preset(spec, &alc882_presets[board_config]);
6392 spec->stream_name_analog = "ALC882 Analog";
6393 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6394 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6395 /* FIXME: setup DAC5 */
6396 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6397 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6399 spec->stream_name_digital = "ALC882 Digital";
6400 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6401 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6403 if (!spec->adc_nids && spec->input_mux) {
6404 /* check whether NID 0x07 is valid */
6405 unsigned int wcap = get_wcaps(codec, 0x07);
6407 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6408 if (wcap != AC_WID_AUD_IN) {
6409 spec->adc_nids = alc882_adc_nids_alt;
6410 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6411 spec->capsrc_nids = alc882_capsrc_nids_alt;
6412 spec->mixers[spec->num_mixers] =
6413 alc882_capture_alt_mixer;
6416 spec->adc_nids = alc882_adc_nids;
6417 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6418 spec->capsrc_nids = alc882_capsrc_nids;
6419 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6424 spec->vmaster_nid = 0x0c;
6426 codec->patch_ops = alc_patch_ops;
6427 if (board_config == ALC882_AUTO)
6428 spec->init_hook = alc882_auto_init;
6429 #ifdef CONFIG_SND_HDA_POWER_SAVE
6430 if (!spec->loopback.amplist)
6431 spec->loopback.amplist = alc882_loopbacks;
6440 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6441 * configuration. Each pin widget can choose any input DACs and a mixer.
6442 * Each ADC is connected from a mixer of all inputs. This makes possible
6443 * 6-channel independent captures.
6445 * In addition, an independent DAC for the multi-playback (not used in this
6448 #define ALC883_DIGOUT_NID 0x06
6449 #define ALC883_DIGIN_NID 0x0a
6451 static hda_nid_t alc883_dac_nids[4] = {
6452 /* front, rear, clfe, rear_surr */
6453 0x02, 0x03, 0x04, 0x05
6456 static hda_nid_t alc883_adc_nids[2] = {
6461 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6464 /* FIXME: should be a matrix-type input source selection */
6466 static struct hda_input_mux alc883_capture_source = {
6470 { "Front Mic", 0x1 },
6476 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6484 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6494 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6502 #define alc883_mux_enum_info alc_mux_enum_info
6503 #define alc883_mux_enum_get alc_mux_enum_get
6504 /* ALC883 has the ALC882-type input selection */
6505 #define alc883_mux_enum_put alc882_mux_enum_put
6510 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6517 static struct hda_verb alc883_3ST_ch2_init[] = {
6518 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6519 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6520 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6521 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6528 static struct hda_verb alc883_3ST_ch4_init[] = {
6529 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6530 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6531 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6532 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6533 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6540 static struct hda_verb alc883_3ST_ch6_init[] = {
6541 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6542 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6543 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6544 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6545 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6546 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6550 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6551 { 2, alc883_3ST_ch2_init },
6552 { 4, alc883_3ST_ch4_init },
6553 { 6, alc883_3ST_ch6_init },
6559 static struct hda_verb alc883_sixstack_ch6_init[] = {
6560 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6561 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6562 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6563 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6570 static struct hda_verb alc883_sixstack_ch8_init[] = {
6571 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6572 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6573 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6574 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6578 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6579 { 6, alc883_sixstack_ch6_init },
6580 { 8, alc883_sixstack_ch8_init },
6583 static struct hda_verb alc883_medion_eapd_verbs[] = {
6584 /* eanable EAPD on medion laptop */
6585 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6586 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6590 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6591 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6594 static struct snd_kcontrol_new alc883_base_mixer[] = {
6595 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6596 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6597 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6598 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6599 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6600 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6601 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6602 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6603 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6604 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6605 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6606 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6607 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6608 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6609 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6611 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6612 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6613 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6614 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6615 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6616 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6617 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6618 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6619 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6620 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6621 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6623 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6624 /* .name = "Capture Source", */
6625 .name = "Input Source",
6627 .info = alc883_mux_enum_info,
6628 .get = alc883_mux_enum_get,
6629 .put = alc883_mux_enum_put,
6634 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6635 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6636 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6637 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6638 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6639 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6640 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6643 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6646 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6648 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6649 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6650 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6651 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6654 /* .name = "Capture Source", */
6655 .name = "Input Source",
6657 .info = alc883_mux_enum_info,
6658 .get = alc883_mux_enum_get,
6659 .put = alc883_mux_enum_put,
6664 static struct snd_kcontrol_new alc883_clevo_m720r_mixer[] = {
6665 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6666 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6667 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6668 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6670 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6672 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6673 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6674 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6675 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6676 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6677 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6678 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6680 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6681 /* .name = "Capture Source", */
6682 .name = "Input Source",
6684 .info = alc883_mux_enum_info,
6685 .get = alc883_mux_enum_get,
6686 .put = alc883_mux_enum_put,
6691 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6692 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6693 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6694 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6695 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6697 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6698 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6699 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6700 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6701 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6702 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6703 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6704 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6705 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6707 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6708 /* .name = "Capture Source", */
6709 .name = "Input Source",
6711 .info = alc883_mux_enum_info,
6712 .get = alc883_mux_enum_get,
6713 .put = alc883_mux_enum_put,
6718 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6719 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6720 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6722 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6723 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6724 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6725 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6727 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6728 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6729 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6730 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6731 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6732 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6733 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6734 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6735 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6736 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6737 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6739 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6740 /* .name = "Capture Source", */
6741 .name = "Input Source",
6743 .info = alc883_mux_enum_info,
6744 .get = alc883_mux_enum_get,
6745 .put = alc883_mux_enum_put,
6750 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6751 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6752 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6753 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6754 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6755 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6756 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6757 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6758 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6759 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6760 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6761 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6762 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6763 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6766 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6767 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6768 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6769 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6770 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6771 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6772 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6773 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6774 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6775 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6778 /* .name = "Capture Source", */
6779 .name = "Input Source",
6781 .info = alc883_mux_enum_info,
6782 .get = alc883_mux_enum_get,
6783 .put = alc883_mux_enum_put,
6788 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6789 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6790 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6791 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6792 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6793 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6794 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6795 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6796 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6798 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6799 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6800 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6801 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6803 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6805 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6806 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6807 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6808 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6809 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6810 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6811 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6814 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6815 /* .name = "Capture Source", */
6816 .name = "Input Source",
6818 .info = alc883_mux_enum_info,
6819 .get = alc883_mux_enum_get,
6820 .put = alc883_mux_enum_put,
6825 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6826 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6828 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6829 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6830 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6831 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6832 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6833 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6834 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6835 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6836 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6837 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6838 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6841 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, 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_tagra_2ch_mixer[] = {
6859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6861 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6865 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6867 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6868 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6869 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6870 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6873 /* .name = "Capture Source", */
6874 .name = "Input Source",
6876 .info = alc883_mux_enum_info,
6877 .get = alc883_mux_enum_get,
6878 .put = alc883_mux_enum_put,
6883 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6885 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6886 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6887 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6888 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6890 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6892 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6893 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6895 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6896 /* .name = "Capture Source", */
6897 .name = "Input Source",
6899 .info = alc883_mux_enum_info,
6900 .get = alc883_mux_enum_get,
6901 .put = alc883_mux_enum_put,
6906 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6907 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6908 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6910 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6911 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6914 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6915 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6916 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6917 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6918 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6919 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6921 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6922 /* .name = "Capture Source", */
6923 .name = "Input Source",
6925 .info = alc883_mux_enum_info,
6926 .get = alc883_mux_enum_get,
6927 .put = alc883_mux_enum_put,
6932 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6933 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6934 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6935 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6936 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6937 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6940 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6941 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6942 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6943 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6944 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6945 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6947 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6948 /* .name = "Capture Source", */
6949 .name = "Input Source",
6951 .info = alc883_mux_enum_info,
6952 .get = alc883_mux_enum_get,
6953 .put = alc883_mux_enum_put,
6958 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6959 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6960 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6962 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6963 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6965 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6966 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6967 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6968 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6969 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6970 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6973 /* .name = "Capture Source", */
6974 .name = "Input Source",
6976 .info = alc883_mux_enum_info,
6977 .get = alc883_mux_enum_get,
6978 .put = alc883_mux_enum_put,
6983 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6986 .name = "Channel Mode",
6987 .info = alc_ch_mode_info,
6988 .get = alc_ch_mode_get,
6989 .put = alc_ch_mode_put,
6994 static struct hda_verb alc883_init_verbs[] = {
6995 /* ADC1: mute amp left and right */
6996 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6997 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6998 /* ADC2: mute amp left and right */
6999 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7000 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7001 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7004 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7006 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7007 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7010 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7011 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7012 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7014 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7018 /* mute analog input loopbacks */
7019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7025 /* Front Pin: output 0 (0x0c) */
7026 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7028 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7029 /* Rear Pin: output 1 (0x0d) */
7030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7032 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7033 /* CLFE Pin: output 2 (0x0e) */
7034 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7035 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7036 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7037 /* Side Pin: output 3 (0x0f) */
7038 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7039 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7040 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7041 /* Mic (rear) pin: input vref at 80% */
7042 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7043 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7044 /* Front Mic pin: input vref at 80% */
7045 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7046 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7047 /* Line In pin: input */
7048 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7049 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7050 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7052 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7053 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7054 /* CD pin widget for input */
7055 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7057 /* FIXME: use matrix-type input source selection */
7058 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7065 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7066 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7072 /* toggle speaker-output according to the hp-jack state */
7073 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7075 unsigned int present;
7077 present = snd_hda_codec_read(codec, 0x15, 0,
7078 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7079 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7080 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7081 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7082 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7085 /* auto-toggle front mic */
7087 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7089 unsigned int present;
7092 present = snd_hda_codec_read(codec, 0x18, 0,
7093 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7094 bits = present ? HDA_AMP_MUTE : 0;
7095 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7099 static void alc883_mitac_automute(struct hda_codec *codec)
7101 alc883_mitac_hp_automute(codec);
7102 /* alc883_mitac_mic_automute(codec); */
7105 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7108 switch (res >> 26) {
7109 case ALC880_HP_EVENT:
7110 alc883_mitac_hp_automute(codec);
7112 case ALC880_MIC_EVENT:
7113 /* alc883_mitac_mic_automute(codec); */
7118 static struct hda_verb alc883_mitac_verbs[] = {
7120 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7121 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7123 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7124 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7126 /* enable unsolicited event */
7127 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7128 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7133 static struct hda_verb alc883_clevo_m720r_verbs[] = {
7135 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7136 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7138 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7141 /* enable unsolicited event */
7142 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7147 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7149 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7152 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7155 /* enable unsolicited event */
7156 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7161 static struct hda_verb alc883_tagra_verbs[] = {
7162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7166 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7168 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7169 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7170 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7172 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7173 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7174 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7175 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7180 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7181 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7182 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7183 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7187 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7190 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7195 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7198 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7199 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7200 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7204 static struct hda_verb alc883_haier_w66_verbs[] = {
7205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7210 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7211 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7212 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7217 static struct hda_verb alc888_3st_hp_verbs[] = {
7218 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7219 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7220 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7224 static struct hda_verb alc888_6st_dell_verbs[] = {
7225 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7229 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7230 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7231 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7232 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7233 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7237 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7238 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7239 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7240 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7241 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7245 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7246 { 2, alc888_3st_hp_2ch_init },
7247 { 6, alc888_3st_hp_6ch_init },
7250 /* toggle front-jack and RCA according to the hp-jack state */
7251 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7253 unsigned int present;
7255 present = snd_hda_codec_read(codec, 0x1b, 0,
7256 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7257 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7258 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7259 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7260 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7263 /* toggle RCA according to the front-jack state */
7264 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7266 unsigned int present;
7268 present = snd_hda_codec_read(codec, 0x14, 0,
7269 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7270 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7271 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7274 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7277 if ((res >> 26) == ALC880_HP_EVENT)
7278 alc888_lenovo_ms7195_front_automute(codec);
7279 if ((res >> 26) == ALC880_FRONT_EVENT)
7280 alc888_lenovo_ms7195_rca_automute(codec);
7283 static struct hda_verb alc883_medion_md2_verbs[] = {
7284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7287 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7289 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7293 /* toggle speaker-output according to the hp-jack state */
7294 static void alc883_medion_md2_automute(struct hda_codec *codec)
7296 unsigned int present;
7298 present = snd_hda_codec_read(codec, 0x14, 0,
7299 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7300 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7301 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7304 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7307 if ((res >> 26) == ALC880_HP_EVENT)
7308 alc883_medion_md2_automute(codec);
7311 /* toggle speaker-output according to the hp-jack state */
7312 static void alc883_tagra_automute(struct hda_codec *codec)
7314 unsigned int present;
7317 present = snd_hda_codec_read(codec, 0x14, 0,
7318 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7319 bits = present ? HDA_AMP_MUTE : 0;
7320 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7321 HDA_AMP_MUTE, bits);
7322 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7326 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7328 if ((res >> 26) == ALC880_HP_EVENT)
7329 alc883_tagra_automute(codec);
7332 /* toggle speaker-output according to the hp-jack state */
7333 static void alc883_clevo_m720r_automute(struct hda_codec *codec)
7335 unsigned int present;
7338 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7339 & AC_PINSENSE_PRESENCE;
7340 bits = present ? HDA_AMP_MUTE : 0;
7341 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7342 HDA_AMP_MUTE, bits);
7345 static void alc883_clevo_m720r_unsol_event(struct hda_codec *codec,
7348 if ((res >> 26) == ALC880_HP_EVENT)
7349 alc883_clevo_m720r_automute(codec);
7352 /* toggle speaker-output according to the hp-jack state */
7353 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7355 unsigned int present;
7358 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7359 & AC_PINSENSE_PRESENCE;
7360 bits = present ? HDA_AMP_MUTE : 0;
7361 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7362 HDA_AMP_MUTE, bits);
7365 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7368 if ((res >> 26) == ALC880_HP_EVENT)
7369 alc883_2ch_fujitsu_pi2515_automute(codec);
7372 static void alc883_haier_w66_automute(struct hda_codec *codec)
7374 unsigned int present;
7377 present = snd_hda_codec_read(codec, 0x1b, 0,
7378 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7379 bits = present ? 0x80 : 0;
7380 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7384 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7387 if ((res >> 26) == ALC880_HP_EVENT)
7388 alc883_haier_w66_automute(codec);
7391 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7393 unsigned int present;
7396 present = snd_hda_codec_read(codec, 0x14, 0,
7397 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7398 bits = present ? HDA_AMP_MUTE : 0;
7399 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7400 HDA_AMP_MUTE, bits);
7403 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7405 unsigned int present;
7408 present = snd_hda_codec_read(codec, 0x1b, 0,
7409 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7410 bits = present ? HDA_AMP_MUTE : 0;
7411 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7412 HDA_AMP_MUTE, bits);
7413 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7414 HDA_AMP_MUTE, bits);
7417 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7420 if ((res >> 26) == ALC880_HP_EVENT)
7421 alc883_lenovo_101e_all_automute(codec);
7422 if ((res >> 26) == ALC880_FRONT_EVENT)
7423 alc883_lenovo_101e_ispeaker_automute(codec);
7426 /* toggle speaker-output according to the hp-jack state */
7427 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7429 unsigned int present;
7431 present = snd_hda_codec_read(codec, 0x14, 0,
7432 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7433 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7434 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7435 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7436 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7439 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7442 if ((res >> 26) == ALC880_HP_EVENT)
7443 alc883_acer_aspire_automute(codec);
7446 static struct hda_verb alc883_acer_eapd_verbs[] = {
7447 /* HP Pin: output 0 (0x0c) */
7448 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7450 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7451 /* Front Pin: output 0 (0x0c) */
7452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7453 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7454 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7455 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7456 /* eanable EAPD on medion laptop */
7457 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7458 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7459 /* enable unsolicited event */
7460 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7464 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7466 unsigned int present;
7468 present = snd_hda_codec_read(codec, 0x1b, 0,
7469 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7470 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7471 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7472 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7473 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7474 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7475 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7476 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7477 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7480 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7483 switch (res >> 26) {
7484 case ALC880_HP_EVENT:
7485 printk("hp_event\n");
7486 alc888_6st_dell_front_automute(codec);
7492 * generic initialization of ADC, input mixers and output mixers
7494 static struct hda_verb alc883_auto_init_verbs[] = {
7496 * Unmute ADC0-2 and set the default input to mic-in
7498 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7499 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7500 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7501 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7503 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7505 * Note: PASD motherboards uses the Line In 2 as the input for
7506 * front panel mic (mic 2)
7508 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7516 * Set up output mixers (0x0c - 0x0f)
7518 /* set vol=0 to output mixers */
7519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7522 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7523 /* set up input amps for analog loopback */
7524 /* Amp Indices: DAC = 0, mixer = 1 */
7525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7528 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7531 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7533 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7534 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7536 /* FIXME: use matrix-type input source selection */
7537 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7541 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7542 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7546 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7548 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7554 /* capture mixer elements */
7555 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7556 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7557 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7558 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7559 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7562 /* The multiple "Capture Source" controls confuse alsamixer
7563 * So call somewhat different..
7565 /* .name = "Capture Source", */
7566 .name = "Input Source",
7568 .info = alc882_mux_enum_info,
7569 .get = alc882_mux_enum_get,
7570 .put = alc882_mux_enum_put,
7575 #ifdef CONFIG_SND_HDA_POWER_SAVE
7576 #define alc883_loopbacks alc880_loopbacks
7579 /* pcm configuration: identiacal with ALC880 */
7580 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7581 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7582 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7583 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7584 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7587 * configuration and preset
7589 static const char *alc883_models[ALC883_MODEL_LAST] = {
7590 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7591 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7592 [ALC883_3ST_6ch] = "3stack-6ch",
7593 [ALC883_6ST_DIG] = "6stack-dig",
7594 [ALC883_TARGA_DIG] = "targa-dig",
7595 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7596 [ALC883_ACER] = "acer",
7597 [ALC883_ACER_ASPIRE] = "acer-aspire",
7598 [ALC883_MEDION] = "medion",
7599 [ALC883_MEDION_MD2] = "medion-md2",
7600 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7601 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7602 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7603 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7604 [ALC883_HAIER_W66] = "haier-w66",
7605 [ALC888_3ST_HP] = "3stack-hp",
7606 [ALC888_6ST_DELL] = "6stack-dell",
7607 [ALC883_MITAC] = "mitac",
7608 [ALC883_CLEVO_M720R] = "clevo-m720r",
7609 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7610 [ALC883_AUTO] = "auto",
7613 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7614 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7615 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7616 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7617 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7618 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7619 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7620 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7621 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7622 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7623 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7624 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7625 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7626 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7627 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7628 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7629 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7630 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7631 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7632 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7633 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7634 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7635 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7636 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7637 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7638 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7639 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7640 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7641 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7642 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7643 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7644 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7645 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7646 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7647 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7648 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7649 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7650 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7651 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7652 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720R),
7653 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720R),
7654 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7655 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7656 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7657 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7658 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7659 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7660 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7661 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7662 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7663 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7664 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7665 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7669 static struct alc_config_preset alc883_presets[] = {
7670 [ALC883_3ST_2ch_DIG] = {
7671 .mixers = { alc883_3ST_2ch_mixer },
7672 .init_verbs = { alc883_init_verbs },
7673 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7674 .dac_nids = alc883_dac_nids,
7675 .dig_out_nid = ALC883_DIGOUT_NID,
7676 .dig_in_nid = ALC883_DIGIN_NID,
7677 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7678 .channel_mode = alc883_3ST_2ch_modes,
7679 .input_mux = &alc883_capture_source,
7681 [ALC883_3ST_6ch_DIG] = {
7682 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7683 .init_verbs = { alc883_init_verbs },
7684 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7685 .dac_nids = alc883_dac_nids,
7686 .dig_out_nid = ALC883_DIGOUT_NID,
7687 .dig_in_nid = ALC883_DIGIN_NID,
7688 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7689 .channel_mode = alc883_3ST_6ch_modes,
7691 .input_mux = &alc883_capture_source,
7693 [ALC883_3ST_6ch] = {
7694 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7695 .init_verbs = { alc883_init_verbs },
7696 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7697 .dac_nids = alc883_dac_nids,
7698 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7699 .channel_mode = alc883_3ST_6ch_modes,
7701 .input_mux = &alc883_capture_source,
7703 [ALC883_6ST_DIG] = {
7704 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7705 .init_verbs = { alc883_init_verbs },
7706 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7707 .dac_nids = alc883_dac_nids,
7708 .dig_out_nid = ALC883_DIGOUT_NID,
7709 .dig_in_nid = ALC883_DIGIN_NID,
7710 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7711 .channel_mode = alc883_sixstack_modes,
7712 .input_mux = &alc883_capture_source,
7714 [ALC883_TARGA_DIG] = {
7715 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7716 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7717 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7718 .dac_nids = alc883_dac_nids,
7719 .dig_out_nid = ALC883_DIGOUT_NID,
7720 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7721 .channel_mode = alc883_3ST_6ch_modes,
7723 .input_mux = &alc883_capture_source,
7724 .unsol_event = alc883_tagra_unsol_event,
7725 .init_hook = alc883_tagra_automute,
7727 [ALC883_TARGA_2ch_DIG] = {
7728 .mixers = { alc883_tagra_2ch_mixer},
7729 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7730 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7731 .dac_nids = alc883_dac_nids,
7732 .dig_out_nid = ALC883_DIGOUT_NID,
7733 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7734 .channel_mode = alc883_3ST_2ch_modes,
7735 .input_mux = &alc883_capture_source,
7736 .unsol_event = alc883_tagra_unsol_event,
7737 .init_hook = alc883_tagra_automute,
7740 .mixers = { alc883_base_mixer },
7741 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7742 * and the headphone jack. Turn this on and rely on the
7743 * standard mute methods whenever the user wants to turn
7744 * these outputs off.
7746 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7747 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7748 .dac_nids = alc883_dac_nids,
7749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7750 .channel_mode = alc883_3ST_2ch_modes,
7751 .input_mux = &alc883_capture_source,
7753 [ALC883_ACER_ASPIRE] = {
7754 .mixers = { alc883_acer_aspire_mixer },
7755 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7756 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7757 .dac_nids = alc883_dac_nids,
7758 .dig_out_nid = ALC883_DIGOUT_NID,
7759 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7760 .channel_mode = alc883_3ST_2ch_modes,
7761 .input_mux = &alc883_capture_source,
7762 .unsol_event = alc883_acer_aspire_unsol_event,
7763 .init_hook = alc883_acer_aspire_automute,
7766 .mixers = { alc883_fivestack_mixer,
7767 alc883_chmode_mixer },
7768 .init_verbs = { alc883_init_verbs,
7769 alc883_medion_eapd_verbs },
7770 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7771 .dac_nids = alc883_dac_nids,
7772 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7773 .channel_mode = alc883_sixstack_modes,
7774 .input_mux = &alc883_capture_source,
7776 [ALC883_MEDION_MD2] = {
7777 .mixers = { alc883_medion_md2_mixer},
7778 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7780 .dac_nids = alc883_dac_nids,
7781 .dig_out_nid = ALC883_DIGOUT_NID,
7782 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7783 .channel_mode = alc883_3ST_2ch_modes,
7784 .input_mux = &alc883_capture_source,
7785 .unsol_event = alc883_medion_md2_unsol_event,
7786 .init_hook = alc883_medion_md2_automute,
7788 [ALC883_LAPTOP_EAPD] = {
7789 .mixers = { alc883_base_mixer },
7790 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7791 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7792 .dac_nids = alc883_dac_nids,
7793 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7794 .channel_mode = alc883_3ST_2ch_modes,
7795 .input_mux = &alc883_capture_source,
7797 [ALC883_CLEVO_M720R] = {
7798 .mixers = { alc883_clevo_m720r_mixer },
7799 .init_verbs = { alc883_init_verbs, alc883_clevo_m720r_verbs },
7800 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7801 .dac_nids = alc883_dac_nids,
7802 .dig_out_nid = ALC883_DIGOUT_NID,
7803 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7804 .channel_mode = alc883_3ST_2ch_modes,
7805 .input_mux = &alc883_capture_source,
7806 .unsol_event = alc883_clevo_m720r_unsol_event,
7807 .init_hook = alc883_clevo_m720r_automute,
7809 [ALC883_LENOVO_101E_2ch] = {
7810 .mixers = { alc883_lenovo_101e_2ch_mixer},
7811 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7812 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7813 .dac_nids = alc883_dac_nids,
7814 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7815 .channel_mode = alc883_3ST_2ch_modes,
7816 .input_mux = &alc883_lenovo_101e_capture_source,
7817 .unsol_event = alc883_lenovo_101e_unsol_event,
7818 .init_hook = alc883_lenovo_101e_all_automute,
7820 [ALC883_LENOVO_NB0763] = {
7821 .mixers = { alc883_lenovo_nb0763_mixer },
7822 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7823 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7824 .dac_nids = alc883_dac_nids,
7825 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7826 .channel_mode = alc883_3ST_2ch_modes,
7828 .input_mux = &alc883_lenovo_nb0763_capture_source,
7829 .unsol_event = alc883_medion_md2_unsol_event,
7830 .init_hook = alc883_medion_md2_automute,
7832 [ALC888_LENOVO_MS7195_DIG] = {
7833 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7834 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7835 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7836 .dac_nids = alc883_dac_nids,
7837 .dig_out_nid = ALC883_DIGOUT_NID,
7838 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7839 .channel_mode = alc883_3ST_6ch_modes,
7841 .input_mux = &alc883_capture_source,
7842 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7843 .init_hook = alc888_lenovo_ms7195_front_automute,
7845 [ALC883_HAIER_W66] = {
7846 .mixers = { alc883_tagra_2ch_mixer},
7847 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7848 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7849 .dac_nids = alc883_dac_nids,
7850 .dig_out_nid = ALC883_DIGOUT_NID,
7851 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7852 .channel_mode = alc883_3ST_2ch_modes,
7853 .input_mux = &alc883_capture_source,
7854 .unsol_event = alc883_haier_w66_unsol_event,
7855 .init_hook = alc883_haier_w66_automute,
7858 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7859 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7860 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7861 .dac_nids = alc883_dac_nids,
7862 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7863 .channel_mode = alc888_3st_hp_modes,
7865 .input_mux = &alc883_capture_source,
7867 [ALC888_6ST_DELL] = {
7868 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7869 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7870 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7871 .dac_nids = alc883_dac_nids,
7872 .dig_out_nid = ALC883_DIGOUT_NID,
7873 .dig_in_nid = ALC883_DIGIN_NID,
7874 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7875 .channel_mode = alc883_sixstack_modes,
7876 .input_mux = &alc883_capture_source,
7877 .unsol_event = alc888_6st_dell_unsol_event,
7878 .init_hook = alc888_6st_dell_front_automute,
7881 .mixers = { alc883_mitac_mixer },
7882 .init_verbs = { alc883_init_verbs, alc883_mitac_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,
7888 .unsol_event = alc883_mitac_unsol_event,
7889 .init_hook = alc883_mitac_automute,
7891 [ALC883_FUJITSU_PI2515] = {
7892 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
7893 .init_verbs = { alc883_init_verbs,
7894 alc883_2ch_fujitsu_pi2515_verbs},
7895 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7896 .dac_nids = alc883_dac_nids,
7897 .dig_out_nid = ALC883_DIGOUT_NID,
7898 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7899 .channel_mode = alc883_3ST_2ch_modes,
7900 .input_mux = &alc883_fujitsu_pi2515_capture_source,
7901 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
7902 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
7908 * BIOS auto configuration
7910 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7911 hda_nid_t nid, int pin_type,
7915 struct alc_spec *spec = codec->spec;
7918 alc_set_pin_output(codec, nid, pin_type);
7919 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7922 idx = spec->multiout.dac_nids[dac_idx] - 2;
7923 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7927 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7929 struct alc_spec *spec = codec->spec;
7932 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7933 for (i = 0; i <= HDA_SIDE; i++) {
7934 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7935 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7937 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7942 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7944 struct alc_spec *spec = codec->spec;
7947 pin = spec->autocfg.hp_pins[0];
7948 if (pin) /* connect to front */
7950 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7951 pin = spec->autocfg.speaker_pins[0];
7953 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7956 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7957 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7959 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7961 struct alc_spec *spec = codec->spec;
7964 for (i = 0; i < AUTO_PIN_LAST; i++) {
7965 hda_nid_t nid = spec->autocfg.input_pins[i];
7966 if (alc883_is_input_pin(nid)) {
7967 snd_hda_codec_write(codec, nid, 0,
7968 AC_VERB_SET_PIN_WIDGET_CONTROL,
7969 (i <= AUTO_PIN_FRONT_MIC ?
7970 PIN_VREF80 : PIN_IN));
7971 if (nid != ALC883_PIN_CD_NID)
7972 snd_hda_codec_write(codec, nid, 0,
7973 AC_VERB_SET_AMP_GAIN_MUTE,
7979 /* almost identical with ALC880 parser... */
7980 static int alc883_parse_auto_config(struct hda_codec *codec)
7982 struct alc_spec *spec = codec->spec;
7983 int err = alc880_parse_auto_config(codec);
7988 return 0; /* no config found */
7990 err = alc_auto_add_mic_boost(codec);
7994 /* hack - override the init verbs */
7995 spec->init_verbs[0] = alc883_auto_init_verbs;
7996 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7999 return 1; /* config found */
8002 /* additional initialization for auto-configuration model */
8003 static void alc883_auto_init(struct hda_codec *codec)
8005 struct alc_spec *spec = codec->spec;
8006 alc883_auto_init_multi_out(codec);
8007 alc883_auto_init_hp_out(codec);
8008 alc883_auto_init_analog_input(codec);
8009 if (spec->unsol_event)
8010 alc_sku_automute(codec);
8013 static int patch_alc883(struct hda_codec *codec)
8015 struct alc_spec *spec;
8016 int err, board_config;
8018 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8024 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8027 if (board_config < 0) {
8028 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8029 "trying auto-probe from BIOS...\n");
8030 board_config = ALC883_AUTO;
8033 if (board_config == ALC883_AUTO) {
8034 /* automatic parse from the BIOS config */
8035 err = alc883_parse_auto_config(codec);
8041 "hda_codec: Cannot set up configuration "
8042 "from BIOS. Using base mode...\n");
8043 board_config = ALC883_3ST_2ch_DIG;
8047 if (board_config != ALC883_AUTO)
8048 setup_preset(spec, &alc883_presets[board_config]);
8050 spec->stream_name_analog = "ALC883 Analog";
8051 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8052 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8053 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8055 spec->stream_name_digital = "ALC883 Digital";
8056 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8057 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8059 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8060 spec->adc_nids = alc883_adc_nids;
8061 spec->capsrc_nids = alc883_capsrc_nids;
8063 spec->vmaster_nid = 0x0c;
8065 codec->patch_ops = alc_patch_ops;
8066 if (board_config == ALC883_AUTO)
8067 spec->init_hook = alc883_auto_init;
8068 #ifdef CONFIG_SND_HDA_POWER_SAVE
8069 if (!spec->loopback.amplist)
8070 spec->loopback.amplist = alc883_loopbacks;
8080 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8081 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8083 #define alc262_dac_nids alc260_dac_nids
8084 #define alc262_adc_nids alc882_adc_nids
8085 #define alc262_adc_nids_alt alc882_adc_nids_alt
8086 #define alc262_capsrc_nids alc882_capsrc_nids
8087 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8089 #define alc262_modes alc260_modes
8090 #define alc262_capture_source alc882_capture_source
8092 static struct snd_kcontrol_new alc262_base_mixer[] = {
8093 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8098 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8103 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8104 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8105 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8106 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8107 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8108 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8109 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8110 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8114 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8115 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8116 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8117 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8118 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8119 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8120 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8126 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8127 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8128 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8129 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8134 /* update HP, line and mono-out pins according to the master switch */
8135 static void alc262_hp_master_update(struct hda_codec *codec)
8137 struct alc_spec *spec = codec->spec;
8138 int val = spec->master_sw;
8141 snd_hda_codec_write_cache(codec, 0x1b, 0,
8142 AC_VERB_SET_PIN_WIDGET_CONTROL,
8144 snd_hda_codec_write_cache(codec, 0x15, 0,
8145 AC_VERB_SET_PIN_WIDGET_CONTROL,
8147 /* mono (speaker) depending on the HP jack sense */
8148 val = val && !spec->jack_present;
8149 snd_hda_codec_write_cache(codec, 0x16, 0,
8150 AC_VERB_SET_PIN_WIDGET_CONTROL,
8154 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8156 struct alc_spec *spec = codec->spec;
8157 unsigned int presence;
8158 presence = snd_hda_codec_read(codec, 0x1b, 0,
8159 AC_VERB_GET_PIN_SENSE, 0);
8160 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8161 alc262_hp_master_update(codec);
8164 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8166 if ((res >> 26) != ALC880_HP_EVENT)
8168 alc262_hp_bpc_automute(codec);
8171 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8173 struct alc_spec *spec = codec->spec;
8174 unsigned int presence;
8175 presence = snd_hda_codec_read(codec, 0x15, 0,
8176 AC_VERB_GET_PIN_SENSE, 0);
8177 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8178 alc262_hp_master_update(codec);
8181 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8184 if ((res >> 26) != ALC880_HP_EVENT)
8186 alc262_hp_wildwest_automute(codec);
8189 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8190 struct snd_ctl_elem_value *ucontrol)
8192 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8193 struct alc_spec *spec = codec->spec;
8194 *ucontrol->value.integer.value = spec->master_sw;
8198 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8199 struct snd_ctl_elem_value *ucontrol)
8201 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8202 struct alc_spec *spec = codec->spec;
8203 int val = !!*ucontrol->value.integer.value;
8205 if (val == spec->master_sw)
8207 spec->master_sw = val;
8208 alc262_hp_master_update(codec);
8212 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8214 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8215 .name = "Master Playback Switch",
8216 .info = snd_ctl_boolean_mono_info,
8217 .get = alc262_hp_master_sw_get,
8218 .put = alc262_hp_master_sw_put,
8220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8221 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8222 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8223 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8225 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8227 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8228 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8230 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8231 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8232 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8235 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8236 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8237 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8238 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8239 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8240 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8244 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8247 .name = "Master Playback Switch",
8248 .info = snd_ctl_boolean_mono_info,
8249 .get = alc262_hp_master_sw_get,
8250 .put = alc262_hp_master_sw_put,
8252 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8253 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8256 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8258 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8260 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8261 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8262 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8265 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8266 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8267 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8268 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8272 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8273 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8274 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8275 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8279 /* mute/unmute internal speaker according to the hp jack and mute state */
8280 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8282 struct alc_spec *spec = codec->spec;
8284 if (force || !spec->sense_updated) {
8285 unsigned int present;
8286 present = snd_hda_codec_read(codec, 0x15, 0,
8287 AC_VERB_GET_PIN_SENSE, 0);
8288 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8289 spec->sense_updated = 1;
8291 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8292 spec->jack_present ? HDA_AMP_MUTE : 0);
8295 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8298 if ((res >> 26) != ALC880_HP_EVENT)
8300 alc262_hp_t5735_automute(codec, 1);
8303 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8305 alc262_hp_t5735_automute(codec, 1);
8308 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8309 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8310 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8311 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8315 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8319 static struct hda_verb alc262_hp_t5735_verbs[] = {
8320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8327 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8328 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8330 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8331 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8332 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8333 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8337 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8338 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8339 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8340 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8341 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8342 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8343 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8351 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8358 /* bind hp and internal speaker mute (with plug check) */
8359 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8360 struct snd_ctl_elem_value *ucontrol)
8362 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8363 long *valp = ucontrol->value.integer.value;
8366 /* change hp mute */
8367 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8369 valp[0] ? 0 : HDA_AMP_MUTE);
8370 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8372 valp[1] ? 0 : HDA_AMP_MUTE);
8374 /* change speaker according to HP jack state */
8375 struct alc_spec *spec = codec->spec;
8377 if (spec->jack_present)
8378 mute = HDA_AMP_MUTE;
8380 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8382 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8383 HDA_AMP_MUTE, mute);
8388 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8389 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8391 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8392 .name = "Master Playback Switch",
8393 .info = snd_hda_mixer_amp_switch_info,
8394 .get = snd_hda_mixer_amp_switch_get,
8395 .put = alc262_sony_master_sw_put,
8396 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8400 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8401 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8405 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8407 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8408 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8409 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8410 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8411 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8412 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8416 #define alc262_capture_mixer alc882_capture_mixer
8417 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8420 * generic initialization of ADC, input mixers and output mixers
8422 static struct hda_verb alc262_init_verbs[] = {
8424 * Unmute ADC0-2 and set the default input to mic-in
8426 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8428 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8429 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8430 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8431 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8433 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8435 * Note: PASD motherboards uses the Line In 2 as the input for
8436 * front panel mic (mic 2)
8438 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8446 * Set up output mixers (0x0c - 0x0e)
8448 /* set vol=0 to output mixers */
8449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8451 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8452 /* set up input amps for analog loopback */
8453 /* Amp Indices: DAC = 0, mixer = 1 */
8454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8463 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8464 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8465 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8466 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8468 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8470 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8471 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8472 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8474 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8475 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8477 /* FIXME: use matrix-type input source selection */
8478 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8479 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8482 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8483 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8498 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8499 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8504 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8505 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8506 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8507 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8509 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8514 static struct hda_verb alc262_sony_unsol_verbs[] = {
8515 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8516 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8517 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8519 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8520 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8523 /* mute/unmute internal speaker according to the hp jack and mute state */
8524 static void alc262_hippo_automute(struct hda_codec *codec)
8526 struct alc_spec *spec = codec->spec;
8528 unsigned int present;
8530 /* need to execute and sync at first */
8531 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8532 present = snd_hda_codec_read(codec, 0x15, 0,
8533 AC_VERB_GET_PIN_SENSE, 0);
8534 spec->jack_present = (present & 0x80000000) != 0;
8535 if (spec->jack_present) {
8536 /* mute internal speaker */
8537 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8538 HDA_AMP_MUTE, HDA_AMP_MUTE);
8540 /* unmute internal speaker if necessary */
8541 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8542 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8543 HDA_AMP_MUTE, mute);
8547 /* unsolicited event for HP jack sensing */
8548 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8551 if ((res >> 26) != ALC880_HP_EVENT)
8553 alc262_hippo_automute(codec);
8556 static void alc262_hippo1_automute(struct hda_codec *codec)
8559 unsigned int present;
8561 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8562 present = snd_hda_codec_read(codec, 0x1b, 0,
8563 AC_VERB_GET_PIN_SENSE, 0);
8564 present = (present & 0x80000000) != 0;
8566 /* mute internal speaker */
8567 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8568 HDA_AMP_MUTE, HDA_AMP_MUTE);
8570 /* unmute internal speaker if necessary */
8571 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8572 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8573 HDA_AMP_MUTE, mute);
8577 /* unsolicited event for HP jack sensing */
8578 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8581 if ((res >> 26) != ALC880_HP_EVENT)
8583 alc262_hippo1_automute(codec);
8588 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8589 * 0x1b = port replicator headphone out
8592 #define ALC_HP_EVENT 0x37
8594 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8595 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8596 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8597 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8598 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8602 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8603 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8604 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8608 static struct hda_input_mux alc262_fujitsu_capture_source = {
8617 static struct hda_input_mux alc262_HP_capture_source = {
8621 { "Front Mic", 0x1 },
8628 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8632 { "Front Mic", 0x2 },
8638 /* mute/unmute internal speaker according to the hp jack and mute state */
8639 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8641 struct alc_spec *spec = codec->spec;
8644 if (force || !spec->sense_updated) {
8645 unsigned int present_int_hp, present_dock_hp;
8646 /* need to execute and sync at first */
8647 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8648 present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
8649 AC_VERB_GET_PIN_SENSE, 0);
8650 snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
8651 present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0,
8652 AC_VERB_GET_PIN_SENSE, 0);
8653 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8654 spec->jack_present |= (present_dock_hp & 0x80000000) != 0;
8655 spec->sense_updated = 1;
8657 if (spec->jack_present) {
8658 /* mute internal speaker */
8659 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8660 HDA_AMP_MUTE, HDA_AMP_MUTE);
8662 /* unmute internal speaker if necessary */
8663 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8664 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8665 HDA_AMP_MUTE, mute);
8669 /* unsolicited event for HP jack sensing */
8670 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8673 if ((res >> 26) != ALC_HP_EVENT)
8675 alc262_fujitsu_automute(codec, 1);
8678 /* bind volumes of both NID 0x0c and 0x0d */
8679 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8680 .ops = &snd_hda_bind_vol,
8682 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8683 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8688 /* mute/unmute internal speaker according to the hp jack and mute state */
8689 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
8691 struct alc_spec *spec = codec->spec;
8694 if (force || !spec->sense_updated) {
8695 unsigned int present_int_hp;
8696 /* need to execute and sync at first */
8697 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8698 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
8699 AC_VERB_GET_PIN_SENSE, 0);
8700 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8701 spec->sense_updated = 1;
8703 if (spec->jack_present) {
8704 /* mute internal speaker */
8705 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8706 HDA_AMP_MUTE, HDA_AMP_MUTE);
8707 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8708 HDA_AMP_MUTE, HDA_AMP_MUTE);
8710 /* unmute internal speaker if necessary */
8711 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8712 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8713 HDA_AMP_MUTE, mute);
8714 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8715 HDA_AMP_MUTE, mute);
8719 /* unsolicited event for HP jack sensing */
8720 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
8723 if ((res >> 26) != ALC_HP_EVENT)
8725 alc262_lenovo_3000_automute(codec, 1);
8728 /* bind hp and internal speaker mute (with plug check) */
8729 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8730 struct snd_ctl_elem_value *ucontrol)
8732 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8733 long *valp = ucontrol->value.integer.value;
8736 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8738 valp ? 0 : HDA_AMP_MUTE);
8739 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8741 valp ? 0 : HDA_AMP_MUTE);
8744 alc262_fujitsu_automute(codec, 0);
8748 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8749 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8751 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8752 .name = "Master Playback Switch",
8753 .info = snd_hda_mixer_amp_switch_info,
8754 .get = snd_hda_mixer_amp_switch_get,
8755 .put = alc262_fujitsu_master_sw_put,
8756 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8758 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8759 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8763 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8764 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8765 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8769 /* bind hp and internal speaker mute (with plug check) */
8770 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
8771 struct snd_ctl_elem_value *ucontrol)
8773 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8774 long *valp = ucontrol->value.integer.value;
8777 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8779 valp ? 0 : HDA_AMP_MUTE);
8782 alc262_lenovo_3000_automute(codec, 0);
8786 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
8787 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8789 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8790 .name = "Master Playback Switch",
8791 .info = snd_hda_mixer_amp_switch_info,
8792 .get = snd_hda_mixer_amp_switch_get,
8793 .put = alc262_lenovo_3000_master_sw_put,
8794 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8796 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8797 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8801 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8802 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8803 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8807 /* additional init verbs for Benq laptops */
8808 static struct hda_verb alc262_EAPD_verbs[] = {
8809 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8810 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8814 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8815 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8818 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8819 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8823 /* Samsung Q1 Ultra Vista model setup */
8824 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8825 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8826 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
8827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8828 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8829 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8830 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
8834 static struct hda_verb alc262_ultra_verbs[] = {
8836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8842 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8843 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8845 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8846 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8847 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8848 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8849 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8851 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8853 /* ADC, choose mic */
8854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
8867 /* mute/unmute internal speaker according to the hp jack and mute state */
8868 static void alc262_ultra_automute(struct hda_codec *codec)
8870 struct alc_spec *spec = codec->spec;
8874 /* auto-mute only when HP is used as HP */
8875 if (!spec->cur_mux[0]) {
8876 unsigned int present;
8877 /* need to execute and sync at first */
8878 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8879 present = snd_hda_codec_read(codec, 0x15, 0,
8880 AC_VERB_GET_PIN_SENSE, 0);
8881 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8882 if (spec->jack_present)
8883 mute = HDA_AMP_MUTE;
8885 /* mute/unmute internal speaker */
8886 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8887 HDA_AMP_MUTE, mute);
8888 /* mute/unmute HP */
8889 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8890 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
8893 /* unsolicited event for HP jack sensing */
8894 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8897 if ((res >> 26) != ALC880_HP_EVENT)
8899 alc262_ultra_automute(codec);
8902 static struct hda_input_mux alc262_ultra_capture_source = {
8906 { "Headphone", 0x7 },
8910 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
8911 struct snd_ctl_elem_value *ucontrol)
8913 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8914 struct alc_spec *spec = codec->spec;
8917 ret = alc882_mux_enum_put(kcontrol, ucontrol);
8920 /* reprogram the HP pin as mic or HP according to the input source */
8921 snd_hda_codec_write_cache(codec, 0x15, 0,
8922 AC_VERB_SET_PIN_WIDGET_CONTROL,
8923 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
8924 alc262_ultra_automute(codec); /* mute/unmute HP */
8928 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
8929 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
8930 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
8932 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8933 .name = "Capture Source",
8934 .info = alc882_mux_enum_info,
8935 .get = alc882_mux_enum_get,
8936 .put = alc262_ultra_mux_enum_put,
8941 /* add playback controls from the parsed DAC table */
8942 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8943 const struct auto_pin_cfg *cfg)
8948 spec->multiout.num_dacs = 1; /* only use one dac */
8949 spec->multiout.dac_nids = spec->private_dac_nids;
8950 spec->multiout.dac_nids[0] = 2;
8952 nid = cfg->line_out_pins[0];
8954 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8955 "Front Playback Volume",
8956 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8959 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8960 "Front Playback Switch",
8961 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8966 nid = cfg->speaker_pins[0];
8969 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8970 "Speaker Playback Volume",
8971 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8975 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8976 "Speaker Playback Switch",
8977 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8982 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8983 "Speaker Playback Switch",
8984 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8990 nid = cfg->hp_pins[0];
8992 /* spec->multiout.hp_nid = 2; */
8994 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8995 "Headphone Playback Volume",
8996 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9000 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9001 "Headphone Playback Switch",
9002 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9007 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9008 "Headphone Playback Switch",
9009 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9018 /* identical with ALC880 */
9019 #define alc262_auto_create_analog_input_ctls \
9020 alc880_auto_create_analog_input_ctls
9023 * generic initialization of ADC, input mixers and output mixers
9025 static struct hda_verb alc262_volume_init_verbs[] = {
9027 * Unmute ADC0-2 and set the default input to mic-in
9029 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9031 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9032 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9033 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9034 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9036 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9038 * Note: PASD motherboards uses the Line In 2 as the input for
9039 * front panel mic (mic 2)
9041 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9049 * Set up output mixers (0x0c - 0x0f)
9051 /* set vol=0 to output mixers */
9052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9056 /* set up input amps for analog loopback */
9057 /* Amp Indices: DAC = 0, mixer = 1 */
9058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9060 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9061 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9062 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9063 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9065 /* FIXME: use matrix-type input source selection */
9066 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9067 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9086 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9088 * Unmute ADC0-2 and set the default input to mic-in
9090 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9091 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9092 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9093 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9094 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9095 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9097 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9099 * Note: PASD motherboards uses the Line In 2 as the input for
9100 * front panel mic (mic 2)
9102 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9112 * Set up output mixers (0x0c - 0x0e)
9114 /* set vol=0 to output mixers */
9115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9116 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9117 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9119 /* set up input amps for analog loopback */
9120 /* Amp Indices: DAC = 0, mixer = 1 */
9121 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9122 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9123 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9124 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9126 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9128 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9130 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9132 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9135 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9136 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9139 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9140 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9141 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9142 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9144 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9147 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9148 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9149 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9152 /* FIXME: use matrix-type input source selection */
9153 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9154 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9160 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9161 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9162 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9163 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9165 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9167 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9168 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9170 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9175 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9177 * Unmute ADC0-2 and set the default input to mic-in
9179 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9181 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9182 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9183 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9184 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9186 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9188 * Note: PASD motherboards uses the Line In 2 as the input for front
9191 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9192 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9194 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9195 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9196 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9197 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9198 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9199 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9201 * Set up output mixers (0x0c - 0x0e)
9203 /* set vol=0 to output mixers */
9204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9206 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9208 /* set up input amps for analog loopback */
9209 /* Amp Indices: DAC = 0, mixer = 1 */
9210 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9211 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9212 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9213 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9214 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9215 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9218 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9219 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9220 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9221 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9222 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9223 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9224 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9226 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9227 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9229 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9230 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9232 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9233 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9234 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9235 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9236 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9237 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9239 /* FIXME: use matrix-type input source selection */
9240 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9241 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9247 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9250 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9251 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9252 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9253 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9254 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9255 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9256 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9263 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9266 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9271 #ifdef CONFIG_SND_HDA_POWER_SAVE
9272 #define alc262_loopbacks alc880_loopbacks
9275 /* pcm configuration: identiacal with ALC880 */
9276 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9277 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9278 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9279 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9282 * BIOS auto configuration
9284 static int alc262_parse_auto_config(struct hda_codec *codec)
9286 struct alc_spec *spec = codec->spec;
9288 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9290 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9294 if (!spec->autocfg.line_outs)
9295 return 0; /* can't find valid BIOS pin config */
9296 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9299 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9303 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9305 if (spec->autocfg.dig_out_pin)
9306 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9307 if (spec->autocfg.dig_in_pin)
9308 spec->dig_in_nid = ALC262_DIGIN_NID;
9310 if (spec->kctl_alloc)
9311 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9313 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9314 spec->num_mux_defs = 1;
9315 spec->input_mux = &spec->private_imux;
9317 err = alc_auto_add_mic_boost(codec);
9324 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9325 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9326 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9329 /* init callback for auto-configuration model -- overriding the default init */
9330 static void alc262_auto_init(struct hda_codec *codec)
9332 struct alc_spec *spec = codec->spec;
9333 alc262_auto_init_multi_out(codec);
9334 alc262_auto_init_hp_out(codec);
9335 alc262_auto_init_analog_input(codec);
9336 if (spec->unsol_event)
9337 alc_sku_automute(codec);
9341 * configuration and preset
9343 static const char *alc262_models[ALC262_MODEL_LAST] = {
9344 [ALC262_BASIC] = "basic",
9345 [ALC262_HIPPO] = "hippo",
9346 [ALC262_HIPPO_1] = "hippo_1",
9347 [ALC262_FUJITSU] = "fujitsu",
9348 [ALC262_HP_BPC] = "hp-bpc",
9349 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9350 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9351 [ALC262_HP_RP5700] = "hp-rp5700",
9352 [ALC262_BENQ_ED8] = "benq",
9353 [ALC262_BENQ_T31] = "benq-t31",
9354 [ALC262_SONY_ASSAMD] = "sony-assamd",
9355 [ALC262_ULTRA] = "ultra",
9356 [ALC262_LENOVO_3000] = "lenovo-3000",
9357 [ALC262_AUTO] = "auto",
9360 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9361 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9362 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9363 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9364 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9365 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9366 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9367 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9368 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9369 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9370 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9371 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9372 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9373 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9374 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9375 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9376 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9377 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9378 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9379 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9380 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9381 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9382 ALC262_HP_TC_T5735),
9383 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9384 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9385 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9386 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9387 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9388 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9389 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9390 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9391 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9392 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9393 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9394 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9395 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9396 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9400 static struct alc_config_preset alc262_presets[] = {
9402 .mixers = { alc262_base_mixer },
9403 .init_verbs = { alc262_init_verbs },
9404 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9405 .dac_nids = alc262_dac_nids,
9407 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9408 .channel_mode = alc262_modes,
9409 .input_mux = &alc262_capture_source,
9412 .mixers = { alc262_base_mixer },
9413 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9414 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9415 .dac_nids = alc262_dac_nids,
9417 .dig_out_nid = ALC262_DIGOUT_NID,
9418 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9419 .channel_mode = alc262_modes,
9420 .input_mux = &alc262_capture_source,
9421 .unsol_event = alc262_hippo_unsol_event,
9422 .init_hook = alc262_hippo_automute,
9424 [ALC262_HIPPO_1] = {
9425 .mixers = { alc262_hippo1_mixer },
9426 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9427 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9428 .dac_nids = alc262_dac_nids,
9430 .dig_out_nid = ALC262_DIGOUT_NID,
9431 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9432 .channel_mode = alc262_modes,
9433 .input_mux = &alc262_capture_source,
9434 .unsol_event = alc262_hippo1_unsol_event,
9435 .init_hook = alc262_hippo1_automute,
9437 [ALC262_FUJITSU] = {
9438 .mixers = { alc262_fujitsu_mixer },
9439 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9440 alc262_fujitsu_unsol_verbs },
9441 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9442 .dac_nids = alc262_dac_nids,
9444 .dig_out_nid = ALC262_DIGOUT_NID,
9445 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9446 .channel_mode = alc262_modes,
9447 .input_mux = &alc262_fujitsu_capture_source,
9448 .unsol_event = alc262_fujitsu_unsol_event,
9451 .mixers = { alc262_HP_BPC_mixer },
9452 .init_verbs = { alc262_HP_BPC_init_verbs },
9453 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9454 .dac_nids = alc262_dac_nids,
9456 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9457 .channel_mode = alc262_modes,
9458 .input_mux = &alc262_HP_capture_source,
9459 .unsol_event = alc262_hp_bpc_unsol_event,
9460 .init_hook = alc262_hp_bpc_automute,
9462 [ALC262_HP_BPC_D7000_WF] = {
9463 .mixers = { alc262_HP_BPC_WildWest_mixer },
9464 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9465 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9466 .dac_nids = alc262_dac_nids,
9468 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9469 .channel_mode = alc262_modes,
9470 .input_mux = &alc262_HP_D7000_capture_source,
9471 .unsol_event = alc262_hp_wildwest_unsol_event,
9472 .init_hook = alc262_hp_wildwest_automute,
9474 [ALC262_HP_BPC_D7000_WL] = {
9475 .mixers = { alc262_HP_BPC_WildWest_mixer,
9476 alc262_HP_BPC_WildWest_option_mixer },
9477 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9478 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9479 .dac_nids = alc262_dac_nids,
9481 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9482 .channel_mode = alc262_modes,
9483 .input_mux = &alc262_HP_D7000_capture_source,
9484 .unsol_event = alc262_hp_wildwest_unsol_event,
9485 .init_hook = alc262_hp_wildwest_automute,
9487 [ALC262_HP_TC_T5735] = {
9488 .mixers = { alc262_hp_t5735_mixer },
9489 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9490 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9491 .dac_nids = alc262_dac_nids,
9493 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9494 .channel_mode = alc262_modes,
9495 .input_mux = &alc262_capture_source,
9496 .unsol_event = alc262_hp_t5735_unsol_event,
9497 .init_hook = alc262_hp_t5735_init_hook,
9499 [ALC262_HP_RP5700] = {
9500 .mixers = { alc262_hp_rp5700_mixer },
9501 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9502 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9503 .dac_nids = alc262_dac_nids,
9504 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9505 .channel_mode = alc262_modes,
9506 .input_mux = &alc262_hp_rp5700_capture_source,
9508 [ALC262_BENQ_ED8] = {
9509 .mixers = { alc262_base_mixer },
9510 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9511 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9512 .dac_nids = alc262_dac_nids,
9514 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9515 .channel_mode = alc262_modes,
9516 .input_mux = &alc262_capture_source,
9518 [ALC262_SONY_ASSAMD] = {
9519 .mixers = { alc262_sony_mixer },
9520 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9521 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9522 .dac_nids = alc262_dac_nids,
9524 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9525 .channel_mode = alc262_modes,
9526 .input_mux = &alc262_capture_source,
9527 .unsol_event = alc262_hippo_unsol_event,
9528 .init_hook = alc262_hippo_automute,
9530 [ALC262_BENQ_T31] = {
9531 .mixers = { alc262_benq_t31_mixer },
9532 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9533 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9534 .dac_nids = alc262_dac_nids,
9536 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9537 .channel_mode = alc262_modes,
9538 .input_mux = &alc262_capture_source,
9539 .unsol_event = alc262_hippo_unsol_event,
9540 .init_hook = alc262_hippo_automute,
9543 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9544 .init_verbs = { alc262_ultra_verbs },
9545 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9546 .dac_nids = alc262_dac_nids,
9547 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9548 .channel_mode = alc262_modes,
9549 .input_mux = &alc262_ultra_capture_source,
9550 .adc_nids = alc262_adc_nids, /* ADC0 */
9551 .capsrc_nids = alc262_capsrc_nids,
9552 .num_adc_nids = 1, /* single ADC */
9553 .unsol_event = alc262_ultra_unsol_event,
9554 .init_hook = alc262_ultra_automute,
9556 [ALC262_LENOVO_3000] = {
9557 .mixers = { alc262_lenovo_3000_mixer },
9558 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9559 alc262_lenovo_3000_unsol_verbs },
9560 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9561 .dac_nids = alc262_dac_nids,
9563 .dig_out_nid = ALC262_DIGOUT_NID,
9564 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9565 .channel_mode = alc262_modes,
9566 .input_mux = &alc262_fujitsu_capture_source,
9567 .unsol_event = alc262_lenovo_3000_unsol_event,
9571 static int patch_alc262(struct hda_codec *codec)
9573 struct alc_spec *spec;
9577 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9583 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9588 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9589 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9590 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9591 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9595 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9599 if (board_config < 0) {
9600 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9601 "trying auto-probe from BIOS...\n");
9602 board_config = ALC262_AUTO;
9605 if (board_config == ALC262_AUTO) {
9606 /* automatic parse from the BIOS config */
9607 err = alc262_parse_auto_config(codec);
9613 "hda_codec: Cannot set up configuration "
9614 "from BIOS. Using base mode...\n");
9615 board_config = ALC262_BASIC;
9619 if (board_config != ALC262_AUTO)
9620 setup_preset(spec, &alc262_presets[board_config]);
9622 spec->stream_name_analog = "ALC262 Analog";
9623 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9624 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9626 spec->stream_name_digital = "ALC262 Digital";
9627 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9628 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9630 if (!spec->adc_nids && spec->input_mux) {
9631 /* check whether NID 0x07 is valid */
9632 unsigned int wcap = get_wcaps(codec, 0x07);
9635 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9636 if (wcap != AC_WID_AUD_IN) {
9637 spec->adc_nids = alc262_adc_nids_alt;
9638 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9639 spec->capsrc_nids = alc262_capsrc_nids_alt;
9640 spec->mixers[spec->num_mixers] =
9641 alc262_capture_alt_mixer;
9644 spec->adc_nids = alc262_adc_nids;
9645 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9646 spec->capsrc_nids = alc262_capsrc_nids;
9647 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9652 spec->vmaster_nid = 0x0c;
9654 codec->patch_ops = alc_patch_ops;
9655 if (board_config == ALC262_AUTO)
9656 spec->init_hook = alc262_auto_init;
9657 #ifdef CONFIG_SND_HDA_POWER_SAVE
9658 if (!spec->loopback.amplist)
9659 spec->loopback.amplist = alc262_loopbacks;
9666 * ALC268 channel source setting (2 channel)
9668 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9669 #define alc268_modes alc260_modes
9671 static hda_nid_t alc268_dac_nids[2] = {
9676 static hda_nid_t alc268_adc_nids[2] = {
9681 static hda_nid_t alc268_adc_nids_alt[1] = {
9686 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
9688 static struct snd_kcontrol_new alc268_base_mixer[] = {
9689 /* output mixer control */
9690 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9691 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9692 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9694 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9695 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9696 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9700 /* bind Beep switches of both NID 0x0f and 0x10 */
9701 static struct hda_bind_ctls alc268_bind_beep_sw = {
9702 .ops = &snd_hda_bind_sw,
9704 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9705 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9710 static struct snd_kcontrol_new alc268_beep_mixer[] = {
9711 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9712 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9716 static struct hda_verb alc268_eapd_verbs[] = {
9717 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9718 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9722 /* Toshiba specific */
9723 #define alc268_toshiba_automute alc262_hippo_automute
9725 static struct hda_verb alc268_toshiba_verbs[] = {
9726 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9731 /* bind volumes of both NID 0x02 and 0x03 */
9732 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9733 .ops = &snd_hda_bind_vol,
9735 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9736 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9741 /* mute/unmute internal speaker according to the hp jack and mute state */
9742 static void alc268_acer_automute(struct hda_codec *codec, int force)
9744 struct alc_spec *spec = codec->spec;
9747 if (force || !spec->sense_updated) {
9748 unsigned int present;
9749 present = snd_hda_codec_read(codec, 0x14, 0,
9750 AC_VERB_GET_PIN_SENSE, 0);
9751 spec->jack_present = (present & 0x80000000) != 0;
9752 spec->sense_updated = 1;
9754 if (spec->jack_present)
9755 mute = HDA_AMP_MUTE; /* mute internal speaker */
9756 else /* unmute internal speaker if necessary */
9757 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9758 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9759 HDA_AMP_MUTE, mute);
9763 /* bind hp and internal speaker mute (with plug check) */
9764 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9765 struct snd_ctl_elem_value *ucontrol)
9767 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9768 long *valp = ucontrol->value.integer.value;
9771 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9773 valp[0] ? 0 : HDA_AMP_MUTE);
9774 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9776 valp[1] ? 0 : HDA_AMP_MUTE);
9778 alc268_acer_automute(codec, 0);
9782 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9783 /* output mixer control */
9784 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9786 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9787 .name = "Master Playback Switch",
9788 .info = snd_hda_mixer_amp_switch_info,
9789 .get = snd_hda_mixer_amp_switch_get,
9790 .put = alc268_acer_master_sw_put,
9791 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9794 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9795 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9799 static struct hda_verb alc268_acer_verbs[] = {
9800 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
9801 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9804 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9805 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9807 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9811 /* unsolicited event for HP jack sensing */
9812 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9815 if ((res >> 26) != ALC880_HP_EVENT)
9817 alc268_toshiba_automute(codec);
9820 static void alc268_acer_unsol_event(struct hda_codec *codec,
9823 if ((res >> 26) != ALC880_HP_EVENT)
9825 alc268_acer_automute(codec, 1);
9828 static void alc268_acer_init_hook(struct hda_codec *codec)
9830 alc268_acer_automute(codec, 1);
9833 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9834 /* output mixer control */
9835 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9836 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9837 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9838 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9839 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9840 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9844 static struct hda_verb alc268_dell_verbs[] = {
9845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9847 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9851 /* mute/unmute internal speaker according to the hp jack and mute state */
9852 static void alc268_dell_automute(struct hda_codec *codec)
9854 unsigned int present;
9857 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
9858 if (present & 0x80000000)
9859 mute = HDA_AMP_MUTE;
9861 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9862 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9863 HDA_AMP_MUTE, mute);
9866 static void alc268_dell_unsol_event(struct hda_codec *codec,
9869 if ((res >> 26) != ALC880_HP_EVENT)
9871 alc268_dell_automute(codec);
9874 #define alc268_dell_init_hook alc268_dell_automute
9877 * generic initialization of ADC, input mixers and output mixers
9879 static struct hda_verb alc268_base_init_verbs[] = {
9880 /* Unmute DAC0-1 and set vol = 0 */
9881 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9882 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9883 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9884 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9885 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9886 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9889 * Set up output mixers (0x0c - 0x0e)
9891 /* set vol=0 to output mixers */
9892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9893 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9894 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9895 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9897 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9898 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9904 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9906 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9907 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9910 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9911 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9912 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9913 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9914 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9915 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9917 /* set PCBEEP vol = 0, mute connections */
9918 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9919 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9920 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9922 /* Unmute Selector 23h,24h and set the default input to mic-in */
9924 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
9925 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9926 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
9927 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9933 * generic initialization of ADC, input mixers and output mixers
9935 static struct hda_verb alc268_volume_init_verbs[] = {
9936 /* set output DAC */
9937 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9938 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9939 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9940 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9943 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9944 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9945 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9946 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9948 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9951 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9952 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9954 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9955 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9956 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9957 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9959 /* set PCBEEP vol = 0, mute connections */
9960 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9962 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9967 #define alc268_mux_enum_info alc_mux_enum_info
9968 #define alc268_mux_enum_get alc_mux_enum_get
9969 #define alc268_mux_enum_put alc_mux_enum_put
9971 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9972 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9973 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9975 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9976 /* The multiple "Capture Source" controls confuse alsamixer
9977 * So call somewhat different..
9979 /* .name = "Capture Source", */
9980 .name = "Input Source",
9982 .info = alc268_mux_enum_info,
9983 .get = alc268_mux_enum_get,
9984 .put = alc268_mux_enum_put,
9989 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9990 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9991 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9992 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9993 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9996 /* The multiple "Capture Source" controls confuse alsamixer
9997 * So call somewhat different..
9999 /* .name = "Capture Source", */
10000 .name = "Input Source",
10002 .info = alc268_mux_enum_info,
10003 .get = alc268_mux_enum_get,
10004 .put = alc268_mux_enum_put,
10009 static struct hda_input_mux alc268_capture_source = {
10013 { "Front Mic", 0x1 },
10019 static struct hda_input_mux alc268_acer_capture_source = {
10023 { "Internal Mic", 0x6 },
10028 #ifdef CONFIG_SND_DEBUG
10029 static struct snd_kcontrol_new alc268_test_mixer[] = {
10030 /* Volume widgets */
10031 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10032 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10033 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10034 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10035 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10036 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10037 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10038 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10039 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10040 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10041 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10042 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10043 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10044 /* The below appears problematic on some hardwares */
10045 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10046 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10047 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10048 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10049 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10051 /* Modes for retasking pin widgets */
10052 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10053 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10054 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10055 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10057 /* Controls for GPIO pins, assuming they are configured as outputs */
10058 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10059 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10060 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10061 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10063 /* Switches to allow the digital SPDIF output pin to be enabled.
10064 * The ALC268 does not have an SPDIF input.
10066 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10068 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10069 * this output to turn on an external amplifier.
10071 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10072 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10078 /* create input playback/capture controls for the given pin */
10079 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10080 const char *ctlname, int idx)
10085 sprintf(name, "%s Playback Volume", ctlname);
10087 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10088 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10092 } else if (nid == 0x15) {
10093 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10094 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10100 sprintf(name, "%s Playback Switch", ctlname);
10101 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10102 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10108 /* add playback controls from the parsed DAC table */
10109 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10110 const struct auto_pin_cfg *cfg)
10115 spec->multiout.num_dacs = 2; /* only use one dac */
10116 spec->multiout.dac_nids = spec->private_dac_nids;
10117 spec->multiout.dac_nids[0] = 2;
10118 spec->multiout.dac_nids[1] = 3;
10120 nid = cfg->line_out_pins[0];
10122 alc268_new_analog_output(spec, nid, "Front", 0);
10124 nid = cfg->speaker_pins[0];
10126 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10127 "Speaker Playback Volume",
10128 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10132 nid = cfg->hp_pins[0];
10134 alc268_new_analog_output(spec, nid, "Headphone", 0);
10136 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10138 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10139 "Mono Playback Switch",
10140 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10147 /* create playback/capture controls for input pins */
10148 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10149 const struct auto_pin_cfg *cfg)
10151 struct hda_input_mux *imux = &spec->private_imux;
10154 for (i = 0; i < AUTO_PIN_LAST; i++) {
10155 switch(cfg->input_pins[i]) {
10157 idx1 = 0; /* Mic 1 */
10160 idx1 = 1; /* Mic 2 */
10163 idx1 = 2; /* Line In */
10170 idx1 = 6; /* digital mics */
10175 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10176 imux->items[imux->num_items].index = idx1;
10182 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10184 struct alc_spec *spec = codec->spec;
10185 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10186 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10187 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10188 unsigned int dac_vol1, dac_vol2;
10191 snd_hda_codec_write(codec, speaker_nid, 0,
10192 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10193 snd_hda_codec_write(codec, 0x0f, 0,
10194 AC_VERB_SET_AMP_GAIN_MUTE,
10196 snd_hda_codec_write(codec, 0x10, 0,
10197 AC_VERB_SET_AMP_GAIN_MUTE,
10200 snd_hda_codec_write(codec, 0x0f, 0,
10201 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10202 snd_hda_codec_write(codec, 0x10, 0,
10203 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10206 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10207 if (line_nid == 0x14)
10208 dac_vol2 = AMP_OUT_ZERO;
10209 else if (line_nid == 0x15)
10210 dac_vol1 = AMP_OUT_ZERO;
10211 if (hp_nid == 0x14)
10212 dac_vol2 = AMP_OUT_ZERO;
10213 else if (hp_nid == 0x15)
10214 dac_vol1 = AMP_OUT_ZERO;
10215 if (line_nid != 0x16 || hp_nid != 0x16 ||
10216 spec->autocfg.line_out_pins[1] != 0x16 ||
10217 spec->autocfg.line_out_pins[2] != 0x16)
10218 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10220 snd_hda_codec_write(codec, 0x02, 0,
10221 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10222 snd_hda_codec_write(codec, 0x03, 0,
10223 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10226 /* pcm configuration: identiacal with ALC880 */
10227 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10228 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10229 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10230 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10233 * BIOS auto configuration
10235 static int alc268_parse_auto_config(struct hda_codec *codec)
10237 struct alc_spec *spec = codec->spec;
10239 static hda_nid_t alc268_ignore[] = { 0 };
10241 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10245 if (!spec->autocfg.line_outs)
10246 return 0; /* can't find valid BIOS pin config */
10248 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10251 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10255 spec->multiout.max_channels = 2;
10257 /* digital only support output */
10258 if (spec->autocfg.dig_out_pin)
10259 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10261 if (spec->kctl_alloc)
10262 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10264 if (spec->autocfg.speaker_pins[0] != 0x1d)
10265 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10267 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10268 spec->num_mux_defs = 1;
10269 spec->input_mux = &spec->private_imux;
10271 err = alc_auto_add_mic_boost(codec);
10278 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10279 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10280 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10282 /* init callback for auto-configuration model -- overriding the default init */
10283 static void alc268_auto_init(struct hda_codec *codec)
10285 struct alc_spec *spec = codec->spec;
10286 alc268_auto_init_multi_out(codec);
10287 alc268_auto_init_hp_out(codec);
10288 alc268_auto_init_mono_speaker_out(codec);
10289 alc268_auto_init_analog_input(codec);
10290 if (spec->unsol_event)
10291 alc_sku_automute(codec);
10295 * configuration and preset
10297 static const char *alc268_models[ALC268_MODEL_LAST] = {
10298 [ALC268_3ST] = "3stack",
10299 [ALC268_TOSHIBA] = "toshiba",
10300 [ALC268_ACER] = "acer",
10301 [ALC268_DELL] = "dell",
10302 [ALC268_ZEPTO] = "zepto",
10303 #ifdef CONFIG_SND_DEBUG
10304 [ALC268_TEST] = "test",
10306 [ALC268_AUTO] = "auto",
10309 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10310 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10311 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10312 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10313 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10314 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10315 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10316 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10317 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10318 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10319 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10320 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10324 static struct alc_config_preset alc268_presets[] = {
10326 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10327 alc268_beep_mixer },
10328 .init_verbs = { alc268_base_init_verbs },
10329 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10330 .dac_nids = alc268_dac_nids,
10331 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10332 .adc_nids = alc268_adc_nids_alt,
10333 .capsrc_nids = alc268_capsrc_nids,
10335 .dig_out_nid = ALC268_DIGOUT_NID,
10336 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10337 .channel_mode = alc268_modes,
10338 .input_mux = &alc268_capture_source,
10340 [ALC268_TOSHIBA] = {
10341 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10342 alc268_beep_mixer },
10343 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10344 alc268_toshiba_verbs },
10345 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10346 .dac_nids = alc268_dac_nids,
10347 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10348 .adc_nids = alc268_adc_nids_alt,
10349 .capsrc_nids = alc268_capsrc_nids,
10351 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10352 .channel_mode = alc268_modes,
10353 .input_mux = &alc268_capture_source,
10354 .unsol_event = alc268_toshiba_unsol_event,
10355 .init_hook = alc268_toshiba_automute,
10358 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10359 alc268_beep_mixer },
10360 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10361 alc268_acer_verbs },
10362 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10363 .dac_nids = alc268_dac_nids,
10364 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10365 .adc_nids = alc268_adc_nids_alt,
10366 .capsrc_nids = alc268_capsrc_nids,
10368 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10369 .channel_mode = alc268_modes,
10370 .input_mux = &alc268_acer_capture_source,
10371 .unsol_event = alc268_acer_unsol_event,
10372 .init_hook = alc268_acer_init_hook,
10375 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10376 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10377 alc268_dell_verbs },
10378 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10379 .dac_nids = alc268_dac_nids,
10381 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10382 .channel_mode = alc268_modes,
10383 .unsol_event = alc268_dell_unsol_event,
10384 .init_hook = alc268_dell_init_hook,
10385 .input_mux = &alc268_capture_source,
10388 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10389 alc268_beep_mixer },
10390 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10391 alc268_toshiba_verbs },
10392 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10393 .dac_nids = alc268_dac_nids,
10394 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10395 .adc_nids = alc268_adc_nids_alt,
10396 .capsrc_nids = alc268_capsrc_nids,
10398 .dig_out_nid = ALC268_DIGOUT_NID,
10399 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10400 .channel_mode = alc268_modes,
10401 .input_mux = &alc268_capture_source,
10402 .unsol_event = alc268_toshiba_unsol_event,
10403 .init_hook = alc268_toshiba_automute
10405 #ifdef CONFIG_SND_DEBUG
10407 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10408 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10409 alc268_volume_init_verbs },
10410 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10411 .dac_nids = alc268_dac_nids,
10412 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10413 .adc_nids = alc268_adc_nids_alt,
10414 .capsrc_nids = alc268_capsrc_nids,
10416 .dig_out_nid = ALC268_DIGOUT_NID,
10417 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10418 .channel_mode = alc268_modes,
10419 .input_mux = &alc268_capture_source,
10424 static int patch_alc268(struct hda_codec *codec)
10426 struct alc_spec *spec;
10430 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10434 codec->spec = spec;
10436 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10440 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10441 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10442 "trying auto-probe from BIOS...\n");
10443 board_config = ALC268_AUTO;
10446 if (board_config == ALC268_AUTO) {
10447 /* automatic parse from the BIOS config */
10448 err = alc268_parse_auto_config(codec);
10454 "hda_codec: Cannot set up configuration "
10455 "from BIOS. Using base mode...\n");
10456 board_config = ALC268_3ST;
10460 if (board_config != ALC268_AUTO)
10461 setup_preset(spec, &alc268_presets[board_config]);
10463 spec->stream_name_analog = "ALC268 Analog";
10464 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10465 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10466 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10468 spec->stream_name_digital = "ALC268 Digital";
10469 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10471 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10472 /* override the amp caps for beep generator */
10473 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10474 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10475 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10476 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10477 (0 << AC_AMPCAP_MUTE_SHIFT));
10479 if (!spec->adc_nids && spec->input_mux) {
10480 /* check whether NID 0x07 is valid */
10481 unsigned int wcap = get_wcaps(codec, 0x07);
10485 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10486 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10487 spec->adc_nids = alc268_adc_nids_alt;
10488 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10489 spec->mixers[spec->num_mixers] =
10490 alc268_capture_alt_mixer;
10491 spec->num_mixers++;
10493 spec->adc_nids = alc268_adc_nids;
10494 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10495 spec->mixers[spec->num_mixers] =
10496 alc268_capture_mixer;
10497 spec->num_mixers++;
10499 spec->capsrc_nids = alc268_capsrc_nids;
10500 /* set default input source */
10501 for (i = 0; i < spec->num_adc_nids; i++)
10502 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10503 0, AC_VERB_SET_CONNECT_SEL,
10504 spec->input_mux->items[0].index);
10507 spec->vmaster_nid = 0x02;
10509 codec->patch_ops = alc_patch_ops;
10510 if (board_config == ALC268_AUTO)
10511 spec->init_hook = alc268_auto_init;
10517 * ALC269 channel source setting (2 channel)
10519 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10521 #define alc269_dac_nids alc260_dac_nids
10523 static hda_nid_t alc269_adc_nids[1] = {
10528 #define alc269_modes alc260_modes
10529 #define alc269_capture_source alc880_lg_lw_capture_source
10531 static struct snd_kcontrol_new alc269_base_mixer[] = {
10532 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10533 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10534 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10535 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10538 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10539 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10540 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10543 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10547 /* capture mixer elements */
10548 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10549 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10550 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10552 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10553 /* The multiple "Capture Source" controls confuse alsamixer
10554 * So call somewhat different..
10556 /* .name = "Capture Source", */
10557 .name = "Input Source",
10559 .info = alc_mux_enum_info,
10560 .get = alc_mux_enum_get,
10561 .put = alc_mux_enum_put,
10567 * generic initialization of ADC, input mixers and output mixers
10569 static struct hda_verb alc269_init_verbs[] = {
10571 * Unmute ADC0 and set the default input to mic-in
10573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10575 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10576 * analog-loopback mixer widget
10577 * Note: PASD motherboards uses the Line In 2 as the input for
10578 * front panel mic (mic 2)
10580 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10588 * Set up output mixers (0x0c - 0x0e)
10590 /* set vol=0 to output mixers */
10591 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10592 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10594 /* set up input amps for analog loopback */
10595 /* Amp Indices: DAC = 0, mixer = 1 */
10596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10598 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10601 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10605 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10606 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10608 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10613 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10614 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10615 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10616 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10617 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10619 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10620 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10622 /* FIXME: use matrix-type input source selection */
10623 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10624 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10625 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10626 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10627 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10628 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10631 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10632 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10636 /* add playback controls from the parsed DAC table */
10637 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10638 const struct auto_pin_cfg *cfg)
10643 spec->multiout.num_dacs = 1; /* only use one dac */
10644 spec->multiout.dac_nids = spec->private_dac_nids;
10645 spec->multiout.dac_nids[0] = 2;
10647 nid = cfg->line_out_pins[0];
10649 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10650 "Front Playback Volume",
10651 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10654 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10655 "Front Playback Switch",
10656 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10661 nid = cfg->speaker_pins[0];
10663 if (!cfg->line_out_pins[0]) {
10664 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10665 "Speaker Playback Volume",
10666 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10672 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10673 "Speaker Playback Switch",
10674 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10679 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10680 "Speaker Playback Switch",
10681 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10687 nid = cfg->hp_pins[0];
10689 /* spec->multiout.hp_nid = 2; */
10690 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10691 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10692 "Headphone Playback Volume",
10693 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10699 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10700 "Headphone Playback Switch",
10701 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10706 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10707 "Headphone Playback Switch",
10708 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10717 #define alc269_auto_create_analog_input_ctls \
10718 alc880_auto_create_analog_input_ctls
10720 #ifdef CONFIG_SND_HDA_POWER_SAVE
10721 #define alc269_loopbacks alc880_loopbacks
10724 /* pcm configuration: identiacal with ALC880 */
10725 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10726 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10727 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10728 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10731 * BIOS auto configuration
10733 static int alc269_parse_auto_config(struct hda_codec *codec)
10735 struct alc_spec *spec = codec->spec;
10737 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10739 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10744 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10747 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10751 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10753 if (spec->autocfg.dig_out_pin)
10754 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10756 if (spec->kctl_alloc)
10757 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10759 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10760 spec->num_mux_defs = 1;
10761 spec->input_mux = &spec->private_imux;
10763 err = alc_auto_add_mic_boost(codec);
10770 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10771 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10772 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10775 /* init callback for auto-configuration model -- overriding the default init */
10776 static void alc269_auto_init(struct hda_codec *codec)
10778 struct alc_spec *spec = codec->spec;
10779 alc269_auto_init_multi_out(codec);
10780 alc269_auto_init_hp_out(codec);
10781 alc269_auto_init_analog_input(codec);
10782 if (spec->unsol_event)
10783 alc_sku_automute(codec);
10787 * configuration and preset
10789 static const char *alc269_models[ALC269_MODEL_LAST] = {
10790 [ALC269_BASIC] = "basic",
10793 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10797 static struct alc_config_preset alc269_presets[] = {
10799 .mixers = { alc269_base_mixer },
10800 .init_verbs = { alc269_init_verbs },
10801 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10802 .dac_nids = alc269_dac_nids,
10804 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10805 .channel_mode = alc269_modes,
10806 .input_mux = &alc269_capture_source,
10810 static int patch_alc269(struct hda_codec *codec)
10812 struct alc_spec *spec;
10816 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10820 codec->spec = spec;
10822 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10826 if (board_config < 0) {
10827 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10828 "trying auto-probe from BIOS...\n");
10829 board_config = ALC269_AUTO;
10832 if (board_config == ALC269_AUTO) {
10833 /* automatic parse from the BIOS config */
10834 err = alc269_parse_auto_config(codec);
10840 "hda_codec: Cannot set up configuration "
10841 "from BIOS. Using base mode...\n");
10842 board_config = ALC269_BASIC;
10846 if (board_config != ALC269_AUTO)
10847 setup_preset(spec, &alc269_presets[board_config]);
10849 spec->stream_name_analog = "ALC269 Analog";
10850 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10851 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10853 spec->stream_name_digital = "ALC269 Digital";
10854 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10855 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10857 spec->adc_nids = alc269_adc_nids;
10858 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10859 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10860 spec->num_mixers++;
10862 codec->patch_ops = alc_patch_ops;
10863 if (board_config == ALC269_AUTO)
10864 spec->init_hook = alc269_auto_init;
10865 #ifdef CONFIG_SND_HDA_POWER_SAVE
10866 if (!spec->loopback.amplist)
10867 spec->loopback.amplist = alc269_loopbacks;
10874 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10878 * set the path ways for 2 channel output
10879 * need to set the codec line out and mic 1 pin widgets to inputs
10881 static struct hda_verb alc861_threestack_ch2_init[] = {
10882 /* set pin widget 1Ah (line in) for input */
10883 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10884 /* set pin widget 18h (mic1/2) for input, for mic also enable
10887 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10889 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10891 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10892 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10898 * need to set the codec line out and mic 1 pin widgets to outputs
10900 static struct hda_verb alc861_threestack_ch6_init[] = {
10901 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10902 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10903 /* set pin widget 18h (mic1) for output (CLFE)*/
10904 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10906 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10907 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10909 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10911 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10912 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10917 static struct hda_channel_mode alc861_threestack_modes[2] = {
10918 { 2, alc861_threestack_ch2_init },
10919 { 6, alc861_threestack_ch6_init },
10921 /* Set mic1 as input and unmute the mixer */
10922 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10923 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10924 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10927 /* Set mic1 as output and mute mixer */
10928 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10929 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10930 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10934 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10935 { 2, alc861_uniwill_m31_ch2_init },
10936 { 4, alc861_uniwill_m31_ch4_init },
10939 /* Set mic1 and line-in as input and unmute the mixer */
10940 static struct hda_verb alc861_asus_ch2_init[] = {
10941 /* set pin widget 1Ah (line in) for input */
10942 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10943 /* set pin widget 18h (mic1/2) for input, for mic also enable
10946 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10948 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10950 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10951 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10955 /* Set mic1 nad line-in as output and mute mixer */
10956 static struct hda_verb alc861_asus_ch6_init[] = {
10957 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10958 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10959 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10960 /* set pin widget 18h (mic1) for output (CLFE)*/
10961 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10962 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10963 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10964 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10966 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10968 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10969 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10974 static struct hda_channel_mode alc861_asus_modes[2] = {
10975 { 2, alc861_asus_ch2_init },
10976 { 6, alc861_asus_ch6_init },
10981 static struct snd_kcontrol_new alc861_base_mixer[] = {
10982 /* output mixer control */
10983 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10984 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10985 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10986 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10987 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10989 /*Input mixer control */
10990 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10991 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10992 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10993 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10994 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10995 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10997 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10998 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11001 /* Capture mixer control */
11002 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11003 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11005 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11006 .name = "Capture Source",
11008 .info = alc_mux_enum_info,
11009 .get = alc_mux_enum_get,
11010 .put = alc_mux_enum_put,
11015 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11016 /* output mixer control */
11017 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11018 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11019 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11020 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11021 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11023 /* Input mixer control */
11024 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11025 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11026 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11027 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11028 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11029 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11031 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11035 /* Capture mixer control */
11036 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11037 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11039 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11040 .name = "Capture Source",
11042 .info = alc_mux_enum_info,
11043 .get = alc_mux_enum_get,
11044 .put = alc_mux_enum_put,
11047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11048 .name = "Channel Mode",
11049 .info = alc_ch_mode_info,
11050 .get = alc_ch_mode_get,
11051 .put = alc_ch_mode_put,
11052 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11057 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11058 /* output mixer control */
11059 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11061 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11063 /*Capture mixer control */
11064 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11065 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11067 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11068 .name = "Capture Source",
11070 .info = alc_mux_enum_info,
11071 .get = alc_mux_enum_get,
11072 .put = alc_mux_enum_put,
11078 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11079 /* output mixer control */
11080 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11081 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11082 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11083 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11084 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11086 /* Input mixer control */
11087 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11088 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11089 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11090 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11091 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11092 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11094 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11095 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11098 /* Capture mixer control */
11099 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11100 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11102 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11103 .name = "Capture Source",
11105 .info = alc_mux_enum_info,
11106 .get = alc_mux_enum_get,
11107 .put = alc_mux_enum_put,
11110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11111 .name = "Channel Mode",
11112 .info = alc_ch_mode_info,
11113 .get = alc_ch_mode_get,
11114 .put = alc_ch_mode_put,
11115 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11120 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11121 /* output mixer control */
11122 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11123 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11124 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11125 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11126 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11128 /* Input mixer control */
11129 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11130 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11131 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11132 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11133 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11134 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11136 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11137 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11140 /* Capture mixer control */
11141 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11142 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11144 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11145 .name = "Capture Source",
11147 .info = alc_mux_enum_info,
11148 .get = alc_mux_enum_get,
11149 .put = alc_mux_enum_put,
11152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11153 .name = "Channel Mode",
11154 .info = alc_ch_mode_info,
11155 .get = alc_ch_mode_get,
11156 .put = alc_ch_mode_put,
11157 .private_value = ARRAY_SIZE(alc861_asus_modes),
11162 /* additional mixer */
11163 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11164 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11165 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11166 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11167 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11172 * generic initialization of ADC, input mixers and output mixers
11174 static struct hda_verb alc861_base_init_verbs[] = {
11176 * Unmute ADC0 and set the default input to mic-in
11178 /* port-A for surround (rear panel) */
11179 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11180 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11181 /* port-B for mic-in (rear panel) with vref */
11182 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11183 /* port-C for line-in (rear panel) */
11184 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11185 /* port-D for Front */
11186 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11187 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11188 /* port-E for HP out (front panel) */
11189 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11190 /* route front PCM to HP */
11191 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11192 /* port-F for mic-in (front panel) with vref */
11193 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11194 /* port-G for CLFE (rear panel) */
11195 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11196 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11197 /* port-H for side (rear panel) */
11198 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11199 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11201 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11202 /* route front mic to ADC1*/
11203 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11206 /* Unmute DAC0~3 & spdif out*/
11207 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11208 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11209 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11210 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11211 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11213 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11214 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11215 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11216 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11217 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11219 /* Unmute Stereo Mixer 15 */
11220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11225 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11226 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11227 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11228 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11229 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11230 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11232 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11233 /* hp used DAC 3 (Front) */
11234 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11235 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11240 static struct hda_verb alc861_threestack_init_verbs[] = {
11242 * Unmute ADC0 and set the default input to mic-in
11244 /* port-A for surround (rear panel) */
11245 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11246 /* port-B for mic-in (rear panel) with vref */
11247 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11248 /* port-C for line-in (rear panel) */
11249 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11250 /* port-D for Front */
11251 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11252 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11253 /* port-E for HP out (front panel) */
11254 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11255 /* route front PCM to HP */
11256 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11257 /* port-F for mic-in (front panel) with vref */
11258 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11259 /* port-G for CLFE (rear panel) */
11260 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11261 /* port-H for side (rear panel) */
11262 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11264 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11265 /* route front mic to ADC1*/
11266 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11268 /* Unmute DAC0~3 & spdif out*/
11269 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11270 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11271 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11272 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11275 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11276 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11277 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11278 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11279 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11281 /* Unmute Stereo Mixer 15 */
11282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11287 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11288 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11289 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11290 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11293 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11295 /* hp used DAC 3 (Front) */
11296 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11301 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11303 * Unmute ADC0 and set the default input to mic-in
11305 /* port-A for surround (rear panel) */
11306 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11307 /* port-B for mic-in (rear panel) with vref */
11308 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11309 /* port-C for line-in (rear panel) */
11310 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11311 /* port-D for Front */
11312 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11313 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11314 /* port-E for HP out (front panel) */
11315 /* this has to be set to VREF80 */
11316 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11317 /* route front PCM to HP */
11318 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11319 /* port-F for mic-in (front panel) with vref */
11320 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11321 /* port-G for CLFE (rear panel) */
11322 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11323 /* port-H for side (rear panel) */
11324 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11326 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11327 /* route front mic to ADC1*/
11328 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11330 /* Unmute DAC0~3 & spdif out*/
11331 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11332 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11333 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11334 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11337 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11338 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11339 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11340 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11341 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11343 /* Unmute Stereo Mixer 15 */
11344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11346 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11349 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11350 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11351 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11352 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11353 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11354 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11355 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11357 /* hp used DAC 3 (Front) */
11358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11363 static struct hda_verb alc861_asus_init_verbs[] = {
11365 * Unmute ADC0 and set the default input to mic-in
11367 /* port-A for surround (rear panel)
11368 * according to codec#0 this is the HP jack
11370 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11371 /* route front PCM to HP */
11372 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11373 /* port-B for mic-in (rear panel) with vref */
11374 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11375 /* port-C for line-in (rear panel) */
11376 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11377 /* port-D for Front */
11378 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11379 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11380 /* port-E for HP out (front panel) */
11381 /* this has to be set to VREF80 */
11382 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11383 /* route front PCM to HP */
11384 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11385 /* port-F for mic-in (front panel) with vref */
11386 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11387 /* port-G for CLFE (rear panel) */
11388 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11389 /* port-H for side (rear panel) */
11390 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11392 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11393 /* route front mic to ADC1*/
11394 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11396 /* Unmute DAC0~3 & spdif out*/
11397 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11398 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11399 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11400 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11402 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11403 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11404 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11405 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11408 /* Unmute Stereo Mixer 15 */
11409 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11410 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11411 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11412 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11414 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11415 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11416 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11417 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11418 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11419 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11420 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11422 /* hp used DAC 3 (Front) */
11423 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11424 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11428 /* additional init verbs for ASUS laptops */
11429 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11430 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11431 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11436 * generic initialization of ADC, input mixers and output mixers
11438 static struct hda_verb alc861_auto_init_verbs[] = {
11440 * Unmute ADC0 and set the default input to mic-in
11442 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11445 /* Unmute DAC0~3 & spdif out*/
11446 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11447 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11448 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11449 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11450 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11452 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11453 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11454 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11455 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11456 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11458 /* Unmute Stereo Mixer 15 */
11459 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11460 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11461 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11462 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11464 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11465 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11466 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11467 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11468 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11469 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11470 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11471 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11474 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11475 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11476 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11477 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11478 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11480 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11482 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11487 static struct hda_verb alc861_toshiba_init_verbs[] = {
11488 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11493 /* toggle speaker-output according to the hp-jack state */
11494 static void alc861_toshiba_automute(struct hda_codec *codec)
11496 unsigned int present;
11498 present = snd_hda_codec_read(codec, 0x0f, 0,
11499 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11500 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11501 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11502 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11503 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11506 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11509 if ((res >> 26) == ALC880_HP_EVENT)
11510 alc861_toshiba_automute(codec);
11513 /* pcm configuration: identiacal with ALC880 */
11514 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11515 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11516 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11517 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11520 #define ALC861_DIGOUT_NID 0x07
11522 static struct hda_channel_mode alc861_8ch_modes[1] = {
11526 static hda_nid_t alc861_dac_nids[4] = {
11527 /* front, surround, clfe, side */
11528 0x03, 0x06, 0x05, 0x04
11531 static hda_nid_t alc660_dac_nids[3] = {
11532 /* front, clfe, surround */
11536 static hda_nid_t alc861_adc_nids[1] = {
11541 static struct hda_input_mux alc861_capture_source = {
11545 { "Front Mic", 0x3 },
11552 /* fill in the dac_nids table from the parsed pin configuration */
11553 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11554 const struct auto_pin_cfg *cfg)
11559 spec->multiout.dac_nids = spec->private_dac_nids;
11560 for (i = 0; i < cfg->line_outs; i++) {
11561 nid = cfg->line_out_pins[i];
11563 if (i >= ARRAY_SIZE(alc861_dac_nids))
11565 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11568 spec->multiout.num_dacs = cfg->line_outs;
11572 /* add playback controls from the parsed DAC table */
11573 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11574 const struct auto_pin_cfg *cfg)
11577 static const char *chname[4] = {
11578 "Front", "Surround", NULL /*CLFE*/, "Side"
11583 for (i = 0; i < cfg->line_outs; i++) {
11584 nid = spec->multiout.dac_nids[i];
11589 err = add_control(spec, ALC_CTL_BIND_MUTE,
11590 "Center Playback Switch",
11591 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11595 err = add_control(spec, ALC_CTL_BIND_MUTE,
11596 "LFE Playback Switch",
11597 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11602 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11604 if (nid == alc861_dac_nids[idx])
11606 sprintf(name, "%s Playback Switch", chname[idx]);
11607 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11608 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11617 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11625 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11627 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11628 "Headphone Playback Switch",
11629 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11632 spec->multiout.hp_nid = nid;
11637 /* create playback/capture controls for input pins */
11638 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11639 const struct auto_pin_cfg *cfg)
11641 struct hda_input_mux *imux = &spec->private_imux;
11642 int i, err, idx, idx1;
11644 for (i = 0; i < AUTO_PIN_LAST; i++) {
11645 switch (cfg->input_pins[i]) {
11648 idx = 2; /* Line In */
11652 idx = 2; /* Line In */
11656 idx = 1; /* Mic In */
11660 idx = 1; /* Mic In */
11670 err = new_analog_input(spec, cfg->input_pins[i],
11671 auto_pin_cfg_labels[i], idx, 0x15);
11675 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11676 imux->items[imux->num_items].index = idx1;
11682 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11683 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11684 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11687 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11688 /* The multiple "Capture Source" controls confuse alsamixer
11689 * So call somewhat different..
11691 /* .name = "Capture Source", */
11692 .name = "Input Source",
11694 .info = alc_mux_enum_info,
11695 .get = alc_mux_enum_get,
11696 .put = alc_mux_enum_put,
11701 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11703 int pin_type, int dac_idx)
11705 alc_set_pin_output(codec, nid, pin_type);
11708 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11710 struct alc_spec *spec = codec->spec;
11713 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11714 for (i = 0; i < spec->autocfg.line_outs; i++) {
11715 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11716 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11718 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11719 spec->multiout.dac_nids[i]);
11723 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11725 struct alc_spec *spec = codec->spec;
11728 pin = spec->autocfg.hp_pins[0];
11729 if (pin) /* connect to front */
11730 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11731 spec->multiout.dac_nids[0]);
11732 pin = spec->autocfg.speaker_pins[0];
11734 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11737 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11739 struct alc_spec *spec = codec->spec;
11742 for (i = 0; i < AUTO_PIN_LAST; i++) {
11743 hda_nid_t nid = spec->autocfg.input_pins[i];
11744 if (nid >= 0x0c && nid <= 0x11) {
11745 snd_hda_codec_write(codec, nid, 0,
11746 AC_VERB_SET_PIN_WIDGET_CONTROL,
11747 i <= AUTO_PIN_FRONT_MIC ?
11748 PIN_VREF80 : PIN_IN);
11753 /* parse the BIOS configuration and set up the alc_spec */
11754 /* return 1 if successful, 0 if the proper config is not found,
11755 * or a negative error code
11757 static int alc861_parse_auto_config(struct hda_codec *codec)
11759 struct alc_spec *spec = codec->spec;
11761 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11763 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11767 if (!spec->autocfg.line_outs)
11768 return 0; /* can't find valid BIOS pin config */
11770 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11773 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11776 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11779 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11783 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11785 if (spec->autocfg.dig_out_pin)
11786 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11788 if (spec->kctl_alloc)
11789 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11791 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11793 spec->num_mux_defs = 1;
11794 spec->input_mux = &spec->private_imux;
11796 spec->adc_nids = alc861_adc_nids;
11797 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11798 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11799 spec->num_mixers++;
11804 /* additional initialization for auto-configuration model */
11805 static void alc861_auto_init(struct hda_codec *codec)
11807 struct alc_spec *spec = codec->spec;
11808 alc861_auto_init_multi_out(codec);
11809 alc861_auto_init_hp_out(codec);
11810 alc861_auto_init_analog_input(codec);
11811 if (spec->unsol_event)
11812 alc_sku_automute(codec);
11815 #ifdef CONFIG_SND_HDA_POWER_SAVE
11816 static struct hda_amp_list alc861_loopbacks[] = {
11817 { 0x15, HDA_INPUT, 0 },
11818 { 0x15, HDA_INPUT, 1 },
11819 { 0x15, HDA_INPUT, 2 },
11820 { 0x15, HDA_INPUT, 3 },
11827 * configuration and preset
11829 static const char *alc861_models[ALC861_MODEL_LAST] = {
11830 [ALC861_3ST] = "3stack",
11831 [ALC660_3ST] = "3stack-660",
11832 [ALC861_3ST_DIG] = "3stack-dig",
11833 [ALC861_6ST_DIG] = "6stack-dig",
11834 [ALC861_UNIWILL_M31] = "uniwill-m31",
11835 [ALC861_TOSHIBA] = "toshiba",
11836 [ALC861_ASUS] = "asus",
11837 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11838 [ALC861_AUTO] = "auto",
11841 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11842 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11843 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11844 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11845 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11846 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11847 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11848 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11849 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11850 * Any other models that need this preset?
11852 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11853 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11854 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11855 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11856 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11857 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11858 /* FIXME: the below seems conflict */
11859 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11860 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11861 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11865 static struct alc_config_preset alc861_presets[] = {
11867 .mixers = { alc861_3ST_mixer },
11868 .init_verbs = { alc861_threestack_init_verbs },
11869 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11870 .dac_nids = alc861_dac_nids,
11871 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11872 .channel_mode = alc861_threestack_modes,
11874 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11875 .adc_nids = alc861_adc_nids,
11876 .input_mux = &alc861_capture_source,
11878 [ALC861_3ST_DIG] = {
11879 .mixers = { alc861_base_mixer },
11880 .init_verbs = { alc861_threestack_init_verbs },
11881 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11882 .dac_nids = alc861_dac_nids,
11883 .dig_out_nid = ALC861_DIGOUT_NID,
11884 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11885 .channel_mode = alc861_threestack_modes,
11887 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11888 .adc_nids = alc861_adc_nids,
11889 .input_mux = &alc861_capture_source,
11891 [ALC861_6ST_DIG] = {
11892 .mixers = { alc861_base_mixer },
11893 .init_verbs = { alc861_base_init_verbs },
11894 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11895 .dac_nids = alc861_dac_nids,
11896 .dig_out_nid = ALC861_DIGOUT_NID,
11897 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11898 .channel_mode = alc861_8ch_modes,
11899 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11900 .adc_nids = alc861_adc_nids,
11901 .input_mux = &alc861_capture_source,
11904 .mixers = { alc861_3ST_mixer },
11905 .init_verbs = { alc861_threestack_init_verbs },
11906 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11907 .dac_nids = alc660_dac_nids,
11908 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11909 .channel_mode = alc861_threestack_modes,
11911 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11912 .adc_nids = alc861_adc_nids,
11913 .input_mux = &alc861_capture_source,
11915 [ALC861_UNIWILL_M31] = {
11916 .mixers = { alc861_uniwill_m31_mixer },
11917 .init_verbs = { alc861_uniwill_m31_init_verbs },
11918 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11919 .dac_nids = alc861_dac_nids,
11920 .dig_out_nid = ALC861_DIGOUT_NID,
11921 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11922 .channel_mode = alc861_uniwill_m31_modes,
11924 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11925 .adc_nids = alc861_adc_nids,
11926 .input_mux = &alc861_capture_source,
11928 [ALC861_TOSHIBA] = {
11929 .mixers = { alc861_toshiba_mixer },
11930 .init_verbs = { alc861_base_init_verbs,
11931 alc861_toshiba_init_verbs },
11932 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11933 .dac_nids = alc861_dac_nids,
11934 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11935 .channel_mode = alc883_3ST_2ch_modes,
11936 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11937 .adc_nids = alc861_adc_nids,
11938 .input_mux = &alc861_capture_source,
11939 .unsol_event = alc861_toshiba_unsol_event,
11940 .init_hook = alc861_toshiba_automute,
11943 .mixers = { alc861_asus_mixer },
11944 .init_verbs = { alc861_asus_init_verbs },
11945 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11946 .dac_nids = alc861_dac_nids,
11947 .dig_out_nid = ALC861_DIGOUT_NID,
11948 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11949 .channel_mode = alc861_asus_modes,
11952 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11953 .adc_nids = alc861_adc_nids,
11954 .input_mux = &alc861_capture_source,
11956 [ALC861_ASUS_LAPTOP] = {
11957 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11958 .init_verbs = { alc861_asus_init_verbs,
11959 alc861_asus_laptop_init_verbs },
11960 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11961 .dac_nids = alc861_dac_nids,
11962 .dig_out_nid = ALC861_DIGOUT_NID,
11963 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11964 .channel_mode = alc883_3ST_2ch_modes,
11966 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11967 .adc_nids = alc861_adc_nids,
11968 .input_mux = &alc861_capture_source,
11973 static int patch_alc861(struct hda_codec *codec)
11975 struct alc_spec *spec;
11979 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11983 codec->spec = spec;
11985 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11989 if (board_config < 0) {
11990 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11991 "trying auto-probe from BIOS...\n");
11992 board_config = ALC861_AUTO;
11995 if (board_config == ALC861_AUTO) {
11996 /* automatic parse from the BIOS config */
11997 err = alc861_parse_auto_config(codec);
12003 "hda_codec: Cannot set up configuration "
12004 "from BIOS. Using base mode...\n");
12005 board_config = ALC861_3ST_DIG;
12009 if (board_config != ALC861_AUTO)
12010 setup_preset(spec, &alc861_presets[board_config]);
12012 spec->stream_name_analog = "ALC861 Analog";
12013 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12014 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12016 spec->stream_name_digital = "ALC861 Digital";
12017 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12018 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12020 spec->vmaster_nid = 0x03;
12022 codec->patch_ops = alc_patch_ops;
12023 if (board_config == ALC861_AUTO)
12024 spec->init_hook = alc861_auto_init;
12025 #ifdef CONFIG_SND_HDA_POWER_SAVE
12026 if (!spec->loopback.amplist)
12027 spec->loopback.amplist = alc861_loopbacks;
12034 * ALC861-VD support
12038 * In addition, an independent DAC
12040 #define ALC861VD_DIGOUT_NID 0x06
12042 static hda_nid_t alc861vd_dac_nids[4] = {
12043 /* front, surr, clfe, side surr */
12044 0x02, 0x03, 0x04, 0x05
12047 /* dac_nids for ALC660vd are in a different order - according to
12048 * Realtek's driver.
12049 * This should probably tesult in a different mixer for 6stack models
12050 * of ALC660vd codecs, but for now there is only 3stack mixer
12051 * - and it is the same as in 861vd.
12052 * adc_nids in ALC660vd are (is) the same as in 861vd
12054 static hda_nid_t alc660vd_dac_nids[3] = {
12055 /* front, rear, clfe, rear_surr */
12059 static hda_nid_t alc861vd_adc_nids[1] = {
12064 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12067 /* FIXME: should be a matrix-type input source selection */
12068 static struct hda_input_mux alc861vd_capture_source = {
12072 { "Front Mic", 0x1 },
12078 static struct hda_input_mux alc861vd_dallas_capture_source = {
12081 { "Ext Mic", 0x0 },
12082 { "Int Mic", 0x1 },
12086 static struct hda_input_mux alc861vd_hp_capture_source = {
12089 { "Front Mic", 0x0 },
12090 { "ATAPI Mic", 0x1 },
12094 #define alc861vd_mux_enum_info alc_mux_enum_info
12095 #define alc861vd_mux_enum_get alc_mux_enum_get
12096 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12097 #define alc861vd_mux_enum_put alc882_mux_enum_put
12102 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12109 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12110 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12111 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12112 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12113 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12120 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12121 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12122 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12123 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12124 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12128 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12129 { 6, alc861vd_6stack_ch6_init },
12130 { 8, alc861vd_6stack_ch8_init },
12133 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12136 .name = "Channel Mode",
12137 .info = alc_ch_mode_info,
12138 .get = alc_ch_mode_get,
12139 .put = alc_ch_mode_put,
12144 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12145 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12146 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12150 /* The multiple "Capture Source" controls confuse alsamixer
12151 * So call somewhat different..
12153 /* .name = "Capture Source", */
12154 .name = "Input Source",
12156 .info = alc861vd_mux_enum_info,
12157 .get = alc861vd_mux_enum_get,
12158 .put = alc861vd_mux_enum_put,
12163 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12164 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12166 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12167 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12168 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12170 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12171 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12173 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12175 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12177 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12178 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12180 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12181 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12185 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12186 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12187 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12189 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12190 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12191 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12193 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12194 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12199 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12200 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12205 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12206 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12207 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12215 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12216 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12217 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12220 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12222 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12223 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12225 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12226 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12231 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12232 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12233 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12234 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12236 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12238 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12240 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12242 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12243 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12244 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12246 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12247 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12252 /* Pin assignment: Speaker=0x14, HP = 0x15,
12253 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12255 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12256 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12257 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12259 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12260 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12261 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12262 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12263 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12264 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12265 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12266 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12267 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12271 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12272 * Front Mic=0x18, ATAPI Mic = 0x19,
12274 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12275 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12276 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12277 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12278 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12279 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12280 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12281 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12282 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12288 * generic initialization of ADC, input mixers and output mixers
12290 static struct hda_verb alc861vd_volume_init_verbs[] = {
12292 * Unmute ADC0 and set the default input to mic-in
12294 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12295 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12297 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12298 * the analog-loopback mixer widget
12300 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12307 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12314 * Set up output mixers (0x02 - 0x05)
12316 /* set vol=0 to output mixers */
12317 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12318 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12319 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12320 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12322 /* set up input amps for analog loopback */
12323 /* Amp Indices: DAC = 0, mixer = 1 */
12324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12325 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12329 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12330 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12331 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12337 * 3-stack pin configuration:
12338 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12340 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12342 * Set pin mode and muting
12344 /* set front pin widgets 0x14 for output */
12345 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12346 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12347 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12349 /* Mic (rear) pin: input vref at 80% */
12350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12352 /* Front Mic pin: input vref at 80% */
12353 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12355 /* Line In pin: input */
12356 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12357 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12358 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12359 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12360 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12361 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12362 /* CD pin widget for input */
12363 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12369 * 6-stack pin configuration:
12371 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12373 * Set pin mode and muting
12375 /* set front pin widgets 0x14 for output */
12376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12377 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12378 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12380 /* Rear Pin: output 1 (0x0d) */
12381 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12382 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12383 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12384 /* CLFE Pin: output 2 (0x0e) */
12385 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12386 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12387 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12388 /* Side Pin: output 3 (0x0f) */
12389 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12390 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12391 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12393 /* Mic (rear) pin: input vref at 80% */
12394 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12395 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12396 /* Front Mic pin: input vref at 80% */
12397 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12398 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12399 /* Line In pin: input */
12400 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12401 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12402 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12403 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12404 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12405 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12406 /* CD pin widget for input */
12407 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12412 static struct hda_verb alc861vd_eapd_verbs[] = {
12413 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12417 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12420 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12421 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12422 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12426 /* toggle speaker-output according to the hp-jack state */
12427 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12429 unsigned int present;
12430 unsigned char bits;
12432 present = snd_hda_codec_read(codec, 0x1b, 0,
12433 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12434 bits = present ? HDA_AMP_MUTE : 0;
12435 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12436 HDA_AMP_MUTE, bits);
12439 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12441 unsigned int present;
12442 unsigned char bits;
12444 present = snd_hda_codec_read(codec, 0x18, 0,
12445 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12446 bits = present ? HDA_AMP_MUTE : 0;
12447 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12448 HDA_AMP_MUTE, bits);
12451 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12453 alc861vd_lenovo_hp_automute(codec);
12454 alc861vd_lenovo_mic_automute(codec);
12457 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12460 switch (res >> 26) {
12461 case ALC880_HP_EVENT:
12462 alc861vd_lenovo_hp_automute(codec);
12464 case ALC880_MIC_EVENT:
12465 alc861vd_lenovo_mic_automute(codec);
12470 static struct hda_verb alc861vd_dallas_verbs[] = {
12471 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12472 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12473 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12474 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12482 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12490 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12491 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12492 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12494 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12495 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12496 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12497 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12498 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12499 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12500 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12501 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12509 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12510 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12515 /* toggle speaker-output according to the hp-jack state */
12516 static void alc861vd_dallas_automute(struct hda_codec *codec)
12518 unsigned int present;
12520 present = snd_hda_codec_read(codec, 0x15, 0,
12521 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12522 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12523 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12526 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12528 if ((res >> 26) == ALC880_HP_EVENT)
12529 alc861vd_dallas_automute(codec);
12532 #ifdef CONFIG_SND_HDA_POWER_SAVE
12533 #define alc861vd_loopbacks alc880_loopbacks
12536 /* pcm configuration: identiacal with ALC880 */
12537 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12538 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12539 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12540 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12543 * configuration and preset
12545 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12546 [ALC660VD_3ST] = "3stack-660",
12547 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12548 [ALC861VD_3ST] = "3stack",
12549 [ALC861VD_3ST_DIG] = "3stack-digout",
12550 [ALC861VD_6ST_DIG] = "6stack-digout",
12551 [ALC861VD_LENOVO] = "lenovo",
12552 [ALC861VD_DALLAS] = "dallas",
12553 [ALC861VD_HP] = "hp",
12554 [ALC861VD_AUTO] = "auto",
12557 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12558 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12559 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12560 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12561 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12562 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12563 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12564 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12565 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12566 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12567 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12568 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
12569 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12570 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12571 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12572 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12576 static struct alc_config_preset alc861vd_presets[] = {
12578 .mixers = { alc861vd_3st_mixer },
12579 .init_verbs = { alc861vd_volume_init_verbs,
12580 alc861vd_3stack_init_verbs },
12581 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12582 .dac_nids = alc660vd_dac_nids,
12583 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12584 .channel_mode = alc861vd_3stack_2ch_modes,
12585 .input_mux = &alc861vd_capture_source,
12587 [ALC660VD_3ST_DIG] = {
12588 .mixers = { alc861vd_3st_mixer },
12589 .init_verbs = { alc861vd_volume_init_verbs,
12590 alc861vd_3stack_init_verbs },
12591 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12592 .dac_nids = alc660vd_dac_nids,
12593 .dig_out_nid = ALC861VD_DIGOUT_NID,
12594 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12595 .channel_mode = alc861vd_3stack_2ch_modes,
12596 .input_mux = &alc861vd_capture_source,
12599 .mixers = { alc861vd_3st_mixer },
12600 .init_verbs = { alc861vd_volume_init_verbs,
12601 alc861vd_3stack_init_verbs },
12602 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12603 .dac_nids = alc861vd_dac_nids,
12604 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12605 .channel_mode = alc861vd_3stack_2ch_modes,
12606 .input_mux = &alc861vd_capture_source,
12608 [ALC861VD_3ST_DIG] = {
12609 .mixers = { alc861vd_3st_mixer },
12610 .init_verbs = { alc861vd_volume_init_verbs,
12611 alc861vd_3stack_init_verbs },
12612 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12613 .dac_nids = alc861vd_dac_nids,
12614 .dig_out_nid = ALC861VD_DIGOUT_NID,
12615 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12616 .channel_mode = alc861vd_3stack_2ch_modes,
12617 .input_mux = &alc861vd_capture_source,
12619 [ALC861VD_6ST_DIG] = {
12620 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12621 .init_verbs = { alc861vd_volume_init_verbs,
12622 alc861vd_6stack_init_verbs },
12623 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12624 .dac_nids = alc861vd_dac_nids,
12625 .dig_out_nid = ALC861VD_DIGOUT_NID,
12626 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12627 .channel_mode = alc861vd_6stack_modes,
12628 .input_mux = &alc861vd_capture_source,
12630 [ALC861VD_LENOVO] = {
12631 .mixers = { alc861vd_lenovo_mixer },
12632 .init_verbs = { alc861vd_volume_init_verbs,
12633 alc861vd_3stack_init_verbs,
12634 alc861vd_eapd_verbs,
12635 alc861vd_lenovo_unsol_verbs },
12636 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12637 .dac_nids = alc660vd_dac_nids,
12638 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12639 .channel_mode = alc861vd_3stack_2ch_modes,
12640 .input_mux = &alc861vd_capture_source,
12641 .unsol_event = alc861vd_lenovo_unsol_event,
12642 .init_hook = alc861vd_lenovo_automute,
12644 [ALC861VD_DALLAS] = {
12645 .mixers = { alc861vd_dallas_mixer },
12646 .init_verbs = { alc861vd_dallas_verbs },
12647 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12648 .dac_nids = alc861vd_dac_nids,
12649 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12650 .channel_mode = alc861vd_3stack_2ch_modes,
12651 .input_mux = &alc861vd_dallas_capture_source,
12652 .unsol_event = alc861vd_dallas_unsol_event,
12653 .init_hook = alc861vd_dallas_automute,
12656 .mixers = { alc861vd_hp_mixer },
12657 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12658 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12659 .dac_nids = alc861vd_dac_nids,
12660 .dig_out_nid = ALC861VD_DIGOUT_NID,
12661 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12662 .channel_mode = alc861vd_3stack_2ch_modes,
12663 .input_mux = &alc861vd_hp_capture_source,
12664 .unsol_event = alc861vd_dallas_unsol_event,
12665 .init_hook = alc861vd_dallas_automute,
12670 * BIOS auto configuration
12672 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12673 hda_nid_t nid, int pin_type, int dac_idx)
12675 alc_set_pin_output(codec, nid, pin_type);
12678 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12680 struct alc_spec *spec = codec->spec;
12683 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12684 for (i = 0; i <= HDA_SIDE; i++) {
12685 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12686 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12688 alc861vd_auto_set_output_and_unmute(codec, nid,
12694 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12696 struct alc_spec *spec = codec->spec;
12699 pin = spec->autocfg.hp_pins[0];
12700 if (pin) /* connect to front and use dac 0 */
12701 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12702 pin = spec->autocfg.speaker_pins[0];
12704 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12707 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12708 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12710 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12712 struct alc_spec *spec = codec->spec;
12715 for (i = 0; i < AUTO_PIN_LAST; i++) {
12716 hda_nid_t nid = spec->autocfg.input_pins[i];
12717 if (alc861vd_is_input_pin(nid)) {
12718 snd_hda_codec_write(codec, nid, 0,
12719 AC_VERB_SET_PIN_WIDGET_CONTROL,
12720 i <= AUTO_PIN_FRONT_MIC ?
12721 PIN_VREF80 : PIN_IN);
12722 if (nid != ALC861VD_PIN_CD_NID)
12723 snd_hda_codec_write(codec, nid, 0,
12724 AC_VERB_SET_AMP_GAIN_MUTE,
12730 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12731 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12733 /* add playback controls from the parsed DAC table */
12734 /* Based on ALC880 version. But ALC861VD has separate,
12735 * different NIDs for mute/unmute switch and volume control */
12736 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12737 const struct auto_pin_cfg *cfg)
12740 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12741 hda_nid_t nid_v, nid_s;
12744 for (i = 0; i < cfg->line_outs; i++) {
12745 if (!spec->multiout.dac_nids[i])
12747 nid_v = alc861vd_idx_to_mixer_vol(
12749 spec->multiout.dac_nids[i]));
12750 nid_s = alc861vd_idx_to_mixer_switch(
12752 spec->multiout.dac_nids[i]));
12756 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12757 "Center Playback Volume",
12758 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12762 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12763 "LFE Playback Volume",
12764 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12768 err = add_control(spec, ALC_CTL_BIND_MUTE,
12769 "Center Playback Switch",
12770 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12774 err = add_control(spec, ALC_CTL_BIND_MUTE,
12775 "LFE Playback Switch",
12776 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12781 sprintf(name, "%s Playback Volume", chname[i]);
12782 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12783 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12787 sprintf(name, "%s Playback Switch", chname[i]);
12788 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12789 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12798 /* add playback controls for speaker and HP outputs */
12799 /* Based on ALC880 version. But ALC861VD has separate,
12800 * different NIDs for mute/unmute switch and volume control */
12801 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12802 hda_nid_t pin, const char *pfx)
12804 hda_nid_t nid_v, nid_s;
12811 if (alc880_is_fixed_pin(pin)) {
12812 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12813 /* specify the DAC as the extra output */
12814 if (!spec->multiout.hp_nid)
12815 spec->multiout.hp_nid = nid_v;
12817 spec->multiout.extra_out_nid[0] = nid_v;
12818 /* control HP volume/switch on the output mixer amp */
12819 nid_v = alc861vd_idx_to_mixer_vol(
12820 alc880_fixed_pin_idx(pin));
12821 nid_s = alc861vd_idx_to_mixer_switch(
12822 alc880_fixed_pin_idx(pin));
12824 sprintf(name, "%s Playback Volume", pfx);
12825 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12826 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12829 sprintf(name, "%s Playback Switch", pfx);
12830 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12831 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12834 } else if (alc880_is_multi_pin(pin)) {
12835 /* set manual connection */
12836 /* we have only a switch on HP-out PIN */
12837 sprintf(name, "%s Playback Switch", pfx);
12838 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12839 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12846 /* parse the BIOS configuration and set up the alc_spec
12847 * return 1 if successful, 0 if the proper config is not found,
12848 * or a negative error code
12849 * Based on ALC880 version - had to change it to override
12850 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12851 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12853 struct alc_spec *spec = codec->spec;
12855 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12857 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12861 if (!spec->autocfg.line_outs)
12862 return 0; /* can't find valid BIOS pin config */
12864 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12867 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12870 err = alc861vd_auto_create_extra_out(spec,
12871 spec->autocfg.speaker_pins[0],
12875 err = alc861vd_auto_create_extra_out(spec,
12876 spec->autocfg.hp_pins[0],
12880 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12884 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12886 if (spec->autocfg.dig_out_pin)
12887 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12889 if (spec->kctl_alloc)
12890 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12892 spec->init_verbs[spec->num_init_verbs++]
12893 = alc861vd_volume_init_verbs;
12895 spec->num_mux_defs = 1;
12896 spec->input_mux = &spec->private_imux;
12898 err = alc_auto_add_mic_boost(codec);
12905 /* additional initialization for auto-configuration model */
12906 static void alc861vd_auto_init(struct hda_codec *codec)
12908 struct alc_spec *spec = codec->spec;
12909 alc861vd_auto_init_multi_out(codec);
12910 alc861vd_auto_init_hp_out(codec);
12911 alc861vd_auto_init_analog_input(codec);
12912 if (spec->unsol_event)
12913 alc_sku_automute(codec);
12916 static int patch_alc861vd(struct hda_codec *codec)
12918 struct alc_spec *spec;
12919 int err, board_config;
12921 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12925 codec->spec = spec;
12927 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12931 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12932 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12933 "ALC861VD, trying auto-probe from BIOS...\n");
12934 board_config = ALC861VD_AUTO;
12937 if (board_config == ALC861VD_AUTO) {
12938 /* automatic parse from the BIOS config */
12939 err = alc861vd_parse_auto_config(codec);
12945 "hda_codec: Cannot set up configuration "
12946 "from BIOS. Using base mode...\n");
12947 board_config = ALC861VD_3ST;
12951 if (board_config != ALC861VD_AUTO)
12952 setup_preset(spec, &alc861vd_presets[board_config]);
12954 spec->stream_name_analog = "ALC861VD Analog";
12955 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12956 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12958 spec->stream_name_digital = "ALC861VD Digital";
12959 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12960 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12962 spec->adc_nids = alc861vd_adc_nids;
12963 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12964 spec->capsrc_nids = alc861vd_capsrc_nids;
12966 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12967 spec->num_mixers++;
12969 spec->vmaster_nid = 0x02;
12971 codec->patch_ops = alc_patch_ops;
12973 if (board_config == ALC861VD_AUTO)
12974 spec->init_hook = alc861vd_auto_init;
12975 #ifdef CONFIG_SND_HDA_POWER_SAVE
12976 if (!spec->loopback.amplist)
12977 spec->loopback.amplist = alc861vd_loopbacks;
12986 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12987 * configuration. Each pin widget can choose any input DACs and a mixer.
12988 * Each ADC is connected from a mixer of all inputs. This makes possible
12989 * 6-channel independent captures.
12991 * In addition, an independent DAC for the multi-playback (not used in this
12994 #define ALC662_DIGOUT_NID 0x06
12995 #define ALC662_DIGIN_NID 0x0a
12997 static hda_nid_t alc662_dac_nids[4] = {
12998 /* front, rear, clfe, rear_surr */
13002 static hda_nid_t alc662_adc_nids[1] = {
13007 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13010 /* FIXME: should be a matrix-type input source selection */
13011 static struct hda_input_mux alc662_capture_source = {
13015 { "Front Mic", 0x1 },
13021 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13029 static struct hda_input_mux alc662_eeepc_capture_source = {
13037 #define alc662_mux_enum_info alc_mux_enum_info
13038 #define alc662_mux_enum_get alc_mux_enum_get
13039 #define alc662_mux_enum_put alc882_mux_enum_put
13044 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13051 static struct hda_verb alc662_3ST_ch2_init[] = {
13052 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13053 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13054 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13055 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13062 static struct hda_verb alc662_3ST_ch6_init[] = {
13063 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13064 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13065 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13066 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13067 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13068 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13072 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13073 { 2, alc662_3ST_ch2_init },
13074 { 6, alc662_3ST_ch6_init },
13080 static struct hda_verb alc662_sixstack_ch6_init[] = {
13081 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13082 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13083 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13090 static struct hda_verb alc662_sixstack_ch8_init[] = {
13091 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13092 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13093 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13097 static struct hda_channel_mode alc662_5stack_modes[2] = {
13098 { 2, alc662_sixstack_ch6_init },
13099 { 6, alc662_sixstack_ch8_init },
13102 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13103 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13106 static struct snd_kcontrol_new alc662_base_mixer[] = {
13107 /* output mixer control */
13108 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13109 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13110 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13111 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13112 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13113 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13114 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13115 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13118 /*Input mixer control */
13119 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13120 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13121 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13122 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13123 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13124 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13130 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13131 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13132 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13137 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13140 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13141 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13142 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13143 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13147 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13148 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13149 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13150 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13151 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13152 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13153 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13154 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13155 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13156 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13157 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13158 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13159 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13160 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13163 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13164 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13165 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13166 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13170 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13171 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13172 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13173 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13174 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13176 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13177 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13183 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13184 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13186 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13187 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13189 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13190 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13191 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13193 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13194 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13195 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13199 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13200 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13201 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13202 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13203 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13204 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13205 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13206 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13207 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13208 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13209 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13210 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13211 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13217 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13220 .name = "Channel Mode",
13221 .info = alc_ch_mode_info,
13222 .get = alc_ch_mode_get,
13223 .put = alc_ch_mode_put,
13228 static struct hda_verb alc662_init_verbs[] = {
13229 /* ADC: mute amp left and right */
13230 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13231 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13232 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13240 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13247 /* Front Pin: output 0 (0x0c) */
13248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13249 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13251 /* Rear Pin: output 1 (0x0d) */
13252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13255 /* CLFE Pin: output 2 (0x0e) */
13256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13257 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13259 /* Mic (rear) pin: input vref at 80% */
13260 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13261 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13262 /* Front Mic pin: input vref at 80% */
13263 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13264 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13265 /* Line In pin: input */
13266 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13268 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13269 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13270 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13271 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13272 /* CD pin widget for input */
13273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13275 /* FIXME: use matrix-type input source selection */
13276 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13278 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13280 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13281 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13290 static struct hda_verb alc662_sue_init_verbs[] = {
13291 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13292 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13296 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13297 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13298 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13302 /* Set Unsolicited Event*/
13303 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13304 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13305 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13310 * generic initialization of ADC, input mixers and output mixers
13312 static struct hda_verb alc662_auto_init_verbs[] = {
13314 * Unmute ADC and set the default input to mic-in
13316 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13319 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13321 * Note: PASD motherboards uses the Line In 2 as the input for front
13322 * panel mic (mic 2)
13324 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13332 * Set up output mixers (0x0c - 0x0f)
13334 /* set vol=0 to output mixers */
13335 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13336 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13337 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13339 /* set up input amps for analog loopback */
13340 /* Amp Indices: DAC = 0, mixer = 1 */
13341 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13349 /* FIXME: use matrix-type input source selection */
13350 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13353 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13357 /* capture mixer elements */
13358 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13359 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13360 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13362 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13363 /* The multiple "Capture Source" controls confuse alsamixer
13364 * So call somewhat different..
13366 /* .name = "Capture Source", */
13367 .name = "Input Source",
13369 .info = alc662_mux_enum_info,
13370 .get = alc662_mux_enum_get,
13371 .put = alc662_mux_enum_put,
13376 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13378 unsigned int present;
13379 unsigned char bits;
13381 present = snd_hda_codec_read(codec, 0x14, 0,
13382 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13383 bits = present ? HDA_AMP_MUTE : 0;
13384 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13385 HDA_AMP_MUTE, bits);
13388 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13390 unsigned int present;
13391 unsigned char bits;
13393 present = snd_hda_codec_read(codec, 0x1b, 0,
13394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13395 bits = present ? HDA_AMP_MUTE : 0;
13396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13397 HDA_AMP_MUTE, bits);
13398 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13399 HDA_AMP_MUTE, bits);
13402 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13405 if ((res >> 26) == ALC880_HP_EVENT)
13406 alc662_lenovo_101e_all_automute(codec);
13407 if ((res >> 26) == ALC880_FRONT_EVENT)
13408 alc662_lenovo_101e_ispeaker_automute(codec);
13411 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13413 unsigned int present;
13415 present = snd_hda_codec_read(codec, 0x18, 0,
13416 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13417 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13418 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13419 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13420 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13421 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13422 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13423 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13424 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13427 /* unsolicited event for HP jack sensing */
13428 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13431 if ((res >> 26) == ALC880_HP_EVENT)
13432 alc262_hippo1_automute( codec );
13434 if ((res >> 26) == ALC880_MIC_EVENT)
13435 alc662_eeepc_mic_automute(codec);
13438 static void alc662_eeepc_inithook(struct hda_codec *codec)
13440 alc262_hippo1_automute( codec );
13441 alc662_eeepc_mic_automute(codec);
13444 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13447 unsigned int present;
13449 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13450 present = snd_hda_codec_read(codec, 0x14, 0,
13451 AC_VERB_GET_PIN_SENSE, 0);
13452 present = (present & 0x80000000) != 0;
13454 /* mute internal speaker */
13455 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13456 HDA_AMP_MUTE, HDA_AMP_MUTE);
13458 /* unmute internal speaker if necessary */
13459 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13460 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13461 HDA_AMP_MUTE, mute);
13465 /* unsolicited event for HP jack sensing */
13466 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13469 if ((res >> 26) == ALC880_HP_EVENT)
13470 alc662_eeepc_ep20_automute(codec);
13473 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13475 alc662_eeepc_ep20_automute(codec);
13478 #ifdef CONFIG_SND_HDA_POWER_SAVE
13479 #define alc662_loopbacks alc880_loopbacks
13483 /* pcm configuration: identiacal with ALC880 */
13484 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13485 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13486 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13487 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13490 * configuration and preset
13492 static const char *alc662_models[ALC662_MODEL_LAST] = {
13493 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13494 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13495 [ALC662_3ST_6ch] = "3stack-6ch",
13496 [ALC662_5ST_DIG] = "6stack-dig",
13497 [ALC662_LENOVO_101E] = "lenovo-101e",
13498 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13499 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13500 [ALC662_AUTO] = "auto",
13503 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13504 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
13505 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13506 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13507 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13511 static struct alc_config_preset alc662_presets[] = {
13512 [ALC662_3ST_2ch_DIG] = {
13513 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13514 .init_verbs = { alc662_init_verbs },
13515 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13516 .dac_nids = alc662_dac_nids,
13517 .dig_out_nid = ALC662_DIGOUT_NID,
13518 .dig_in_nid = ALC662_DIGIN_NID,
13519 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13520 .channel_mode = alc662_3ST_2ch_modes,
13521 .input_mux = &alc662_capture_source,
13523 [ALC662_3ST_6ch_DIG] = {
13524 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13525 alc662_capture_mixer },
13526 .init_verbs = { alc662_init_verbs },
13527 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13528 .dac_nids = alc662_dac_nids,
13529 .dig_out_nid = ALC662_DIGOUT_NID,
13530 .dig_in_nid = ALC662_DIGIN_NID,
13531 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13532 .channel_mode = alc662_3ST_6ch_modes,
13534 .input_mux = &alc662_capture_source,
13536 [ALC662_3ST_6ch] = {
13537 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13538 alc662_capture_mixer },
13539 .init_verbs = { alc662_init_verbs },
13540 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13541 .dac_nids = alc662_dac_nids,
13542 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13543 .channel_mode = alc662_3ST_6ch_modes,
13545 .input_mux = &alc662_capture_source,
13547 [ALC662_5ST_DIG] = {
13548 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13549 alc662_capture_mixer },
13550 .init_verbs = { alc662_init_verbs },
13551 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13552 .dac_nids = alc662_dac_nids,
13553 .dig_out_nid = ALC662_DIGOUT_NID,
13554 .dig_in_nid = ALC662_DIGIN_NID,
13555 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13556 .channel_mode = alc662_5stack_modes,
13557 .input_mux = &alc662_capture_source,
13559 [ALC662_LENOVO_101E] = {
13560 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13561 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13562 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13563 .dac_nids = alc662_dac_nids,
13564 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13565 .channel_mode = alc662_3ST_2ch_modes,
13566 .input_mux = &alc662_lenovo_101e_capture_source,
13567 .unsol_event = alc662_lenovo_101e_unsol_event,
13568 .init_hook = alc662_lenovo_101e_all_automute,
13570 [ALC662_ASUS_EEEPC_P701] = {
13571 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13572 .init_verbs = { alc662_init_verbs,
13573 alc662_eeepc_sue_init_verbs },
13574 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13575 .dac_nids = alc662_dac_nids,
13576 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13577 .channel_mode = alc662_3ST_2ch_modes,
13578 .input_mux = &alc662_eeepc_capture_source,
13579 .unsol_event = alc662_eeepc_unsol_event,
13580 .init_hook = alc662_eeepc_inithook,
13582 [ALC662_ASUS_EEEPC_EP20] = {
13583 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13584 alc662_chmode_mixer },
13585 .init_verbs = { alc662_init_verbs,
13586 alc662_eeepc_ep20_sue_init_verbs },
13587 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13588 .dac_nids = alc662_dac_nids,
13589 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13590 .channel_mode = alc662_3ST_6ch_modes,
13591 .input_mux = &alc662_lenovo_101e_capture_source,
13592 .unsol_event = alc662_eeepc_ep20_unsol_event,
13593 .init_hook = alc662_eeepc_ep20_inithook,
13600 * BIOS auto configuration
13603 /* add playback controls from the parsed DAC table */
13604 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13605 const struct auto_pin_cfg *cfg)
13608 static const char *chname[4] = {
13609 "Front", "Surround", NULL /*CLFE*/, "Side"
13614 for (i = 0; i < cfg->line_outs; i++) {
13615 if (!spec->multiout.dac_nids[i])
13617 nid = alc880_idx_to_dac(i);
13620 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13621 "Center Playback Volume",
13622 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13626 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13627 "LFE Playback Volume",
13628 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13632 err = add_control(spec, ALC_CTL_BIND_MUTE,
13633 "Center Playback Switch",
13634 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13638 err = add_control(spec, ALC_CTL_BIND_MUTE,
13639 "LFE Playback Switch",
13640 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13645 sprintf(name, "%s Playback Volume", chname[i]);
13646 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13647 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13651 sprintf(name, "%s Playback Switch", chname[i]);
13652 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13653 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13662 /* add playback controls for speaker and HP outputs */
13663 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13673 if (alc880_is_fixed_pin(pin)) {
13674 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13675 /* printk("DAC nid=%x\n",nid); */
13676 /* specify the DAC as the extra output */
13677 if (!spec->multiout.hp_nid)
13678 spec->multiout.hp_nid = nid;
13680 spec->multiout.extra_out_nid[0] = nid;
13681 /* control HP volume/switch on the output mixer amp */
13682 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13683 sprintf(name, "%s Playback Volume", pfx);
13684 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13685 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13688 sprintf(name, "%s Playback Switch", pfx);
13689 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13690 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13693 } else if (alc880_is_multi_pin(pin)) {
13694 /* set manual connection */
13695 /* we have only a switch on HP-out PIN */
13696 sprintf(name, "%s Playback Switch", pfx);
13697 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13698 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13705 /* create playback/capture controls for input pins */
13706 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13707 const struct auto_pin_cfg *cfg)
13709 struct hda_input_mux *imux = &spec->private_imux;
13712 for (i = 0; i < AUTO_PIN_LAST; i++) {
13713 if (alc880_is_input_pin(cfg->input_pins[i])) {
13714 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13715 err = new_analog_input(spec, cfg->input_pins[i],
13716 auto_pin_cfg_labels[i],
13720 imux->items[imux->num_items].label =
13721 auto_pin_cfg_labels[i];
13722 imux->items[imux->num_items].index =
13723 alc880_input_pin_idx(cfg->input_pins[i]);
13730 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13731 hda_nid_t nid, int pin_type,
13734 alc_set_pin_output(codec, nid, pin_type);
13735 /* need the manual connection? */
13736 if (alc880_is_multi_pin(nid)) {
13737 struct alc_spec *spec = codec->spec;
13738 int idx = alc880_multi_pin_idx(nid);
13739 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13740 AC_VERB_SET_CONNECT_SEL,
13741 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13745 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13747 struct alc_spec *spec = codec->spec;
13750 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13751 for (i = 0; i <= HDA_SIDE; i++) {
13752 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13753 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13755 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13760 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13762 struct alc_spec *spec = codec->spec;
13765 pin = spec->autocfg.hp_pins[0];
13766 if (pin) /* connect to front */
13768 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13769 pin = spec->autocfg.speaker_pins[0];
13771 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13774 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13775 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13777 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13779 struct alc_spec *spec = codec->spec;
13782 for (i = 0; i < AUTO_PIN_LAST; i++) {
13783 hda_nid_t nid = spec->autocfg.input_pins[i];
13784 if (alc662_is_input_pin(nid)) {
13785 snd_hda_codec_write(codec, nid, 0,
13786 AC_VERB_SET_PIN_WIDGET_CONTROL,
13787 (i <= AUTO_PIN_FRONT_MIC ?
13788 PIN_VREF80 : PIN_IN));
13789 if (nid != ALC662_PIN_CD_NID)
13790 snd_hda_codec_write(codec, nid, 0,
13791 AC_VERB_SET_AMP_GAIN_MUTE,
13797 static int alc662_parse_auto_config(struct hda_codec *codec)
13799 struct alc_spec *spec = codec->spec;
13801 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13803 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13807 if (!spec->autocfg.line_outs)
13808 return 0; /* can't find valid BIOS pin config */
13810 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13813 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13816 err = alc662_auto_create_extra_out(spec,
13817 spec->autocfg.speaker_pins[0],
13821 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13825 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13829 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13831 if (spec->autocfg.dig_out_pin)
13832 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13834 if (spec->kctl_alloc)
13835 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13837 spec->num_mux_defs = 1;
13838 spec->input_mux = &spec->private_imux;
13840 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13841 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13842 spec->num_mixers++;
13846 /* additional initialization for auto-configuration model */
13847 static void alc662_auto_init(struct hda_codec *codec)
13849 struct alc_spec *spec = codec->spec;
13850 alc662_auto_init_multi_out(codec);
13851 alc662_auto_init_hp_out(codec);
13852 alc662_auto_init_analog_input(codec);
13853 if (spec->unsol_event)
13854 alc_sku_automute(codec);
13857 static int patch_alc662(struct hda_codec *codec)
13859 struct alc_spec *spec;
13860 int err, board_config;
13862 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13866 codec->spec = spec;
13868 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13871 if (board_config < 0) {
13872 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13873 "trying auto-probe from BIOS...\n");
13874 board_config = ALC662_AUTO;
13877 if (board_config == ALC662_AUTO) {
13878 /* automatic parse from the BIOS config */
13879 err = alc662_parse_auto_config(codec);
13885 "hda_codec: Cannot set up configuration "
13886 "from BIOS. Using base mode...\n");
13887 board_config = ALC662_3ST_2ch_DIG;
13891 if (board_config != ALC662_AUTO)
13892 setup_preset(spec, &alc662_presets[board_config]);
13894 spec->stream_name_analog = "ALC662 Analog";
13895 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13896 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13898 spec->stream_name_digital = "ALC662 Digital";
13899 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13900 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13902 spec->adc_nids = alc662_adc_nids;
13903 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13904 spec->capsrc_nids = alc662_capsrc_nids;
13906 spec->vmaster_nid = 0x02;
13908 codec->patch_ops = alc_patch_ops;
13909 if (board_config == ALC662_AUTO)
13910 spec->init_hook = alc662_auto_init;
13911 #ifdef CONFIG_SND_HDA_POWER_SAVE
13912 if (!spec->loopback.amplist)
13913 spec->loopback.amplist = alc662_loopbacks;
13922 struct hda_codec_preset snd_hda_preset_realtek[] = {
13923 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13924 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13925 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13926 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13927 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13928 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13929 .patch = patch_alc861 },
13930 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13931 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13932 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13933 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13934 .patch = patch_alc883 },
13935 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13936 .patch = patch_alc662 },
13937 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13938 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13939 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13940 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13941 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13942 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13943 {} /* terminator */