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"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
62 #ifdef CONFIG_SND_DEBUG
66 ALC880_MODEL_LAST /* last tag */
78 #ifdef CONFIG_SND_DEBUG
82 ALC260_MODEL_LAST /* last tag */
92 ALC262_HP_BPC_D7000_WL,
93 ALC262_HP_BPC_D7000_WF,
101 ALC262_MODEL_LAST /* last tag */
110 #ifdef CONFIG_SND_DEBUG
114 ALC268_MODEL_LAST /* last tag */
121 ALC269_MODEL_LAST /* last tag */
138 /* ALC861-VD models */
159 ALC662_ASUS_EEEPC_P701,
160 ALC662_ASUS_EEEPC_EP20,
188 ALC883_TARGA_2ch_DIG,
194 ALC883_LENOVO_101E_2ch,
195 ALC883_LENOVO_NB0763,
196 ALC888_LENOVO_MS7195_DIG,
207 #define GPIO_MASK 0x03
210 /* codec parameterization */
211 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
212 unsigned int num_mixers;
214 const struct hda_verb *init_verbs[5]; /* initialization verbs
218 unsigned int num_init_verbs;
220 char *stream_name_analog; /* analog PCM stream */
221 struct hda_pcm_stream *stream_analog_playback;
222 struct hda_pcm_stream *stream_analog_capture;
223 struct hda_pcm_stream *stream_analog_alt_playback;
224 struct hda_pcm_stream *stream_analog_alt_capture;
226 char *stream_name_digital; /* digital PCM stream */
227 struct hda_pcm_stream *stream_digital_playback;
228 struct hda_pcm_stream *stream_digital_capture;
231 struct hda_multi_out multiout; /* playback set-up
232 * max_channels, dacs must be set
233 * dig_out_nid and hp_nid are optional
235 hda_nid_t alt_dac_nid;
238 unsigned int num_adc_nids;
240 hda_nid_t dig_in_nid; /* digital-in NID; optional */
243 unsigned int num_mux_defs;
244 const struct hda_input_mux *input_mux;
245 unsigned int cur_mux[3];
248 const struct hda_channel_mode *channel_mode;
249 int num_channel_mode;
252 /* PCM information */
253 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
255 /* dynamic controls, init_verbs and input_mux */
256 struct auto_pin_cfg autocfg;
257 unsigned int num_kctl_alloc, num_kctl_used;
258 struct snd_kcontrol_new *kctl_alloc;
259 struct hda_input_mux private_imux;
260 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
263 void (*init_hook)(struct hda_codec *codec);
264 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
266 /* for pin sensing */
267 unsigned int sense_updated: 1;
268 unsigned int jack_present: 1;
270 /* for virtual master */
271 hda_nid_t vmaster_nid;
273 #ifdef CONFIG_SND_HDA_POWER_SAVE
274 struct hda_loopback_check loopback;
279 * configuration template - to be copied to the spec instance
281 struct alc_config_preset {
282 struct snd_kcontrol_new *mixers[5]; /* should be identical size
285 const struct hda_verb *init_verbs[5];
286 unsigned int num_dacs;
288 hda_nid_t dig_out_nid; /* optional */
289 hda_nid_t hp_nid; /* optional */
290 unsigned int num_adc_nids;
292 hda_nid_t dig_in_nid;
293 unsigned int num_channel_mode;
294 const struct hda_channel_mode *channel_mode;
296 unsigned int num_mux_defs;
297 const struct hda_input_mux *input_mux;
298 void (*unsol_event)(struct hda_codec *, unsigned int);
299 void (*init_hook)(struct hda_codec *);
300 #ifdef CONFIG_SND_HDA_POWER_SAVE
301 struct hda_amp_list *loopbacks;
309 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
310 struct snd_ctl_elem_info *uinfo)
312 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
313 struct alc_spec *spec = codec->spec;
314 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
315 if (mux_idx >= spec->num_mux_defs)
317 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
320 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
321 struct snd_ctl_elem_value *ucontrol)
323 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
324 struct alc_spec *spec = codec->spec;
325 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
327 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
331 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
332 struct snd_ctl_elem_value *ucontrol)
334 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
335 struct alc_spec *spec = codec->spec;
336 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
337 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
338 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
339 spec->adc_nids[adc_idx],
340 &spec->cur_mux[adc_idx]);
345 * channel mode setting
347 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
348 struct snd_ctl_elem_info *uinfo)
350 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
351 struct alc_spec *spec = codec->spec;
352 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
353 spec->num_channel_mode);
356 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
357 struct snd_ctl_elem_value *ucontrol)
359 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
360 struct alc_spec *spec = codec->spec;
361 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
362 spec->num_channel_mode,
363 spec->multiout.max_channels);
366 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
367 struct snd_ctl_elem_value *ucontrol)
369 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
370 struct alc_spec *spec = codec->spec;
371 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
372 spec->num_channel_mode,
373 &spec->multiout.max_channels);
374 if (err >= 0 && spec->need_dac_fix)
375 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
380 * Control the mode of pin widget settings via the mixer. "pc" is used
381 * instead of "%" to avoid consequences of accidently treating the % as
382 * being part of a format specifier. Maximum allowed length of a value is
383 * 63 characters plus NULL terminator.
385 * Note: some retasking pin complexes seem to ignore requests for input
386 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
387 * are requested. Therefore order this list so that this behaviour will not
388 * cause problems when mixer clients move through the enum sequentially.
389 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
392 static char *alc_pin_mode_names[] = {
393 "Mic 50pc bias", "Mic 80pc bias",
394 "Line in", "Line out", "Headphone out",
396 static unsigned char alc_pin_mode_values[] = {
397 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
399 /* The control can present all 5 options, or it can limit the options based
400 * in the pin being assumed to be exclusively an input or an output pin. In
401 * addition, "input" pins may or may not process the mic bias option
402 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
403 * accept requests for bias as of chip versions up to March 2006) and/or
404 * wiring in the computer.
406 #define ALC_PIN_DIR_IN 0x00
407 #define ALC_PIN_DIR_OUT 0x01
408 #define ALC_PIN_DIR_INOUT 0x02
409 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
410 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
412 /* Info about the pin modes supported by the different pin direction modes.
413 * For each direction the minimum and maximum values are given.
415 static signed char alc_pin_mode_dir_info[5][2] = {
416 { 0, 2 }, /* ALC_PIN_DIR_IN */
417 { 3, 4 }, /* ALC_PIN_DIR_OUT */
418 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
419 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
420 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
422 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
423 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
424 #define alc_pin_mode_n_items(_dir) \
425 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
427 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
428 struct snd_ctl_elem_info *uinfo)
430 unsigned int item_num = uinfo->value.enumerated.item;
431 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
433 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
435 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
437 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
438 item_num = alc_pin_mode_min(dir);
439 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
443 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
444 struct snd_ctl_elem_value *ucontrol)
447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
448 hda_nid_t nid = kcontrol->private_value & 0xffff;
449 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
450 long *valp = ucontrol->value.integer.value;
451 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
452 AC_VERB_GET_PIN_WIDGET_CONTROL,
455 /* Find enumerated value for current pinctl setting */
456 i = alc_pin_mode_min(dir);
457 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
459 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
463 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
464 struct snd_ctl_elem_value *ucontrol)
467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
468 hda_nid_t nid = kcontrol->private_value & 0xffff;
469 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
470 long val = *ucontrol->value.integer.value;
471 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
472 AC_VERB_GET_PIN_WIDGET_CONTROL,
475 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
476 val = alc_pin_mode_min(dir);
478 change = pinctl != alc_pin_mode_values[val];
480 /* Set pin mode to that requested */
481 snd_hda_codec_write_cache(codec, nid, 0,
482 AC_VERB_SET_PIN_WIDGET_CONTROL,
483 alc_pin_mode_values[val]);
485 /* Also enable the retasking pin's input/output as required
486 * for the requested pin mode. Enum values of 2 or less are
489 * Dynamically switching the input/output buffers probably
490 * reduces noise slightly (particularly on input) so we'll
491 * do it. However, having both input and output buffers
492 * enabled simultaneously doesn't seem to be problematic if
493 * this turns out to be necessary in the future.
496 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
497 HDA_AMP_MUTE, HDA_AMP_MUTE);
498 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
501 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
502 HDA_AMP_MUTE, HDA_AMP_MUTE);
503 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
510 #define ALC_PIN_MODE(xname, nid, dir) \
511 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
512 .info = alc_pin_mode_info, \
513 .get = alc_pin_mode_get, \
514 .put = alc_pin_mode_put, \
515 .private_value = nid | (dir<<16) }
517 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
518 * together using a mask with more than one bit set. This control is
519 * currently used only by the ALC260 test model. At this stage they are not
520 * needed for any "production" models.
522 #ifdef CONFIG_SND_DEBUG
523 #define alc_gpio_data_info snd_ctl_boolean_mono_info
525 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
526 struct snd_ctl_elem_value *ucontrol)
528 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
529 hda_nid_t nid = kcontrol->private_value & 0xffff;
530 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
531 long *valp = ucontrol->value.integer.value;
532 unsigned int val = snd_hda_codec_read(codec, nid, 0,
533 AC_VERB_GET_GPIO_DATA, 0x00);
535 *valp = (val & mask) != 0;
538 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
539 struct snd_ctl_elem_value *ucontrol)
542 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
543 hda_nid_t nid = kcontrol->private_value & 0xffff;
544 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
545 long val = *ucontrol->value.integer.value;
546 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
547 AC_VERB_GET_GPIO_DATA,
550 /* Set/unset the masked GPIO bit(s) as needed */
551 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
556 snd_hda_codec_write_cache(codec, nid, 0,
557 AC_VERB_SET_GPIO_DATA, gpio_data);
561 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
562 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
563 .info = alc_gpio_data_info, \
564 .get = alc_gpio_data_get, \
565 .put = alc_gpio_data_put, \
566 .private_value = nid | (mask<<16) }
567 #endif /* CONFIG_SND_DEBUG */
569 /* A switch control to allow the enabling of the digital IO pins on the
570 * ALC260. This is incredibly simplistic; the intention of this control is
571 * to provide something in the test model allowing digital outputs to be
572 * identified if present. If models are found which can utilise these
573 * outputs a more complete mixer control can be devised for those models if
576 #ifdef CONFIG_SND_DEBUG
577 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
579 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
580 struct snd_ctl_elem_value *ucontrol)
582 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
583 hda_nid_t nid = kcontrol->private_value & 0xffff;
584 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
585 long *valp = ucontrol->value.integer.value;
586 unsigned int val = snd_hda_codec_read(codec, nid, 0,
587 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
589 *valp = (val & mask) != 0;
592 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
593 struct snd_ctl_elem_value *ucontrol)
596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
597 hda_nid_t nid = kcontrol->private_value & 0xffff;
598 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
599 long val = *ucontrol->value.integer.value;
600 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
601 AC_VERB_GET_DIGI_CONVERT_1,
604 /* Set/unset the masked control bit(s) as needed */
605 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
610 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
615 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
616 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
617 .info = alc_spdif_ctrl_info, \
618 .get = alc_spdif_ctrl_get, \
619 .put = alc_spdif_ctrl_put, \
620 .private_value = nid | (mask<<16) }
621 #endif /* CONFIG_SND_DEBUG */
623 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
624 * Again, this is only used in the ALC26x test models to help identify when
625 * the EAPD line must be asserted for features to work.
627 #ifdef CONFIG_SND_DEBUG
628 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
630 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
631 struct snd_ctl_elem_value *ucontrol)
633 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
634 hda_nid_t nid = kcontrol->private_value & 0xffff;
635 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
636 long *valp = ucontrol->value.integer.value;
637 unsigned int val = snd_hda_codec_read(codec, nid, 0,
638 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
640 *valp = (val & mask) != 0;
644 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
645 struct snd_ctl_elem_value *ucontrol)
648 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
649 hda_nid_t nid = kcontrol->private_value & 0xffff;
650 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
651 long val = *ucontrol->value.integer.value;
652 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
653 AC_VERB_GET_EAPD_BTLENABLE,
656 /* Set/unset the masked control bit(s) as needed */
657 change = (!val ? 0 : mask) != (ctrl_data & mask);
662 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
668 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
669 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
670 .info = alc_eapd_ctrl_info, \
671 .get = alc_eapd_ctrl_get, \
672 .put = alc_eapd_ctrl_put, \
673 .private_value = nid | (mask<<16) }
674 #endif /* CONFIG_SND_DEBUG */
677 * set up from the preset table
679 static void setup_preset(struct alc_spec *spec,
680 const struct alc_config_preset *preset)
684 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
685 spec->mixers[spec->num_mixers++] = preset->mixers[i];
686 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
688 spec->init_verbs[spec->num_init_verbs++] =
689 preset->init_verbs[i];
691 spec->channel_mode = preset->channel_mode;
692 spec->num_channel_mode = preset->num_channel_mode;
693 spec->need_dac_fix = preset->need_dac_fix;
695 spec->multiout.max_channels = spec->channel_mode[0].channels;
697 spec->multiout.num_dacs = preset->num_dacs;
698 spec->multiout.dac_nids = preset->dac_nids;
699 spec->multiout.dig_out_nid = preset->dig_out_nid;
700 spec->multiout.hp_nid = preset->hp_nid;
702 spec->num_mux_defs = preset->num_mux_defs;
703 if (!spec->num_mux_defs)
704 spec->num_mux_defs = 1;
705 spec->input_mux = preset->input_mux;
707 spec->num_adc_nids = preset->num_adc_nids;
708 spec->adc_nids = preset->adc_nids;
709 spec->dig_in_nid = preset->dig_in_nid;
711 spec->unsol_event = preset->unsol_event;
712 spec->init_hook = preset->init_hook;
713 #ifdef CONFIG_SND_HDA_POWER_SAVE
714 spec->loopback.amplist = preset->loopbacks;
718 /* Enable GPIO mask and set output */
719 static struct hda_verb alc_gpio1_init_verbs[] = {
720 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
721 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
722 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
726 static struct hda_verb alc_gpio2_init_verbs[] = {
727 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
728 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
729 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
733 static struct hda_verb alc_gpio3_init_verbs[] = {
734 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
735 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
736 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
740 static void alc_sku_automute(struct hda_codec *codec)
742 struct alc_spec *spec = codec->spec;
744 unsigned int present;
745 unsigned int hp_nid = spec->autocfg.hp_pins[0];
746 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
748 /* need to execute and sync at first */
749 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
750 present = snd_hda_codec_read(codec, hp_nid, 0,
751 AC_VERB_GET_PIN_SENSE, 0);
752 spec->jack_present = (present & 0x80000000) != 0;
753 if (spec->jack_present) {
754 /* mute internal speaker */
755 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
756 HDA_AMP_MUTE, HDA_AMP_MUTE);
758 /* unmute internal speaker if necessary */
759 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
760 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
765 /* unsolicited event for HP jack sensing */
766 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
768 if (codec->vendor_id == 0x10ec0880)
772 if (res != ALC880_HP_EVENT)
775 alc_sku_automute(codec);
778 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
779 * 31 ~ 16 : Manufacture ID
781 * 7 ~ 0 : Assembly ID
782 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
784 static void alc_subsystem_id(struct hda_codec *codec,
785 unsigned int porta, unsigned int porte,
788 unsigned int ass, tmp, i;
790 struct alc_spec *spec = codec->spec;
792 ass = codec->subsystem_id & 0xffff;
793 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
797 * 31~30 : port conetcivity
800 * 19~16 : Check sum (15:1)
805 if (codec->vendor_id == 0x10ec0260)
807 ass = snd_hda_codec_read(codec, nid, 0,
808 AC_VERB_GET_CONFIG_DEFAULT, 0);
809 if (!(ass & 1) && !(ass & 0x100000))
811 if ((ass >> 30) != 1) /* no physical connection */
816 for (i = 1; i < 16; i++) {
820 if (((ass >> 16) & 0xf) != tmp)
826 * 2 : 0 --> Desktop, 1 --> Laptop
827 * 3~5 : External Amplifier control
830 tmp = (ass & 0x38) >> 3; /* external Amp control */
833 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
836 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
839 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
841 case 5: /* set EAPD output high */
842 switch (codec->vendor_id) {
844 snd_hda_codec_write(codec, 0x0f, 0,
845 AC_VERB_SET_EAPD_BTLENABLE, 2);
846 snd_hda_codec_write(codec, 0x10, 0,
847 AC_VERB_SET_EAPD_BTLENABLE, 2);
855 snd_hda_codec_write(codec, 0x14, 0,
856 AC_VERB_SET_EAPD_BTLENABLE, 2);
857 snd_hda_codec_write(codec, 0x15, 0,
858 AC_VERB_SET_EAPD_BTLENABLE, 2);
861 switch (codec->vendor_id) {
863 snd_hda_codec_write(codec, 0x1a, 0,
864 AC_VERB_SET_COEF_INDEX, 7);
865 tmp = snd_hda_codec_read(codec, 0x1a, 0,
866 AC_VERB_GET_PROC_COEF, 0);
867 snd_hda_codec_write(codec, 0x1a, 0,
868 AC_VERB_SET_COEF_INDEX, 7);
869 snd_hda_codec_write(codec, 0x1a, 0,
870 AC_VERB_SET_PROC_COEF,
879 snd_hda_codec_write(codec, 0x20, 0,
880 AC_VERB_SET_COEF_INDEX, 7);
881 tmp = snd_hda_codec_read(codec, 0x20, 0,
882 AC_VERB_GET_PROC_COEF, 0);
883 snd_hda_codec_write(codec, 0x20, 0,
884 AC_VERB_SET_COEF_INDEX, 7);
885 snd_hda_codec_write(codec, 0x20, 0,
886 AC_VERB_SET_PROC_COEF,
891 snd_hda_codec_write(codec, 0x20, 0,
892 AC_VERB_SET_COEF_INDEX, 7);
893 tmp = snd_hda_codec_read(codec, 0x20, 0,
894 AC_VERB_GET_PROC_COEF, 0);
895 snd_hda_codec_write(codec, 0x20, 0,
896 AC_VERB_SET_COEF_INDEX, 7);
897 snd_hda_codec_write(codec, 0x20, 0,
898 AC_VERB_SET_PROC_COEF,
906 /* is laptop or Desktop and enable the function "Mute internal speaker
907 * when the external headphone out jack is plugged"
912 * 10~8 : Jack location
913 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
915 * 15 : 1 --> enable the function "Mute internal speaker
916 * when the external headphone out jack is plugged"
918 if (!spec->autocfg.speaker_pins[0]) {
919 if (spec->autocfg.line_out_pins[0])
920 spec->autocfg.speaker_pins[0] =
921 spec->autocfg.line_out_pins[0];
926 if (!spec->autocfg.hp_pins[0]) {
927 tmp = (ass >> 11) & 0x3; /* HP to chassis */
929 spec->autocfg.hp_pins[0] = porta;
931 spec->autocfg.hp_pins[0] = porte;
933 spec->autocfg.hp_pins[0] = portd;
938 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
939 AC_VERB_SET_UNSOLICITED_ENABLE,
940 AC_USRSP_EN | ALC880_HP_EVENT);
941 spec->unsol_event = alc_sku_unsol_event;
942 spec->init_hook = alc_sku_automute;
946 * Fix-up pin default configurations
954 static void alc_fix_pincfg(struct hda_codec *codec,
955 const struct snd_pci_quirk *quirk,
956 const struct alc_pincfg **pinfix)
958 const struct alc_pincfg *cfg;
960 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
964 cfg = pinfix[quirk->value];
965 for (; cfg->nid; cfg++) {
968 for (i = 0; i < 4; i++) {
969 snd_hda_codec_write(codec, cfg->nid, 0,
970 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
978 * ALC880 3-stack model
980 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
981 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
982 * F-Mic = 0x1b, HP = 0x19
985 static hda_nid_t alc880_dac_nids[4] = {
986 /* front, rear, clfe, rear_surr */
987 0x02, 0x05, 0x04, 0x03
990 static hda_nid_t alc880_adc_nids[3] = {
995 /* The datasheet says the node 0x07 is connected from inputs,
996 * but it shows zero connection in the real implementation on some devices.
997 * Note: this is a 915GAV bug, fixed on 915GLV
999 static hda_nid_t alc880_adc_nids_alt[2] = {
1004 #define ALC880_DIGOUT_NID 0x06
1005 #define ALC880_DIGIN_NID 0x0a
1007 static struct hda_input_mux alc880_capture_source = {
1011 { "Front Mic", 0x3 },
1017 /* channel source setting (2/6 channel selection for 3-stack) */
1019 static struct hda_verb alc880_threestack_ch2_init[] = {
1020 /* set line-in to input, mute it */
1021 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1022 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1023 /* set mic-in to input vref 80%, mute it */
1024 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1025 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1030 static struct hda_verb alc880_threestack_ch6_init[] = {
1031 /* set line-in to output, unmute it */
1032 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1033 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1034 /* set mic-in to output, unmute it */
1035 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1036 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1040 static struct hda_channel_mode alc880_threestack_modes[2] = {
1041 { 2, alc880_threestack_ch2_init },
1042 { 6, alc880_threestack_ch6_init },
1045 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1046 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1047 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1048 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1049 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1050 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1051 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1052 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1053 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1054 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1055 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1060 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1061 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1062 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1063 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1067 .name = "Channel Mode",
1068 .info = alc_ch_mode_info,
1069 .get = alc_ch_mode_get,
1070 .put = alc_ch_mode_put,
1075 /* capture mixer elements */
1076 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1077 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1078 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1079 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1080 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1081 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1082 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1084 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1085 /* The multiple "Capture Source" controls confuse alsamixer
1086 * So call somewhat different..
1088 /* .name = "Capture Source", */
1089 .name = "Input Source",
1091 .info = alc_mux_enum_info,
1092 .get = alc_mux_enum_get,
1093 .put = alc_mux_enum_put,
1098 /* capture mixer elements (in case NID 0x07 not available) */
1099 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1100 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1101 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1102 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1103 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1106 /* The multiple "Capture Source" controls confuse alsamixer
1107 * So call somewhat different..
1109 /* .name = "Capture Source", */
1110 .name = "Input Source",
1112 .info = alc_mux_enum_info,
1113 .get = alc_mux_enum_get,
1114 .put = alc_mux_enum_put,
1122 * ALC880 5-stack model
1124 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1126 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1127 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1130 /* additional mixers to alc880_three_stack_mixer */
1131 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1132 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1133 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1137 /* channel source setting (6/8 channel selection for 5-stack) */
1139 static struct hda_verb alc880_fivestack_ch6_init[] = {
1140 /* set line-in to input, mute it */
1141 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1142 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1147 static struct hda_verb alc880_fivestack_ch8_init[] = {
1148 /* set line-in to output, unmute it */
1149 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1150 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1154 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1155 { 6, alc880_fivestack_ch6_init },
1156 { 8, alc880_fivestack_ch8_init },
1161 * ALC880 6-stack model
1163 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1164 * Side = 0x05 (0x0f)
1165 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1166 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1169 static hda_nid_t alc880_6st_dac_nids[4] = {
1170 /* front, rear, clfe, rear_surr */
1171 0x02, 0x03, 0x04, 0x05
1174 static struct hda_input_mux alc880_6stack_capture_source = {
1178 { "Front Mic", 0x1 },
1184 /* fixed 8-channels */
1185 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1189 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1191 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1192 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1193 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1194 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1195 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1196 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1197 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1198 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1199 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1203 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1206 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1207 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1208 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1209 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1212 .name = "Channel Mode",
1213 .info = alc_ch_mode_info,
1214 .get = alc_ch_mode_get,
1215 .put = alc_ch_mode_put,
1224 * W810 has rear IO for:
1227 * Center/LFE (DAC 04)
1230 * The system also has a pair of internal speakers, and a headphone jack.
1231 * These are both connected to Line2 on the codec, hence to DAC 02.
1233 * There is a variable resistor to control the speaker or headphone
1234 * volume. This is a hardware-only device without a software API.
1236 * Plugging headphones in will disable the internal speakers. This is
1237 * implemented in hardware, not via the driver using jack sense. In
1238 * a similar fashion, plugging into the rear socket marked "front" will
1239 * disable both the speakers and headphones.
1241 * For input, there's a microphone jack, and an "audio in" jack.
1242 * These may not do anything useful with this driver yet, because I
1243 * haven't setup any initialization verbs for these yet...
1246 static hda_nid_t alc880_w810_dac_nids[3] = {
1247 /* front, rear/surround, clfe */
1251 /* fixed 6 channels */
1252 static struct hda_channel_mode alc880_w810_modes[1] = {
1256 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1257 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1260 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1261 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1262 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1264 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1265 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1274 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1275 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1279 static hda_nid_t alc880_z71v_dac_nids[1] = {
1282 #define ALC880_Z71V_HP_DAC 0x03
1284 /* fixed 2 channels */
1285 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1289 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1292 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1293 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1295 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1303 * ALC880 F1734 model
1305 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1306 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1309 static hda_nid_t alc880_f1734_dac_nids[1] = {
1312 #define ALC880_F1734_HP_DAC 0x02
1314 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1315 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1316 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1317 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1318 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1330 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1331 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1332 * Mic = 0x18, Line = 0x1a
1335 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1336 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1338 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1339 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1340 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1341 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1342 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1343 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1344 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1345 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1346 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1355 .name = "Channel Mode",
1356 .info = alc_ch_mode_info,
1357 .get = alc_ch_mode_get,
1358 .put = alc_ch_mode_put,
1364 * ALC880 ASUS W1V model
1366 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1367 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1368 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1371 /* additional mixers to alc880_asus_mixer */
1372 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1373 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1374 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1378 /* additional mixers to alc880_asus_mixer */
1379 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1380 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1381 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1386 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1387 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1388 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1389 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1391 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1394 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1395 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1398 /* The multiple "Capture Source" controls confuse alsamixer
1399 * So call somewhat different..
1401 /* .name = "Capture Source", */
1402 .name = "Input Source",
1404 .info = alc_mux_enum_info,
1405 .get = alc_mux_enum_get,
1406 .put = alc_mux_enum_put,
1412 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1413 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1414 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1415 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1416 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1417 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1418 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1419 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1420 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1421 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1422 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1423 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1424 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1425 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1426 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1428 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1429 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1430 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1432 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1433 .name = "Channel Mode",
1434 .info = alc_ch_mode_info,
1435 .get = alc_ch_mode_get,
1436 .put = alc_ch_mode_put,
1441 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1442 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1443 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1444 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1445 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1446 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1447 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1448 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1449 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1450 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1451 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1455 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1456 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1457 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1459 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1466 * virtual master controls
1470 * slave controls for virtual master
1472 static const char *alc_slave_vols[] = {
1473 "Front Playback Volume",
1474 "Surround Playback Volume",
1475 "Center Playback Volume",
1476 "LFE Playback Volume",
1477 "Side Playback Volume",
1478 "Headphone Playback Volume",
1479 "Speaker Playback Volume",
1480 "Mono Playback Volume",
1481 "Line-Out Playback Volume",
1485 static const char *alc_slave_sws[] = {
1486 "Front Playback Switch",
1487 "Surround Playback Switch",
1488 "Center Playback Switch",
1489 "LFE Playback Switch",
1490 "Side Playback Switch",
1491 "Headphone Playback Switch",
1492 "Speaker Playback Switch",
1493 "Mono Playback Switch",
1498 * build control elements
1500 static int alc_build_controls(struct hda_codec *codec)
1502 struct alc_spec *spec = codec->spec;
1506 for (i = 0; i < spec->num_mixers; i++) {
1507 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1512 if (spec->multiout.dig_out_nid) {
1513 err = snd_hda_create_spdif_out_ctls(codec,
1514 spec->multiout.dig_out_nid);
1518 if (spec->dig_in_nid) {
1519 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1524 /* if we have no master control, let's create it */
1525 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1526 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1527 HDA_OUTPUT, spec->vmaster_tlv);
1528 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1529 spec->vmaster_tlv, alc_slave_vols);
1533 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1534 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1535 NULL, alc_slave_sws);
1545 * initialize the codec volumes, etc
1549 * generic initialization of ADC, input mixers and output mixers
1551 static struct hda_verb alc880_volume_init_verbs[] = {
1553 * Unmute ADC0-2 and set the default input to mic-in
1555 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1557 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1559 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1560 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1562 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1564 * Note: PASD motherboards uses the Line In 2 as the input for front
1567 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1577 * Set up output mixers (0x0c - 0x0f)
1579 /* set vol=0 to output mixers */
1580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1581 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1582 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1583 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1584 /* set up input amps for analog loopback */
1585 /* Amp Indices: DAC = 0, mixer = 1 */
1586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1590 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1592 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1599 * 3-stack pin configuration:
1600 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1602 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1604 * preset connection lists of input pins
1605 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1607 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1608 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1609 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1612 * Set pin mode and muting
1614 /* set front pin widgets 0x14 for output */
1615 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1616 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1617 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1620 /* Mic2 (as headphone out) for HP output */
1621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1623 /* Line In pin widget for input */
1624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1626 /* Line2 (as front mic) pin widget for input and vref at 80% */
1627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1629 /* CD pin widget for input */
1630 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1636 * 5-stack pin configuration:
1637 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1638 * line-in/side = 0x1a, f-mic = 0x1b
1640 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1642 * preset connection lists of input pins
1643 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1645 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1646 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1649 * Set pin mode and muting
1651 /* set pin widgets 0x14-0x17 for output */
1652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1653 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1654 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1656 /* unmute pins for output (no gain on this amp) */
1657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1658 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1662 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1663 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1664 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1665 /* Mic2 (as headphone out) for HP output */
1666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1667 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1668 /* Line In pin widget for input */
1669 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1670 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1671 /* Line2 (as front mic) pin widget for input and vref at 80% */
1672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1673 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1674 /* CD pin widget for input */
1675 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1681 * W810 pin configuration:
1682 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1684 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1685 /* hphone/speaker input selector: front DAC */
1686 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1695 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1696 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1702 * Z71V pin configuration:
1703 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1705 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1707 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1709 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1712 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1713 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1714 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1720 * 6-stack pin configuration:
1721 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1722 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1724 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1725 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1728 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1733 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1734 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1736 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1737 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1738 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1739 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1740 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1742 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1743 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1744 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1750 * Uniwill pin configuration:
1751 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1754 static struct hda_verb alc880_uniwill_init_verbs[] = {
1755 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1759 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1760 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1761 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1762 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1763 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1764 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1767 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1768 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1769 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1770 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1772 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1774 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1775 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1778 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1779 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1780 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1782 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1783 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1790 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1792 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1793 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1797 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1798 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1799 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1800 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1802 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1806 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1808 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1809 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1812 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1813 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1815 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1816 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1821 static struct hda_verb alc880_beep_init_verbs[] = {
1822 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1826 /* toggle speaker-output according to the hp-jack state */
1827 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1829 unsigned int present;
1832 present = snd_hda_codec_read(codec, 0x14, 0,
1833 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1834 bits = present ? HDA_AMP_MUTE : 0;
1835 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1836 HDA_AMP_MUTE, bits);
1837 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1838 HDA_AMP_MUTE, bits);
1841 /* auto-toggle front mic */
1842 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1844 unsigned int present;
1847 present = snd_hda_codec_read(codec, 0x18, 0,
1848 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1849 bits = present ? HDA_AMP_MUTE : 0;
1850 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1853 static void alc880_uniwill_automute(struct hda_codec *codec)
1855 alc880_uniwill_hp_automute(codec);
1856 alc880_uniwill_mic_automute(codec);
1859 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1862 /* Looks like the unsol event is incompatible with the standard
1863 * definition. 4bit tag is placed at 28 bit!
1865 switch (res >> 28) {
1866 case ALC880_HP_EVENT:
1867 alc880_uniwill_hp_automute(codec);
1869 case ALC880_MIC_EVENT:
1870 alc880_uniwill_mic_automute(codec);
1875 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1877 unsigned int present;
1880 present = snd_hda_codec_read(codec, 0x14, 0,
1881 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1882 bits = present ? HDA_AMP_MUTE : 0;
1883 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1886 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1888 unsigned int present;
1890 present = snd_hda_codec_read(codec, 0x21, 0,
1891 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1892 present &= HDA_AMP_VOLMASK;
1893 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1894 HDA_AMP_VOLMASK, present);
1895 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1896 HDA_AMP_VOLMASK, present);
1899 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1902 /* Looks like the unsol event is incompatible with the standard
1903 * definition. 4bit tag is placed at 28 bit!
1905 if ((res >> 28) == ALC880_HP_EVENT)
1906 alc880_uniwill_p53_hp_automute(codec);
1907 if ((res >> 28) == ALC880_DCVOL_EVENT)
1908 alc880_uniwill_p53_dcvol_automute(codec);
1912 * F1734 pin configuration:
1913 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1915 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1916 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1917 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1918 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1919 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1922 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1923 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1926 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1927 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1928 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1929 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1930 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1931 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1932 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1934 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1940 * ASUS pin configuration:
1941 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1943 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1944 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1945 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1946 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1947 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1949 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1951 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1952 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1953 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1955 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1956 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1958 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1959 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1960 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1961 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1962 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1963 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1966 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1971 /* Enable GPIO mask and set output */
1972 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1973 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1975 /* Clevo m520g init */
1976 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1977 /* headphone output */
1978 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1981 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1983 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1984 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1986 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1987 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 /* Mic1 (rear panel) */
1989 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1990 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1991 /* Mic2 (front panel) */
1992 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1993 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1995 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1996 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1997 /* change to EAPD mode */
1998 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1999 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2004 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2005 /* change to EAPD mode */
2006 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2007 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2009 /* Headphone output */
2010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2012 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2013 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2015 /* Line In pin widget for input */
2016 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2017 /* CD pin widget for input */
2018 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2019 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2020 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2022 /* change to EAPD mode */
2023 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2024 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2030 * LG m1 express dual
2033 * Rear Line-In/Out (blue): 0x14
2034 * Build-in Mic-In: 0x15
2036 * HP-Out (green): 0x1b
2037 * Mic-In/Out (red): 0x19
2041 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2042 static hda_nid_t alc880_lg_dac_nids[3] = {
2046 /* seems analog CD is not working */
2047 static struct hda_input_mux alc880_lg_capture_source = {
2052 { "Internal Mic", 0x6 },
2056 /* 2,4,6 channel modes */
2057 static struct hda_verb alc880_lg_ch2_init[] = {
2058 /* set line-in and mic-in to input */
2059 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2060 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2064 static struct hda_verb alc880_lg_ch4_init[] = {
2065 /* set line-in to out and mic-in to input */
2066 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2067 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2071 static struct hda_verb alc880_lg_ch6_init[] = {
2072 /* set line-in and mic-in to output */
2073 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2074 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2078 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2079 { 2, alc880_lg_ch2_init },
2080 { 4, alc880_lg_ch4_init },
2081 { 6, alc880_lg_ch6_init },
2084 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2085 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2086 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2087 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2088 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2089 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2090 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2091 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2092 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2097 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2098 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2100 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2101 .name = "Channel Mode",
2102 .info = alc_ch_mode_info,
2103 .get = alc_ch_mode_get,
2104 .put = alc_ch_mode_put,
2109 static struct hda_verb alc880_lg_init_verbs[] = {
2110 /* set capture source to mic-in */
2111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2112 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2113 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2114 /* mute all amp mixer inputs */
2115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2118 /* line-in to input */
2119 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2120 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2122 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2123 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2125 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2126 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2127 /* mic-in to input */
2128 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2129 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2130 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2132 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2133 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2134 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2136 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2140 /* toggle speaker-output according to the hp-jack state */
2141 static void alc880_lg_automute(struct hda_codec *codec)
2143 unsigned int present;
2146 present = snd_hda_codec_read(codec, 0x1b, 0,
2147 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2148 bits = present ? HDA_AMP_MUTE : 0;
2149 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2150 HDA_AMP_MUTE, bits);
2153 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2155 /* Looks like the unsol event is incompatible with the standard
2156 * definition. 4bit tag is placed at 28 bit!
2158 if ((res >> 28) == 0x01)
2159 alc880_lg_automute(codec);
2168 * Built-in Mic-In: 0x19
2174 static struct hda_input_mux alc880_lg_lw_capture_source = {
2178 { "Internal Mic", 0x1 },
2183 #define alc880_lg_lw_modes alc880_threestack_modes
2185 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2186 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2187 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2188 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2189 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2190 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2191 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2192 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2193 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2199 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2201 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2202 .name = "Channel Mode",
2203 .info = alc_ch_mode_info,
2204 .get = alc_ch_mode_get,
2205 .put = alc_ch_mode_put,
2210 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2211 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2212 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2213 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2215 /* set capture source to mic-in */
2216 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2217 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2221 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2222 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2225 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2226 /* mic-in to input */
2227 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2233 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2237 /* toggle speaker-output according to the hp-jack state */
2238 static void alc880_lg_lw_automute(struct hda_codec *codec)
2240 unsigned int present;
2243 present = snd_hda_codec_read(codec, 0x1b, 0,
2244 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2245 bits = present ? HDA_AMP_MUTE : 0;
2246 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2247 HDA_AMP_MUTE, bits);
2250 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2252 /* Looks like the unsol event is incompatible with the standard
2253 * definition. 4bit tag is placed at 28 bit!
2255 if ((res >> 28) == 0x01)
2256 alc880_lg_lw_automute(codec);
2259 #ifdef CONFIG_SND_HDA_POWER_SAVE
2260 static struct hda_amp_list alc880_loopbacks[] = {
2261 { 0x0b, HDA_INPUT, 0 },
2262 { 0x0b, HDA_INPUT, 1 },
2263 { 0x0b, HDA_INPUT, 2 },
2264 { 0x0b, HDA_INPUT, 3 },
2265 { 0x0b, HDA_INPUT, 4 },
2269 static struct hda_amp_list alc880_lg_loopbacks[] = {
2270 { 0x0b, HDA_INPUT, 1 },
2271 { 0x0b, HDA_INPUT, 6 },
2272 { 0x0b, HDA_INPUT, 7 },
2281 static int alc_init(struct hda_codec *codec)
2283 struct alc_spec *spec = codec->spec;
2286 for (i = 0; i < spec->num_init_verbs; i++)
2287 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2289 if (spec->init_hook)
2290 spec->init_hook(codec);
2295 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2297 struct alc_spec *spec = codec->spec;
2299 if (spec->unsol_event)
2300 spec->unsol_event(codec, res);
2303 #ifdef CONFIG_SND_HDA_POWER_SAVE
2304 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2306 struct alc_spec *spec = codec->spec;
2307 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2312 * Analog playback callbacks
2314 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2315 struct hda_codec *codec,
2316 struct snd_pcm_substream *substream)
2318 struct alc_spec *spec = codec->spec;
2319 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2322 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2323 struct hda_codec *codec,
2324 unsigned int stream_tag,
2325 unsigned int format,
2326 struct snd_pcm_substream *substream)
2328 struct alc_spec *spec = codec->spec;
2329 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2330 stream_tag, format, substream);
2333 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2334 struct hda_codec *codec,
2335 struct snd_pcm_substream *substream)
2337 struct alc_spec *spec = codec->spec;
2338 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2344 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2345 struct hda_codec *codec,
2346 struct snd_pcm_substream *substream)
2348 struct alc_spec *spec = codec->spec;
2349 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2352 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2353 struct hda_codec *codec,
2354 unsigned int stream_tag,
2355 unsigned int format,
2356 struct snd_pcm_substream *substream)
2358 struct alc_spec *spec = codec->spec;
2359 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2360 stream_tag, format, substream);
2363 static int alc880_dig_playback_pcm_close(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_close(codec, &spec->multiout);
2374 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2375 struct hda_codec *codec,
2376 unsigned int stream_tag,
2377 unsigned int format,
2378 struct snd_pcm_substream *substream)
2380 struct alc_spec *spec = codec->spec;
2382 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2383 stream_tag, 0, format);
2387 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2388 struct hda_codec *codec,
2389 struct snd_pcm_substream *substream)
2391 struct alc_spec *spec = codec->spec;
2393 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2401 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2405 /* NID is set in alc_build_pcms */
2407 .open = alc880_playback_pcm_open,
2408 .prepare = alc880_playback_pcm_prepare,
2409 .cleanup = alc880_playback_pcm_cleanup
2413 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2417 /* NID is set in alc_build_pcms */
2420 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2424 /* NID is set in alc_build_pcms */
2427 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2428 .substreams = 2, /* can be overridden */
2431 /* NID is set in alc_build_pcms */
2433 .prepare = alc880_alt_capture_pcm_prepare,
2434 .cleanup = alc880_alt_capture_pcm_cleanup
2438 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2442 /* NID is set in alc_build_pcms */
2444 .open = alc880_dig_playback_pcm_open,
2445 .close = alc880_dig_playback_pcm_close,
2446 .prepare = alc880_dig_playback_pcm_prepare
2450 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2454 /* NID is set in alc_build_pcms */
2457 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2458 static struct hda_pcm_stream alc_pcm_null_stream = {
2464 static int alc_build_pcms(struct hda_codec *codec)
2466 struct alc_spec *spec = codec->spec;
2467 struct hda_pcm *info = spec->pcm_rec;
2470 codec->num_pcms = 1;
2471 codec->pcm_info = info;
2473 info->name = spec->stream_name_analog;
2474 if (spec->stream_analog_playback) {
2475 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2476 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2477 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2479 if (spec->stream_analog_capture) {
2480 snd_assert(spec->adc_nids, return -EINVAL);
2481 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2482 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2485 if (spec->channel_mode) {
2486 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2487 for (i = 0; i < spec->num_channel_mode; i++) {
2488 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2489 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2494 /* SPDIF for stream index #1 */
2495 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2496 codec->num_pcms = 2;
2497 info = spec->pcm_rec + 1;
2498 info->name = spec->stream_name_digital;
2499 if (spec->multiout.dig_out_nid &&
2500 spec->stream_digital_playback) {
2501 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2502 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2504 if (spec->dig_in_nid &&
2505 spec->stream_digital_capture) {
2506 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2507 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2511 /* If the use of more than one ADC is requested for the current
2512 * model, configure a second analog capture-only PCM.
2514 /* Additional Analaog capture for index #2 */
2515 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2516 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2517 codec->num_pcms = 3;
2518 info = spec->pcm_rec + 2;
2519 info->name = spec->stream_name_analog;
2520 if (spec->alt_dac_nid) {
2521 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2522 *spec->stream_analog_alt_playback;
2523 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2526 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2527 alc_pcm_null_stream;
2528 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2530 if (spec->num_adc_nids > 1) {
2531 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2532 *spec->stream_analog_alt_capture;
2533 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2535 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2536 spec->num_adc_nids - 1;
2538 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2539 alc_pcm_null_stream;
2540 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2547 static void alc_free(struct hda_codec *codec)
2549 struct alc_spec *spec = codec->spec;
2555 if (spec->kctl_alloc) {
2556 for (i = 0; i < spec->num_kctl_used; i++)
2557 kfree(spec->kctl_alloc[i].name);
2558 kfree(spec->kctl_alloc);
2565 static struct hda_codec_ops alc_patch_ops = {
2566 .build_controls = alc_build_controls,
2567 .build_pcms = alc_build_pcms,
2570 .unsol_event = alc_unsol_event,
2571 #ifdef CONFIG_SND_HDA_POWER_SAVE
2572 .check_power_status = alc_check_power_status,
2578 * Test configuration for debugging
2580 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2583 #ifdef CONFIG_SND_DEBUG
2584 static hda_nid_t alc880_test_dac_nids[4] = {
2585 0x02, 0x03, 0x04, 0x05
2588 static struct hda_input_mux alc880_test_capture_source = {
2597 { "Surround", 0x6 },
2601 static struct hda_channel_mode alc880_test_modes[4] = {
2608 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2609 struct snd_ctl_elem_info *uinfo)
2611 static char *texts[] = {
2612 "N/A", "Line Out", "HP Out",
2613 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2615 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2617 uinfo->value.enumerated.items = 8;
2618 if (uinfo->value.enumerated.item >= 8)
2619 uinfo->value.enumerated.item = 7;
2620 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2624 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2625 struct snd_ctl_elem_value *ucontrol)
2627 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2628 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2629 unsigned int pin_ctl, item = 0;
2631 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2632 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2633 if (pin_ctl & AC_PINCTL_OUT_EN) {
2634 if (pin_ctl & AC_PINCTL_HP_EN)
2638 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2639 switch (pin_ctl & AC_PINCTL_VREFEN) {
2640 case AC_PINCTL_VREF_HIZ: item = 3; break;
2641 case AC_PINCTL_VREF_50: item = 4; break;
2642 case AC_PINCTL_VREF_GRD: item = 5; break;
2643 case AC_PINCTL_VREF_80: item = 6; break;
2644 case AC_PINCTL_VREF_100: item = 7; break;
2647 ucontrol->value.enumerated.item[0] = item;
2651 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2652 struct snd_ctl_elem_value *ucontrol)
2654 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2655 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2656 static unsigned int ctls[] = {
2657 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2658 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2659 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2660 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2661 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2662 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2664 unsigned int old_ctl, new_ctl;
2666 old_ctl = snd_hda_codec_read(codec, nid, 0,
2667 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2668 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2669 if (old_ctl != new_ctl) {
2671 snd_hda_codec_write_cache(codec, nid, 0,
2672 AC_VERB_SET_PIN_WIDGET_CONTROL,
2674 val = ucontrol->value.enumerated.item[0] >= 3 ?
2676 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2683 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2684 struct snd_ctl_elem_info *uinfo)
2686 static char *texts[] = {
2687 "Front", "Surround", "CLFE", "Side"
2689 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2691 uinfo->value.enumerated.items = 4;
2692 if (uinfo->value.enumerated.item >= 4)
2693 uinfo->value.enumerated.item = 3;
2694 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2698 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2699 struct snd_ctl_elem_value *ucontrol)
2701 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2702 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2705 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2706 ucontrol->value.enumerated.item[0] = sel & 3;
2710 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2711 struct snd_ctl_elem_value *ucontrol)
2713 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2714 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2717 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2718 if (ucontrol->value.enumerated.item[0] != sel) {
2719 sel = ucontrol->value.enumerated.item[0] & 3;
2720 snd_hda_codec_write_cache(codec, nid, 0,
2721 AC_VERB_SET_CONNECT_SEL, sel);
2727 #define PIN_CTL_TEST(xname,nid) { \
2728 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2730 .info = alc_test_pin_ctl_info, \
2731 .get = alc_test_pin_ctl_get, \
2732 .put = alc_test_pin_ctl_put, \
2733 .private_value = nid \
2736 #define PIN_SRC_TEST(xname,nid) { \
2737 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2739 .info = alc_test_pin_src_info, \
2740 .get = alc_test_pin_src_get, \
2741 .put = alc_test_pin_src_put, \
2742 .private_value = nid \
2745 static struct snd_kcontrol_new alc880_test_mixer[] = {
2746 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2747 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2748 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2749 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2750 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2751 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2752 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2753 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2754 PIN_CTL_TEST("Front Pin Mode", 0x14),
2755 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2756 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2757 PIN_CTL_TEST("Side Pin Mode", 0x17),
2758 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2759 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2760 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2761 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2762 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2763 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2764 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2765 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2766 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2767 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2768 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2769 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2770 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2771 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2772 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2773 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2774 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2775 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2778 .name = "Channel Mode",
2779 .info = alc_ch_mode_info,
2780 .get = alc_ch_mode_get,
2781 .put = alc_ch_mode_put,
2786 static struct hda_verb alc880_test_init_verbs[] = {
2787 /* Unmute inputs of 0x0c - 0x0f */
2788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2789 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2790 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2791 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2792 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2793 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2794 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2795 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2796 /* Vol output for 0x0c-0x0f */
2797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2798 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2799 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2801 /* Set output pins 0x14-0x17 */
2802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2804 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 /* Unmute output pins 0x14-0x17 */
2807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2809 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 /* Set input pins 0x18-0x1c */
2812 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2814 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2815 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2816 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2817 /* Mute input pins 0x18-0x1b */
2818 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2820 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2821 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2824 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2826 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2828 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2829 /* Analog input/passthru */
2830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2842 static const char *alc880_models[ALC880_MODEL_LAST] = {
2843 [ALC880_3ST] = "3stack",
2844 [ALC880_TCL_S700] = "tcl",
2845 [ALC880_3ST_DIG] = "3stack-digout",
2846 [ALC880_CLEVO] = "clevo",
2847 [ALC880_5ST] = "5stack",
2848 [ALC880_5ST_DIG] = "5stack-digout",
2849 [ALC880_W810] = "w810",
2850 [ALC880_Z71V] = "z71v",
2851 [ALC880_6ST] = "6stack",
2852 [ALC880_6ST_DIG] = "6stack-digout",
2853 [ALC880_ASUS] = "asus",
2854 [ALC880_ASUS_W1V] = "asus-w1v",
2855 [ALC880_ASUS_DIG] = "asus-dig",
2856 [ALC880_ASUS_DIG2] = "asus-dig2",
2857 [ALC880_UNIWILL_DIG] = "uniwill",
2858 [ALC880_UNIWILL_P53] = "uniwill-p53",
2859 [ALC880_FUJITSU] = "fujitsu",
2860 [ALC880_F1734] = "F1734",
2862 [ALC880_LG_LW] = "lg-lw",
2863 #ifdef CONFIG_SND_DEBUG
2864 [ALC880_TEST] = "test",
2866 [ALC880_AUTO] = "auto",
2869 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2870 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2871 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2872 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2873 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2874 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2875 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2876 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2877 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2878 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2879 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2880 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2881 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2882 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2883 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2884 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2885 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2886 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2887 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2888 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2889 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2890 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2891 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2892 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2893 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2894 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2895 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2896 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2897 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2898 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2899 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2900 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2901 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2902 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2903 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2904 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2905 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2906 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2907 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2908 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2909 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2910 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2911 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2912 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2913 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2914 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2915 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2916 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2917 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2918 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2919 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2920 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2921 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2922 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2923 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2924 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2925 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2926 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2927 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2928 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2929 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2930 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2931 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2932 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2933 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2934 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2935 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2936 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2937 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2938 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2943 * ALC880 codec presets
2945 static struct alc_config_preset alc880_presets[] = {
2947 .mixers = { alc880_three_stack_mixer },
2948 .init_verbs = { alc880_volume_init_verbs,
2949 alc880_pin_3stack_init_verbs },
2950 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2951 .dac_nids = alc880_dac_nids,
2952 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2953 .channel_mode = alc880_threestack_modes,
2955 .input_mux = &alc880_capture_source,
2957 [ALC880_3ST_DIG] = {
2958 .mixers = { alc880_three_stack_mixer },
2959 .init_verbs = { alc880_volume_init_verbs,
2960 alc880_pin_3stack_init_verbs },
2961 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2962 .dac_nids = alc880_dac_nids,
2963 .dig_out_nid = ALC880_DIGOUT_NID,
2964 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2965 .channel_mode = alc880_threestack_modes,
2967 .input_mux = &alc880_capture_source,
2969 [ALC880_TCL_S700] = {
2970 .mixers = { alc880_tcl_s700_mixer },
2971 .init_verbs = { alc880_volume_init_verbs,
2972 alc880_pin_tcl_S700_init_verbs,
2973 alc880_gpio2_init_verbs },
2974 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2975 .dac_nids = alc880_dac_nids,
2977 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2978 .channel_mode = alc880_2_jack_modes,
2979 .input_mux = &alc880_capture_source,
2982 .mixers = { alc880_three_stack_mixer,
2983 alc880_five_stack_mixer},
2984 .init_verbs = { alc880_volume_init_verbs,
2985 alc880_pin_5stack_init_verbs },
2986 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2987 .dac_nids = alc880_dac_nids,
2988 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2989 .channel_mode = alc880_fivestack_modes,
2990 .input_mux = &alc880_capture_source,
2992 [ALC880_5ST_DIG] = {
2993 .mixers = { alc880_three_stack_mixer,
2994 alc880_five_stack_mixer },
2995 .init_verbs = { alc880_volume_init_verbs,
2996 alc880_pin_5stack_init_verbs },
2997 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2998 .dac_nids = alc880_dac_nids,
2999 .dig_out_nid = ALC880_DIGOUT_NID,
3000 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3001 .channel_mode = alc880_fivestack_modes,
3002 .input_mux = &alc880_capture_source,
3005 .mixers = { alc880_six_stack_mixer },
3006 .init_verbs = { alc880_volume_init_verbs,
3007 alc880_pin_6stack_init_verbs },
3008 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3009 .dac_nids = alc880_6st_dac_nids,
3010 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3011 .channel_mode = alc880_sixstack_modes,
3012 .input_mux = &alc880_6stack_capture_source,
3014 [ALC880_6ST_DIG] = {
3015 .mixers = { alc880_six_stack_mixer },
3016 .init_verbs = { alc880_volume_init_verbs,
3017 alc880_pin_6stack_init_verbs },
3018 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3019 .dac_nids = alc880_6st_dac_nids,
3020 .dig_out_nid = ALC880_DIGOUT_NID,
3021 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3022 .channel_mode = alc880_sixstack_modes,
3023 .input_mux = &alc880_6stack_capture_source,
3026 .mixers = { alc880_w810_base_mixer },
3027 .init_verbs = { alc880_volume_init_verbs,
3028 alc880_pin_w810_init_verbs,
3029 alc880_gpio2_init_verbs },
3030 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3031 .dac_nids = alc880_w810_dac_nids,
3032 .dig_out_nid = ALC880_DIGOUT_NID,
3033 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3034 .channel_mode = alc880_w810_modes,
3035 .input_mux = &alc880_capture_source,
3038 .mixers = { alc880_z71v_mixer },
3039 .init_verbs = { alc880_volume_init_verbs,
3040 alc880_pin_z71v_init_verbs },
3041 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3042 .dac_nids = alc880_z71v_dac_nids,
3043 .dig_out_nid = ALC880_DIGOUT_NID,
3045 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3046 .channel_mode = alc880_2_jack_modes,
3047 .input_mux = &alc880_capture_source,
3050 .mixers = { alc880_f1734_mixer },
3051 .init_verbs = { alc880_volume_init_verbs,
3052 alc880_pin_f1734_init_verbs },
3053 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3054 .dac_nids = alc880_f1734_dac_nids,
3056 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3057 .channel_mode = alc880_2_jack_modes,
3058 .input_mux = &alc880_capture_source,
3061 .mixers = { alc880_asus_mixer },
3062 .init_verbs = { alc880_volume_init_verbs,
3063 alc880_pin_asus_init_verbs,
3064 alc880_gpio1_init_verbs },
3065 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3066 .dac_nids = alc880_asus_dac_nids,
3067 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3068 .channel_mode = alc880_asus_modes,
3070 .input_mux = &alc880_capture_source,
3072 [ALC880_ASUS_DIG] = {
3073 .mixers = { alc880_asus_mixer },
3074 .init_verbs = { alc880_volume_init_verbs,
3075 alc880_pin_asus_init_verbs,
3076 alc880_gpio1_init_verbs },
3077 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3078 .dac_nids = alc880_asus_dac_nids,
3079 .dig_out_nid = ALC880_DIGOUT_NID,
3080 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3081 .channel_mode = alc880_asus_modes,
3083 .input_mux = &alc880_capture_source,
3085 [ALC880_ASUS_DIG2] = {
3086 .mixers = { alc880_asus_mixer },
3087 .init_verbs = { alc880_volume_init_verbs,
3088 alc880_pin_asus_init_verbs,
3089 alc880_gpio2_init_verbs }, /* use GPIO2 */
3090 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3091 .dac_nids = alc880_asus_dac_nids,
3092 .dig_out_nid = ALC880_DIGOUT_NID,
3093 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3094 .channel_mode = alc880_asus_modes,
3096 .input_mux = &alc880_capture_source,
3098 [ALC880_ASUS_W1V] = {
3099 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3100 .init_verbs = { alc880_volume_init_verbs,
3101 alc880_pin_asus_init_verbs,
3102 alc880_gpio1_init_verbs },
3103 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3104 .dac_nids = alc880_asus_dac_nids,
3105 .dig_out_nid = ALC880_DIGOUT_NID,
3106 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3107 .channel_mode = alc880_asus_modes,
3109 .input_mux = &alc880_capture_source,
3111 [ALC880_UNIWILL_DIG] = {
3112 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3113 .init_verbs = { alc880_volume_init_verbs,
3114 alc880_pin_asus_init_verbs },
3115 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3116 .dac_nids = alc880_asus_dac_nids,
3117 .dig_out_nid = ALC880_DIGOUT_NID,
3118 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3119 .channel_mode = alc880_asus_modes,
3121 .input_mux = &alc880_capture_source,
3123 [ALC880_UNIWILL] = {
3124 .mixers = { alc880_uniwill_mixer },
3125 .init_verbs = { alc880_volume_init_verbs,
3126 alc880_uniwill_init_verbs },
3127 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3128 .dac_nids = alc880_asus_dac_nids,
3129 .dig_out_nid = ALC880_DIGOUT_NID,
3130 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3131 .channel_mode = alc880_threestack_modes,
3133 .input_mux = &alc880_capture_source,
3134 .unsol_event = alc880_uniwill_unsol_event,
3135 .init_hook = alc880_uniwill_automute,
3137 [ALC880_UNIWILL_P53] = {
3138 .mixers = { alc880_uniwill_p53_mixer },
3139 .init_verbs = { alc880_volume_init_verbs,
3140 alc880_uniwill_p53_init_verbs },
3141 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3142 .dac_nids = alc880_asus_dac_nids,
3143 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3144 .channel_mode = alc880_threestack_modes,
3145 .input_mux = &alc880_capture_source,
3146 .unsol_event = alc880_uniwill_p53_unsol_event,
3147 .init_hook = alc880_uniwill_p53_hp_automute,
3149 [ALC880_FUJITSU] = {
3150 .mixers = { alc880_fujitsu_mixer,
3151 alc880_pcbeep_mixer, },
3152 .init_verbs = { alc880_volume_init_verbs,
3153 alc880_uniwill_p53_init_verbs,
3154 alc880_beep_init_verbs },
3155 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3156 .dac_nids = alc880_dac_nids,
3157 .dig_out_nid = ALC880_DIGOUT_NID,
3158 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3159 .channel_mode = alc880_2_jack_modes,
3160 .input_mux = &alc880_capture_source,
3161 .unsol_event = alc880_uniwill_p53_unsol_event,
3162 .init_hook = alc880_uniwill_p53_hp_automute,
3165 .mixers = { alc880_three_stack_mixer },
3166 .init_verbs = { alc880_volume_init_verbs,
3167 alc880_pin_clevo_init_verbs },
3168 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3169 .dac_nids = alc880_dac_nids,
3171 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3172 .channel_mode = alc880_threestack_modes,
3174 .input_mux = &alc880_capture_source,
3177 .mixers = { alc880_lg_mixer },
3178 .init_verbs = { alc880_volume_init_verbs,
3179 alc880_lg_init_verbs },
3180 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3181 .dac_nids = alc880_lg_dac_nids,
3182 .dig_out_nid = ALC880_DIGOUT_NID,
3183 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3184 .channel_mode = alc880_lg_ch_modes,
3186 .input_mux = &alc880_lg_capture_source,
3187 .unsol_event = alc880_lg_unsol_event,
3188 .init_hook = alc880_lg_automute,
3189 #ifdef CONFIG_SND_HDA_POWER_SAVE
3190 .loopbacks = alc880_lg_loopbacks,
3194 .mixers = { alc880_lg_lw_mixer },
3195 .init_verbs = { alc880_volume_init_verbs,
3196 alc880_lg_lw_init_verbs },
3197 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3198 .dac_nids = alc880_dac_nids,
3199 .dig_out_nid = ALC880_DIGOUT_NID,
3200 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3201 .channel_mode = alc880_lg_lw_modes,
3202 .input_mux = &alc880_lg_lw_capture_source,
3203 .unsol_event = alc880_lg_lw_unsol_event,
3204 .init_hook = alc880_lg_lw_automute,
3206 #ifdef CONFIG_SND_DEBUG
3208 .mixers = { alc880_test_mixer },
3209 .init_verbs = { alc880_test_init_verbs },
3210 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3211 .dac_nids = alc880_test_dac_nids,
3212 .dig_out_nid = ALC880_DIGOUT_NID,
3213 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3214 .channel_mode = alc880_test_modes,
3215 .input_mux = &alc880_test_capture_source,
3221 * Automatic parse of I/O pins from the BIOS configuration
3224 #define NUM_CONTROL_ALLOC 32
3225 #define NUM_VERB_ALLOC 32
3229 ALC_CTL_WIDGET_MUTE,
3232 static struct snd_kcontrol_new alc880_control_templates[] = {
3233 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3234 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3235 HDA_BIND_MUTE(NULL, 0, 0, 0),
3238 /* add dynamic controls */
3239 static int add_control(struct alc_spec *spec, int type, const char *name,
3242 struct snd_kcontrol_new *knew;
3244 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3245 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3247 /* array + terminator */
3248 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3251 if (spec->kctl_alloc) {
3252 memcpy(knew, spec->kctl_alloc,
3253 sizeof(*knew) * spec->num_kctl_alloc);
3254 kfree(spec->kctl_alloc);
3256 spec->kctl_alloc = knew;
3257 spec->num_kctl_alloc = num;
3260 knew = &spec->kctl_alloc[spec->num_kctl_used];
3261 *knew = alc880_control_templates[type];
3262 knew->name = kstrdup(name, GFP_KERNEL);
3265 knew->private_value = val;
3266 spec->num_kctl_used++;
3270 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3271 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3272 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3273 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3274 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3275 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3276 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3277 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3278 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3279 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3280 #define ALC880_PIN_CD_NID 0x1c
3282 /* fill in the dac_nids table from the parsed pin configuration */
3283 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3284 const struct auto_pin_cfg *cfg)
3290 memset(assigned, 0, sizeof(assigned));
3291 spec->multiout.dac_nids = spec->private_dac_nids;
3293 /* check the pins hardwired to audio widget */
3294 for (i = 0; i < cfg->line_outs; i++) {
3295 nid = cfg->line_out_pins[i];
3296 if (alc880_is_fixed_pin(nid)) {
3297 int idx = alc880_fixed_pin_idx(nid);
3298 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3302 /* left pins can be connect to any audio widget */
3303 for (i = 0; i < cfg->line_outs; i++) {
3304 nid = cfg->line_out_pins[i];
3305 if (alc880_is_fixed_pin(nid))
3307 /* search for an empty channel */
3308 for (j = 0; j < cfg->line_outs; j++) {
3310 spec->multiout.dac_nids[i] =
3311 alc880_idx_to_dac(j);
3317 spec->multiout.num_dacs = cfg->line_outs;
3321 /* add playback controls from the parsed DAC table */
3322 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3323 const struct auto_pin_cfg *cfg)
3326 static const char *chname[4] = {
3327 "Front", "Surround", NULL /*CLFE*/, "Side"
3332 for (i = 0; i < cfg->line_outs; i++) {
3333 if (!spec->multiout.dac_nids[i])
3335 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3338 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3339 "Center Playback Volume",
3340 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3344 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3345 "LFE Playback Volume",
3346 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3350 err = add_control(spec, ALC_CTL_BIND_MUTE,
3351 "Center Playback Switch",
3352 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3356 err = add_control(spec, ALC_CTL_BIND_MUTE,
3357 "LFE Playback Switch",
3358 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3363 sprintf(name, "%s Playback Volume", chname[i]);
3364 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3365 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3369 sprintf(name, "%s Playback Switch", chname[i]);
3370 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3371 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3380 /* add playback controls for speaker and HP outputs */
3381 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3391 if (alc880_is_fixed_pin(pin)) {
3392 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3393 /* specify the DAC as the extra output */
3394 if (!spec->multiout.hp_nid)
3395 spec->multiout.hp_nid = nid;
3397 spec->multiout.extra_out_nid[0] = nid;
3398 /* control HP volume/switch on the output mixer amp */
3399 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3400 sprintf(name, "%s Playback Volume", pfx);
3401 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3402 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3405 sprintf(name, "%s Playback Switch", pfx);
3406 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3407 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3410 } else if (alc880_is_multi_pin(pin)) {
3411 /* set manual connection */
3412 /* we have only a switch on HP-out PIN */
3413 sprintf(name, "%s Playback Switch", pfx);
3414 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3415 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3422 /* create input playback/capture controls for the given pin */
3423 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3424 const char *ctlname,
3425 int idx, hda_nid_t mix_nid)
3430 sprintf(name, "%s Playback Volume", ctlname);
3431 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3432 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3435 sprintf(name, "%s Playback Switch", ctlname);
3436 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3437 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3443 /* create playback/capture controls for input pins */
3444 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3445 const struct auto_pin_cfg *cfg)
3447 struct hda_input_mux *imux = &spec->private_imux;
3450 for (i = 0; i < AUTO_PIN_LAST; i++) {
3451 if (alc880_is_input_pin(cfg->input_pins[i])) {
3452 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3453 err = new_analog_input(spec, cfg->input_pins[i],
3454 auto_pin_cfg_labels[i],
3458 imux->items[imux->num_items].label =
3459 auto_pin_cfg_labels[i];
3460 imux->items[imux->num_items].index =
3461 alc880_input_pin_idx(cfg->input_pins[i]);
3468 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3469 hda_nid_t nid, int pin_type,
3473 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3475 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3477 /* need the manual connection? */
3478 if (alc880_is_multi_pin(nid)) {
3479 struct alc_spec *spec = codec->spec;
3480 int idx = alc880_multi_pin_idx(nid);
3481 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3482 AC_VERB_SET_CONNECT_SEL,
3483 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3487 static int get_pin_type(int line_out_type)
3489 if (line_out_type == AUTO_PIN_HP_OUT)
3495 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3497 struct alc_spec *spec = codec->spec;
3500 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3501 for (i = 0; i < spec->autocfg.line_outs; i++) {
3502 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3503 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3504 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3508 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3510 struct alc_spec *spec = codec->spec;
3513 pin = spec->autocfg.speaker_pins[0];
3514 if (pin) /* connect to front */
3515 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3516 pin = spec->autocfg.hp_pins[0];
3517 if (pin) /* connect to front */
3518 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3521 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3523 struct alc_spec *spec = codec->spec;
3526 for (i = 0; i < AUTO_PIN_LAST; i++) {
3527 hda_nid_t nid = spec->autocfg.input_pins[i];
3528 if (alc880_is_input_pin(nid)) {
3529 snd_hda_codec_write(codec, nid, 0,
3530 AC_VERB_SET_PIN_WIDGET_CONTROL,
3531 i <= AUTO_PIN_FRONT_MIC ?
3532 PIN_VREF80 : PIN_IN);
3533 if (nid != ALC880_PIN_CD_NID)
3534 snd_hda_codec_write(codec, nid, 0,
3535 AC_VERB_SET_AMP_GAIN_MUTE,
3541 /* parse the BIOS configuration and set up the alc_spec */
3542 /* return 1 if successful, 0 if the proper config is not found,
3543 * or a negative error code
3545 static int alc880_parse_auto_config(struct hda_codec *codec)
3547 struct alc_spec *spec = codec->spec;
3549 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3551 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3555 if (!spec->autocfg.line_outs)
3556 return 0; /* can't find valid BIOS pin config */
3558 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3561 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3564 err = alc880_auto_create_extra_out(spec,
3565 spec->autocfg.speaker_pins[0],
3569 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3573 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3577 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3579 if (spec->autocfg.dig_out_pin)
3580 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3581 if (spec->autocfg.dig_in_pin)
3582 spec->dig_in_nid = ALC880_DIGIN_NID;
3584 if (spec->kctl_alloc)
3585 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3587 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3589 spec->num_mux_defs = 1;
3590 spec->input_mux = &spec->private_imux;
3595 /* additional initialization for auto-configuration model */
3596 static void alc880_auto_init(struct hda_codec *codec)
3598 alc880_auto_init_multi_out(codec);
3599 alc880_auto_init_extra_out(codec);
3600 alc880_auto_init_analog_input(codec);
3604 * OK, here we have finally the patch for ALC880
3607 static int patch_alc880(struct hda_codec *codec)
3609 struct alc_spec *spec;
3613 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3619 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3622 if (board_config < 0) {
3623 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3624 "trying auto-probe from BIOS...\n");
3625 board_config = ALC880_AUTO;
3628 if (board_config == ALC880_AUTO) {
3629 /* automatic parse from the BIOS config */
3630 err = alc880_parse_auto_config(codec);
3636 "hda_codec: Cannot set up configuration "
3637 "from BIOS. Using 3-stack mode...\n");
3638 board_config = ALC880_3ST;
3642 if (board_config != ALC880_AUTO)
3643 setup_preset(spec, &alc880_presets[board_config]);
3645 spec->stream_name_analog = "ALC880 Analog";
3646 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3647 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3648 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3650 spec->stream_name_digital = "ALC880 Digital";
3651 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3652 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3654 if (!spec->adc_nids && spec->input_mux) {
3655 /* check whether NID 0x07 is valid */
3656 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3658 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3659 if (wcap != AC_WID_AUD_IN) {
3660 spec->adc_nids = alc880_adc_nids_alt;
3661 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3662 spec->mixers[spec->num_mixers] =
3663 alc880_capture_alt_mixer;
3666 spec->adc_nids = alc880_adc_nids;
3667 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3668 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3673 spec->vmaster_nid = 0x0c;
3675 codec->patch_ops = alc_patch_ops;
3676 if (board_config == ALC880_AUTO)
3677 spec->init_hook = alc880_auto_init;
3678 #ifdef CONFIG_SND_HDA_POWER_SAVE
3679 if (!spec->loopback.amplist)
3680 spec->loopback.amplist = alc880_loopbacks;
3691 static hda_nid_t alc260_dac_nids[1] = {
3696 static hda_nid_t alc260_adc_nids[1] = {
3701 static hda_nid_t alc260_adc_nids_alt[1] = {
3706 static hda_nid_t alc260_hp_adc_nids[2] = {
3711 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3712 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3714 static hda_nid_t alc260_dual_adc_nids[2] = {
3719 #define ALC260_DIGOUT_NID 0x03
3720 #define ALC260_DIGIN_NID 0x06
3722 static struct hda_input_mux alc260_capture_source = {
3726 { "Front Mic", 0x1 },
3732 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3733 * headphone jack and the internal CD lines since these are the only pins at
3734 * which audio can appear. For flexibility, also allow the option of
3735 * recording the mixer output on the second ADC (ADC0 doesn't have a
3736 * connection to the mixer output).
3738 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3742 { "Mic/Line", 0x0 },
3744 { "Headphone", 0x2 },
3750 { "Mic/Line", 0x0 },
3752 { "Headphone", 0x2 },
3759 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3760 * the Fujitsu S702x, but jacks are marked differently.
3762 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3769 { "Headphone", 0x5 },
3778 { "Headphone", 0x6 },
3784 * This is just place-holder, so there's something for alc_build_pcms to look
3785 * at when it calculates the maximum number of channels. ALC260 has no mixer
3786 * element which allows changing the channel mode, so the verb list is
3789 static struct hda_channel_mode alc260_modes[1] = {
3794 /* Mixer combinations
3796 * basic: base_output + input + pc_beep + capture
3797 * HP: base_output + input + capture_alt
3798 * HP_3013: hp_3013 + input + capture
3799 * fujitsu: fujitsu + capture
3800 * acer: acer + capture
3803 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3804 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3805 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3806 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3807 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3808 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3809 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3813 static struct snd_kcontrol_new alc260_input_mixer[] = {
3814 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3815 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3816 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3817 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3819 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3820 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3821 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3825 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3826 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3827 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3831 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3832 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3833 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3834 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3835 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3836 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3837 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3838 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3839 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3843 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3844 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3846 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3847 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3848 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3849 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3850 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3851 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3852 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3853 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3854 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3855 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3856 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3857 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3858 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3862 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3863 * versions of the ALC260 don't act on requests to enable mic bias from NID
3864 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3865 * datasheet doesn't mention this restriction. At this stage it's not clear
3866 * whether this behaviour is intentional or is a hardware bug in chip
3867 * revisions available in early 2006. Therefore for now allow the
3868 * "Headphone Jack Mode" control to span all choices, but if it turns out
3869 * that the lack of mic bias for this NID is intentional we could change the
3870 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3872 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3873 * don't appear to make the mic bias available from the "line" jack, even
3874 * though the NID used for this jack (0x14) can supply it. The theory is
3875 * that perhaps Acer have included blocking capacitors between the ALC260
3876 * and the output jack. If this turns out to be the case for all such
3877 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3878 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3880 * The C20x Tablet series have a mono internal speaker which is controlled
3881 * via the chip's Mono sum widget and pin complex, so include the necessary
3882 * controls for such models. On models without a "mono speaker" the control
3883 * won't do anything.
3885 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3886 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3887 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3888 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3889 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3891 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3893 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3894 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3896 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3897 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3898 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3899 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3900 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3901 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3902 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3906 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3907 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3909 static struct snd_kcontrol_new alc260_will_mixer[] = {
3910 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3911 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3913 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3914 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3915 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3916 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3917 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3918 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3919 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3920 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3921 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3925 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3926 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3928 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3929 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3930 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3931 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3932 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3933 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3934 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3935 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3936 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3937 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3938 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3942 /* capture mixer elements */
3943 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3944 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3945 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3946 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3947 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3949 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3950 /* The multiple "Capture Source" controls confuse alsamixer
3951 * So call somewhat different..
3953 /* .name = "Capture Source", */
3954 .name = "Input Source",
3956 .info = alc_mux_enum_info,
3957 .get = alc_mux_enum_get,
3958 .put = alc_mux_enum_put,
3963 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3964 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3965 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3967 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3968 /* The multiple "Capture Source" controls confuse alsamixer
3969 * So call somewhat different..
3971 /* .name = "Capture Source", */
3972 .name = "Input Source",
3974 .info = alc_mux_enum_info,
3975 .get = alc_mux_enum_get,
3976 .put = alc_mux_enum_put,
3982 * initialization verbs
3984 static struct hda_verb alc260_init_verbs[] = {
3985 /* Line In pin widget for input */
3986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3987 /* CD pin widget for input */
3988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3989 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3990 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3991 /* Mic2 (front panel) pin widget for input and vref at 80% */
3992 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3993 /* LINE-2 is used for line-out in rear */
3994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3995 /* select line-out */
3996 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3998 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4000 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4002 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4003 /* mute capture amp left and right */
4004 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4005 /* set connection select to line in (default select for this ADC) */
4006 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4007 /* mute capture amp left and right */
4008 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4009 /* set connection select to line in (default select for this ADC) */
4010 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4011 /* set vol=0 Line-Out mixer amp left and right */
4012 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4013 /* unmute pin widget amp left and right (no gain on this amp) */
4014 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4015 /* set vol=0 HP mixer amp left and right */
4016 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4017 /* unmute pin widget amp left and right (no gain on this amp) */
4018 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4019 /* set vol=0 Mono mixer amp left and right */
4020 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4021 /* unmute pin widget amp left and right (no gain on this amp) */
4022 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4023 /* unmute LINE-2 out pin */
4024 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4025 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4028 /* mute analog inputs */
4029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4034 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4035 /* mute Front out path */
4036 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4038 /* mute Headphone out path */
4039 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4040 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4041 /* mute Mono out path */
4042 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4043 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4047 #if 0 /* should be identical with alc260_init_verbs? */
4048 static struct hda_verb alc260_hp_init_verbs[] = {
4049 /* Headphone and output */
4050 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4052 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4053 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4054 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4055 /* Mic2 (front panel) pin widget for input and vref at 80% */
4056 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4057 /* Line In pin widget for input */
4058 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4059 /* Line-2 pin widget for output */
4060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4061 /* CD pin widget for input */
4062 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4063 /* unmute amp left and right */
4064 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4065 /* set connection select to line in (default select for this ADC) */
4066 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4067 /* unmute Line-Out mixer amp left and right (volume = 0) */
4068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4069 /* mute pin widget amp left and right (no gain on this amp) */
4070 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4071 /* unmute HP mixer amp left and right (volume = 0) */
4072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4073 /* mute pin widget amp left and right (no gain on this amp) */
4074 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4075 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4078 /* mute analog inputs */
4079 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4084 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4085 /* Unmute Front out path */
4086 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4087 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4088 /* Unmute Headphone out path */
4089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4090 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4091 /* Unmute Mono out path */
4092 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4093 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4098 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4099 /* Line out and output */
4100 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4102 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4103 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4104 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4105 /* Mic2 (front panel) pin widget for input and vref at 80% */
4106 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4107 /* Line In pin widget for input */
4108 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4109 /* Headphone pin widget for output */
4110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4111 /* CD pin widget for input */
4112 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4113 /* unmute amp left and right */
4114 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4115 /* set connection select to line in (default select for this ADC) */
4116 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4117 /* unmute Line-Out mixer amp left and right (volume = 0) */
4118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4119 /* mute pin widget amp left and right (no gain on this amp) */
4120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4121 /* unmute HP mixer amp left and right (volume = 0) */
4122 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4123 /* mute pin widget amp left and right (no gain on this amp) */
4124 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4125 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4128 /* mute analog inputs */
4129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4134 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4135 /* Unmute Front out path */
4136 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4137 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4138 /* Unmute Headphone out path */
4139 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4140 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4141 /* Unmute Mono out path */
4142 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4143 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4147 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4148 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4149 * audio = 0x16, internal speaker = 0x10.
4151 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4152 /* Disable all GPIOs */
4153 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4154 /* Internal speaker is connected to headphone pin */
4155 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4156 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4158 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4159 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4160 /* Ensure all other unused pins are disabled and muted. */
4161 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4163 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4164 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4165 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4166 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4168 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4170 /* Disable digital (SPDIF) pins */
4171 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4172 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4174 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4175 * when acting as an output.
4177 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4179 /* Start with output sum widgets muted and their output gains at min */
4180 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4181 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4182 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4183 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4184 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4185 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4186 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4187 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4188 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4190 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4191 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4192 /* Unmute Line1 pin widget output buffer since it starts as an output.
4193 * If the pin mode is changed by the user the pin mode control will
4194 * take care of enabling the pin's input/output buffers as needed.
4195 * Therefore there's no need to enable the input buffer at this
4198 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4199 /* Unmute input buffer of pin widget used for Line-in (no equiv
4202 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4204 /* Mute capture amp left and right */
4205 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4206 /* Set ADC connection select to match default mixer setting - line
4209 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4211 /* Do the same for the second ADC: mute capture input amp and
4212 * set ADC connection to line in (on mic1 pin)
4214 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4215 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4217 /* Mute all inputs to mixer widget (even unconnected ones) */
4218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4219 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4220 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4221 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4223 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4224 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4225 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4230 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4231 * similar laptops (adapted from Fujitsu init verbs).
4233 static struct hda_verb alc260_acer_init_verbs[] = {
4234 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4235 * the headphone jack. Turn this on and rely on the standard mute
4236 * methods whenever the user wants to turn these outputs off.
4238 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4239 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4240 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4241 /* Internal speaker/Headphone jack is connected to Line-out pin */
4242 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4243 /* Internal microphone/Mic jack is connected to Mic1 pin */
4244 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4245 /* Line In jack is connected to Line1 pin */
4246 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4247 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4248 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4249 /* Ensure all other unused pins are disabled and muted. */
4250 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4251 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4252 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4253 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4256 /* Disable digital (SPDIF) pins */
4257 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4258 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4260 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4261 * bus when acting as outputs.
4263 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4264 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4266 /* Start with output sum widgets muted and their output gains at min */
4267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4268 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4269 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4270 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4273 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4274 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4275 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4277 /* Unmute Line-out pin widget amp left and right
4278 * (no equiv mixer ctrl)
4280 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4281 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4282 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4283 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4284 * inputs. If the pin mode is changed by the user the pin mode control
4285 * will take care of enabling the pin's input/output buffers as needed.
4286 * Therefore there's no need to enable the input buffer at this
4289 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4292 /* Mute capture amp left and right */
4293 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4294 /* Set ADC connection select to match default mixer setting - mic
4297 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4299 /* Do similar with the second ADC: mute capture input amp and
4300 * set ADC connection to mic to match ALSA's default state.
4302 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4303 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4305 /* Mute all inputs to mixer widget (even unconnected ones) */
4306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4318 static struct hda_verb alc260_will_verbs[] = {
4319 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4320 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4321 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4322 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4323 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4324 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4328 static struct hda_verb alc260_replacer_672v_verbs[] = {
4329 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4330 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4331 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4333 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4334 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4335 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4337 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4341 /* toggle speaker-output according to the hp-jack state */
4342 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4344 unsigned int present;
4346 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4347 present = snd_hda_codec_read(codec, 0x0f, 0,
4348 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4350 snd_hda_codec_write_cache(codec, 0x01, 0,
4351 AC_VERB_SET_GPIO_DATA, 1);
4352 snd_hda_codec_write_cache(codec, 0x0f, 0,
4353 AC_VERB_SET_PIN_WIDGET_CONTROL,
4356 snd_hda_codec_write_cache(codec, 0x01, 0,
4357 AC_VERB_SET_GPIO_DATA, 0);
4358 snd_hda_codec_write_cache(codec, 0x0f, 0,
4359 AC_VERB_SET_PIN_WIDGET_CONTROL,
4364 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4367 if ((res >> 26) == ALC880_HP_EVENT)
4368 alc260_replacer_672v_automute(codec);
4371 /* Test configuration for debugging, modelled after the ALC880 test
4374 #ifdef CONFIG_SND_DEBUG
4375 static hda_nid_t alc260_test_dac_nids[1] = {
4378 static hda_nid_t alc260_test_adc_nids[2] = {
4381 /* For testing the ALC260, each input MUX needs its own definition since
4382 * the signal assignments are different. This assumes that the first ADC
4385 static struct hda_input_mux alc260_test_capture_sources[2] = {
4389 { "MIC1 pin", 0x0 },
4390 { "MIC2 pin", 0x1 },
4391 { "LINE1 pin", 0x2 },
4392 { "LINE2 pin", 0x3 },
4394 { "LINE-OUT pin", 0x5 },
4395 { "HP-OUT pin", 0x6 },
4401 { "MIC1 pin", 0x0 },
4402 { "MIC2 pin", 0x1 },
4403 { "LINE1 pin", 0x2 },
4404 { "LINE2 pin", 0x3 },
4407 { "LINE-OUT pin", 0x6 },
4408 { "HP-OUT pin", 0x7 },
4412 static struct snd_kcontrol_new alc260_test_mixer[] = {
4413 /* Output driver widgets */
4414 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4415 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4416 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4417 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4418 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4419 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4421 /* Modes for retasking pin widgets
4422 * Note: the ALC260 doesn't seem to act on requests to enable mic
4423 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4424 * mention this restriction. At this stage it's not clear whether
4425 * this behaviour is intentional or is a hardware bug in chip
4426 * revisions available at least up until early 2006. Therefore for
4427 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4428 * choices, but if it turns out that the lack of mic bias for these
4429 * NIDs is intentional we could change their modes from
4430 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4432 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4433 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4434 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4435 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4436 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4437 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4439 /* Loopback mixer controls */
4440 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4441 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4442 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4443 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4444 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4445 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4446 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4447 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4448 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4449 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4450 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4451 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4452 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4453 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4454 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4455 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4457 /* Controls for GPIO pins, assuming they are configured as outputs */
4458 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4459 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4460 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4461 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4463 /* Switches to allow the digital IO pins to be enabled. The datasheet
4464 * is ambigious as to which NID is which; testing on laptops which
4465 * make this output available should provide clarification.
4467 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4468 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4470 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4471 * this output to turn on an external amplifier.
4473 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4474 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4478 static struct hda_verb alc260_test_init_verbs[] = {
4479 /* Enable all GPIOs as outputs with an initial value of 0 */
4480 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4481 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4482 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4484 /* Enable retasking pins as output, initially without power amp */
4485 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4486 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4488 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4489 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4490 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4492 /* Disable digital (SPDIF) pins initially, but users can enable
4493 * them via a mixer switch. In the case of SPDIF-out, this initverb
4494 * payload also sets the generation to 0, output to be in "consumer"
4495 * PCM format, copyright asserted, no pre-emphasis and no validity
4498 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4499 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4501 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4502 * OUT1 sum bus when acting as an output.
4504 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4505 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4506 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4507 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4509 /* Start with output sum widgets muted and their output gains at min */
4510 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4511 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4512 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4513 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4514 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4515 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4516 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4517 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4518 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4520 /* Unmute retasking pin widget output buffers since the default
4521 * state appears to be output. As the pin mode is changed by the
4522 * user the pin mode control will take care of enabling the pin's
4523 * input/output buffers as needed.
4525 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4526 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4528 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4529 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4530 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4531 /* Also unmute the mono-out pin widget */
4532 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4534 /* Mute capture amp left and right */
4535 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4536 /* Set ADC connection select to match default mixer setting (mic1
4539 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4541 /* Do the same for the second ADC: mute capture input amp and
4542 * set ADC connection to mic1 pin
4544 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4545 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4547 /* Mute all inputs to mixer widget (even unconnected ones) */
4548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4561 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4562 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4564 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4565 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4568 * for BIOS auto-configuration
4571 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4575 unsigned long vol_val, sw_val;
4579 if (nid >= 0x0f && nid < 0x11) {
4580 nid_vol = nid - 0x7;
4581 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4582 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4583 } else if (nid == 0x11) {
4584 nid_vol = nid - 0x7;
4585 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4586 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4587 } else if (nid >= 0x12 && nid <= 0x15) {
4589 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4590 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4594 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4595 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4598 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4599 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4605 /* add playback controls from the parsed DAC table */
4606 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4607 const struct auto_pin_cfg *cfg)
4612 spec->multiout.num_dacs = 1;
4613 spec->multiout.dac_nids = spec->private_dac_nids;
4614 spec->multiout.dac_nids[0] = 0x02;
4616 nid = cfg->line_out_pins[0];
4618 err = alc260_add_playback_controls(spec, nid, "Front");
4623 nid = cfg->speaker_pins[0];
4625 err = alc260_add_playback_controls(spec, nid, "Speaker");
4630 nid = cfg->hp_pins[0];
4632 err = alc260_add_playback_controls(spec, nid, "Headphone");
4639 /* create playback/capture controls for input pins */
4640 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4641 const struct auto_pin_cfg *cfg)
4643 struct hda_input_mux *imux = &spec->private_imux;
4646 for (i = 0; i < AUTO_PIN_LAST; i++) {
4647 if (cfg->input_pins[i] >= 0x12) {
4648 idx = cfg->input_pins[i] - 0x12;
4649 err = new_analog_input(spec, cfg->input_pins[i],
4650 auto_pin_cfg_labels[i], idx,
4654 imux->items[imux->num_items].label =
4655 auto_pin_cfg_labels[i];
4656 imux->items[imux->num_items].index = idx;
4659 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4660 idx = cfg->input_pins[i] - 0x09;
4661 err = new_analog_input(spec, cfg->input_pins[i],
4662 auto_pin_cfg_labels[i], idx,
4666 imux->items[imux->num_items].label =
4667 auto_pin_cfg_labels[i];
4668 imux->items[imux->num_items].index = idx;
4675 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4676 hda_nid_t nid, int pin_type,
4680 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4682 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4684 /* need the manual connection? */
4686 int idx = nid - 0x12;
4687 snd_hda_codec_write(codec, idx + 0x0b, 0,
4688 AC_VERB_SET_CONNECT_SEL, sel_idx);
4692 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4694 struct alc_spec *spec = codec->spec;
4697 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4698 nid = spec->autocfg.line_out_pins[0];
4700 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4701 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4704 nid = spec->autocfg.speaker_pins[0];
4706 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4708 nid = spec->autocfg.hp_pins[0];
4710 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4713 #define ALC260_PIN_CD_NID 0x16
4714 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4716 struct alc_spec *spec = codec->spec;
4719 for (i = 0; i < AUTO_PIN_LAST; i++) {
4720 hda_nid_t nid = spec->autocfg.input_pins[i];
4722 snd_hda_codec_write(codec, nid, 0,
4723 AC_VERB_SET_PIN_WIDGET_CONTROL,
4724 i <= AUTO_PIN_FRONT_MIC ?
4725 PIN_VREF80 : PIN_IN);
4726 if (nid != ALC260_PIN_CD_NID)
4727 snd_hda_codec_write(codec, nid, 0,
4728 AC_VERB_SET_AMP_GAIN_MUTE,
4735 * generic initialization of ADC, input mixers and output mixers
4737 static struct hda_verb alc260_volume_init_verbs[] = {
4739 * Unmute ADC0-1 and set the default input to mic-in
4741 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4742 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4743 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4744 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4746 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4748 * Note: PASD motherboards uses the Line In 2 as the input for
4749 * front panel mic (mic 2)
4751 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4752 /* mute analog inputs */
4753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4760 * Set up output mixers (0x08 - 0x0a)
4762 /* set vol=0 to output mixers */
4763 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4764 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4765 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4766 /* set up input amps for analog loopback */
4767 /* Amp Indices: DAC = 0, mixer = 1 */
4768 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4769 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4770 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4771 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4772 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4773 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4778 static int alc260_parse_auto_config(struct hda_codec *codec)
4780 struct alc_spec *spec = codec->spec;
4783 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4785 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4789 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4792 if (!spec->kctl_alloc)
4793 return 0; /* can't find valid BIOS pin config */
4794 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4798 spec->multiout.max_channels = 2;
4800 if (spec->autocfg.dig_out_pin)
4801 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4802 if (spec->kctl_alloc)
4803 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4805 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4807 spec->num_mux_defs = 1;
4808 spec->input_mux = &spec->private_imux;
4810 /* check whether NID 0x04 is valid */
4811 wcap = get_wcaps(codec, 0x04);
4812 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4813 if (wcap != AC_WID_AUD_IN) {
4814 spec->adc_nids = alc260_adc_nids_alt;
4815 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4816 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4818 spec->adc_nids = alc260_adc_nids;
4819 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4820 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4827 /* additional initialization for auto-configuration model */
4828 static void alc260_auto_init(struct hda_codec *codec)
4830 alc260_auto_init_multi_out(codec);
4831 alc260_auto_init_analog_input(codec);
4834 #ifdef CONFIG_SND_HDA_POWER_SAVE
4835 static struct hda_amp_list alc260_loopbacks[] = {
4836 { 0x07, HDA_INPUT, 0 },
4837 { 0x07, HDA_INPUT, 1 },
4838 { 0x07, HDA_INPUT, 2 },
4839 { 0x07, HDA_INPUT, 3 },
4840 { 0x07, HDA_INPUT, 4 },
4846 * ALC260 configurations
4848 static const char *alc260_models[ALC260_MODEL_LAST] = {
4849 [ALC260_BASIC] = "basic",
4851 [ALC260_HP_3013] = "hp-3013",
4852 [ALC260_FUJITSU_S702X] = "fujitsu",
4853 [ALC260_ACER] = "acer",
4854 [ALC260_WILL] = "will",
4855 [ALC260_REPLACER_672V] = "replacer",
4856 #ifdef CONFIG_SND_DEBUG
4857 [ALC260_TEST] = "test",
4859 [ALC260_AUTO] = "auto",
4862 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4863 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4864 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4865 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4866 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4867 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4868 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4869 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4870 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4871 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4872 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4873 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4874 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4875 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4876 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4877 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4878 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4879 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4880 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4884 static struct alc_config_preset alc260_presets[] = {
4886 .mixers = { alc260_base_output_mixer,
4888 alc260_pc_beep_mixer,
4889 alc260_capture_mixer },
4890 .init_verbs = { alc260_init_verbs },
4891 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4892 .dac_nids = alc260_dac_nids,
4893 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4894 .adc_nids = alc260_adc_nids,
4895 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4896 .channel_mode = alc260_modes,
4897 .input_mux = &alc260_capture_source,
4900 .mixers = { alc260_base_output_mixer,
4902 alc260_capture_alt_mixer },
4903 .init_verbs = { alc260_init_verbs },
4904 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4905 .dac_nids = alc260_dac_nids,
4906 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4907 .adc_nids = alc260_hp_adc_nids,
4908 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4909 .channel_mode = alc260_modes,
4910 .input_mux = &alc260_capture_source,
4912 [ALC260_HP_3013] = {
4913 .mixers = { alc260_hp_3013_mixer,
4915 alc260_capture_alt_mixer },
4916 .init_verbs = { alc260_hp_3013_init_verbs },
4917 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4918 .dac_nids = alc260_dac_nids,
4919 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4920 .adc_nids = alc260_hp_adc_nids,
4921 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4922 .channel_mode = alc260_modes,
4923 .input_mux = &alc260_capture_source,
4925 [ALC260_FUJITSU_S702X] = {
4926 .mixers = { alc260_fujitsu_mixer,
4927 alc260_capture_mixer },
4928 .init_verbs = { alc260_fujitsu_init_verbs },
4929 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4930 .dac_nids = alc260_dac_nids,
4931 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4932 .adc_nids = alc260_dual_adc_nids,
4933 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4934 .channel_mode = alc260_modes,
4935 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4936 .input_mux = alc260_fujitsu_capture_sources,
4939 .mixers = { alc260_acer_mixer,
4940 alc260_capture_mixer },
4941 .init_verbs = { alc260_acer_init_verbs },
4942 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4943 .dac_nids = alc260_dac_nids,
4944 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4945 .adc_nids = alc260_dual_adc_nids,
4946 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4947 .channel_mode = alc260_modes,
4948 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4949 .input_mux = alc260_acer_capture_sources,
4952 .mixers = { alc260_will_mixer,
4953 alc260_capture_mixer },
4954 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4955 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4956 .dac_nids = alc260_dac_nids,
4957 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4958 .adc_nids = alc260_adc_nids,
4959 .dig_out_nid = ALC260_DIGOUT_NID,
4960 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4961 .channel_mode = alc260_modes,
4962 .input_mux = &alc260_capture_source,
4964 [ALC260_REPLACER_672V] = {
4965 .mixers = { alc260_replacer_672v_mixer,
4966 alc260_capture_mixer },
4967 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4968 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4969 .dac_nids = alc260_dac_nids,
4970 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4971 .adc_nids = alc260_adc_nids,
4972 .dig_out_nid = ALC260_DIGOUT_NID,
4973 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4974 .channel_mode = alc260_modes,
4975 .input_mux = &alc260_capture_source,
4976 .unsol_event = alc260_replacer_672v_unsol_event,
4977 .init_hook = alc260_replacer_672v_automute,
4979 #ifdef CONFIG_SND_DEBUG
4981 .mixers = { alc260_test_mixer,
4982 alc260_capture_mixer },
4983 .init_verbs = { alc260_test_init_verbs },
4984 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4985 .dac_nids = alc260_test_dac_nids,
4986 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4987 .adc_nids = alc260_test_adc_nids,
4988 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4989 .channel_mode = alc260_modes,
4990 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4991 .input_mux = alc260_test_capture_sources,
4996 static int patch_alc260(struct hda_codec *codec)
4998 struct alc_spec *spec;
4999 int err, board_config;
5001 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5007 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5010 if (board_config < 0) {
5011 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5012 "trying auto-probe from BIOS...\n");
5013 board_config = ALC260_AUTO;
5016 if (board_config == ALC260_AUTO) {
5017 /* automatic parse from the BIOS config */
5018 err = alc260_parse_auto_config(codec);
5024 "hda_codec: Cannot set up configuration "
5025 "from BIOS. Using base mode...\n");
5026 board_config = ALC260_BASIC;
5030 if (board_config != ALC260_AUTO)
5031 setup_preset(spec, &alc260_presets[board_config]);
5033 spec->stream_name_analog = "ALC260 Analog";
5034 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5035 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5037 spec->stream_name_digital = "ALC260 Digital";
5038 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5039 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5041 spec->vmaster_nid = 0x08;
5043 codec->patch_ops = alc_patch_ops;
5044 if (board_config == ALC260_AUTO)
5045 spec->init_hook = alc260_auto_init;
5046 #ifdef CONFIG_SND_HDA_POWER_SAVE
5047 if (!spec->loopback.amplist)
5048 spec->loopback.amplist = alc260_loopbacks;
5058 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5059 * configuration. Each pin widget can choose any input DACs and a mixer.
5060 * Each ADC is connected from a mixer of all inputs. This makes possible
5061 * 6-channel independent captures.
5063 * In addition, an independent DAC for the multi-playback (not used in this
5066 #define ALC882_DIGOUT_NID 0x06
5067 #define ALC882_DIGIN_NID 0x0a
5069 static struct hda_channel_mode alc882_ch_modes[1] = {
5073 static hda_nid_t alc882_dac_nids[4] = {
5074 /* front, rear, clfe, rear_surr */
5075 0x02, 0x03, 0x04, 0x05
5078 /* identical with ALC880 */
5079 #define alc882_adc_nids alc880_adc_nids
5080 #define alc882_adc_nids_alt alc880_adc_nids_alt
5083 /* FIXME: should be a matrix-type input source selection */
5085 static struct hda_input_mux alc882_capture_source = {
5089 { "Front Mic", 0x1 },
5094 #define alc882_mux_enum_info alc_mux_enum_info
5095 #define alc882_mux_enum_get alc_mux_enum_get
5097 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5098 struct snd_ctl_elem_value *ucontrol)
5100 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5101 struct alc_spec *spec = codec->spec;
5102 const struct hda_input_mux *imux = spec->input_mux;
5103 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5104 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5105 hda_nid_t nid = capture_mixers[adc_idx];
5106 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5107 unsigned int i, idx;
5109 idx = ucontrol->value.enumerated.item[0];
5110 if (idx >= imux->num_items)
5111 idx = imux->num_items - 1;
5112 if (*cur_val == idx)
5114 for (i = 0; i < imux->num_items; i++) {
5115 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5116 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5117 imux->items[i].index,
5127 static struct hda_verb alc882_3ST_ch2_init[] = {
5128 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5129 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5130 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5131 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5138 static struct hda_verb alc882_3ST_ch6_init[] = {
5139 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5140 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5141 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5142 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5143 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5144 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5148 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5149 { 2, alc882_3ST_ch2_init },
5150 { 6, alc882_3ST_ch6_init },
5156 static struct hda_verb alc882_sixstack_ch6_init[] = {
5157 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5158 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5159 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5160 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5167 static struct hda_verb alc882_sixstack_ch8_init[] = {
5168 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5169 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5170 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5171 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5175 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5176 { 6, alc882_sixstack_ch6_init },
5177 { 8, alc882_sixstack_ch8_init },
5181 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5187 static struct hda_verb alc885_mbp_ch2_init[] = {
5188 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5189 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5190 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5197 static struct hda_verb alc885_mbp_ch6_init[] = {
5198 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5199 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5200 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5201 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5202 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5206 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5207 { 2, alc885_mbp_ch2_init },
5208 { 6, alc885_mbp_ch6_init },
5212 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5213 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5215 static struct snd_kcontrol_new alc882_base_mixer[] = {
5216 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5217 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5218 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5219 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5220 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5221 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5222 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5223 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5224 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5225 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5227 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5228 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5230 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5232 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5235 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5236 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5237 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5238 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5242 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5244 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5245 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5246 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5247 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5248 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5250 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5251 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5255 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5256 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5257 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5258 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5259 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5260 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5261 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5263 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5265 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5266 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5270 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5271 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5272 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5273 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5274 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5275 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5276 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5277 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5279 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5280 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5281 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5282 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5283 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5287 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5288 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5290 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5292 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5293 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5294 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5297 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5298 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5299 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5300 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5302 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5303 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5307 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5308 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5309 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5311 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5312 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5313 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5314 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5316 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5318 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5319 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5323 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5325 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5326 .name = "Channel Mode",
5327 .info = alc_ch_mode_info,
5328 .get = alc_ch_mode_get,
5329 .put = alc_ch_mode_put,
5334 static struct hda_verb alc882_init_verbs[] = {
5335 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5341 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5352 /* Front Pin: output 0 (0x0c) */
5353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5354 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5355 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5356 /* Rear Pin: output 1 (0x0d) */
5357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5358 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5359 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5360 /* CLFE Pin: output 2 (0x0e) */
5361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5362 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5363 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5364 /* Side Pin: output 3 (0x0f) */
5365 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5366 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5367 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5368 /* Mic (rear) pin: input vref at 80% */
5369 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5370 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5371 /* Front Mic pin: input vref at 80% */
5372 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5373 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5374 /* Line In pin: input */
5375 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5377 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5379 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5380 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5381 /* CD pin widget for input */
5382 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5384 /* FIXME: use matrix-type input source selection */
5385 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5386 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5389 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5401 /* ADC1: mute amp left and right */
5402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5403 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5404 /* ADC2: mute amp left and right */
5405 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5406 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5407 /* ADC3: mute amp left and right */
5408 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5409 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5414 static struct hda_verb alc882_eapd_verbs[] = {
5415 /* change to EAPD mode */
5416 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5417 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5422 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5424 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5426 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5427 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5428 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5429 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5433 static struct hda_verb alc882_macpro_init_verbs[] = {
5434 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5438 /* Front Pin: output 0 (0x0c) */
5439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5440 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5441 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5442 /* Front Mic pin: input vref at 80% */
5443 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5444 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5445 /* Speaker: output */
5446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5447 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5448 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5449 /* Headphone output (output 0 - 0x0c) */
5450 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5452 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5454 /* FIXME: use matrix-type input source selection */
5455 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5456 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5471 /* ADC1: mute amp left and right */
5472 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5473 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5474 /* ADC2: mute amp left and right */
5475 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5476 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5477 /* ADC3: mute amp left and right */
5478 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5479 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5484 /* Macbook Pro rev3 */
5485 static struct hda_verb alc885_mbp3_init_verbs[] = {
5486 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5491 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5492 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5493 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5494 /* Front Pin: output 0 (0x0c) */
5495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5497 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5498 /* HP Pin: output 0 (0x0d) */
5499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5502 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5503 /* Mic (rear) pin: input vref at 80% */
5504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5506 /* Front Mic pin: input vref at 80% */
5507 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5508 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5509 /* Line In pin: use output 1 when in LineOut mode */
5510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5512 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5514 /* FIXME: use matrix-type input source selection */
5515 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5516 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5531 /* ADC1: mute amp left and right */
5532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5533 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5534 /* ADC2: mute amp left and right */
5535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5536 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5537 /* ADC3: mute amp left and right */
5538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5539 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5544 /* iMac 24 mixer. */
5545 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5546 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5547 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5551 /* iMac 24 init verbs. */
5552 static struct hda_verb alc885_imac24_init_verbs[] = {
5553 /* Internal speakers: output 0 (0x0c) */
5554 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5555 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5556 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5557 /* Internal speakers: output 0 (0x0c) */
5558 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5559 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5560 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5561 /* Headphone: output 0 (0x0c) */
5562 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5563 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5564 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5565 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5566 /* Front Mic: input vref at 80% */
5567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5572 /* Toggle speaker-output according to the hp-jack state */
5573 static void alc885_imac24_automute(struct hda_codec *codec)
5575 unsigned int present;
5577 present = snd_hda_codec_read(codec, 0x14, 0,
5578 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5579 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5580 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5581 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5582 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5585 /* Processes unsolicited events. */
5586 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5589 /* Headphone insertion or removal. */
5590 if ((res >> 26) == ALC880_HP_EVENT)
5591 alc885_imac24_automute(codec);
5594 static void alc885_mbp3_automute(struct hda_codec *codec)
5596 unsigned int present;
5598 present = snd_hda_codec_read(codec, 0x15, 0,
5599 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5600 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5601 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5602 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5603 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5606 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5609 /* Headphone insertion or removal. */
5610 if ((res >> 26) == ALC880_HP_EVENT)
5611 alc885_mbp3_automute(codec);
5615 static struct hda_verb alc882_targa_verbs[] = {
5616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5622 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5623 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5624 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5626 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5627 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5628 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5629 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5633 /* toggle speaker-output according to the hp-jack state */
5634 static void alc882_targa_automute(struct hda_codec *codec)
5636 unsigned int present;
5638 present = snd_hda_codec_read(codec, 0x14, 0,
5639 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5640 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5641 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5642 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5646 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5648 /* Looks like the unsol event is incompatible with the standard
5649 * definition. 4bit tag is placed at 26 bit!
5651 if (((res >> 26) == ALC880_HP_EVENT)) {
5652 alc882_targa_automute(codec);
5656 static struct hda_verb alc882_asus_a7j_verbs[] = {
5657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5661 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5664 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5665 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5666 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5668 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5669 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5670 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5674 static struct hda_verb alc882_asus_a7m_verbs[] = {
5675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5678 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5680 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5682 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5683 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5684 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5686 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5687 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5688 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5692 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5694 unsigned int gpiostate, gpiomask, gpiodir;
5696 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5697 AC_VERB_GET_GPIO_DATA, 0);
5700 gpiostate |= (1 << pin);
5702 gpiostate &= ~(1 << pin);
5704 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5705 AC_VERB_GET_GPIO_MASK, 0);
5706 gpiomask |= (1 << pin);
5708 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5709 AC_VERB_GET_GPIO_DIRECTION, 0);
5710 gpiodir |= (1 << pin);
5713 snd_hda_codec_write(codec, codec->afg, 0,
5714 AC_VERB_SET_GPIO_MASK, gpiomask);
5715 snd_hda_codec_write(codec, codec->afg, 0,
5716 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5720 snd_hda_codec_write(codec, codec->afg, 0,
5721 AC_VERB_SET_GPIO_DATA, gpiostate);
5724 /* set up GPIO at initialization */
5725 static void alc885_macpro_init_hook(struct hda_codec *codec)
5727 alc882_gpio_mute(codec, 0, 0);
5728 alc882_gpio_mute(codec, 1, 0);
5731 /* set up GPIO and update auto-muting at initialization */
5732 static void alc885_imac24_init_hook(struct hda_codec *codec)
5734 alc885_macpro_init_hook(codec);
5735 alc885_imac24_automute(codec);
5739 * generic initialization of ADC, input mixers and output mixers
5741 static struct hda_verb alc882_auto_init_verbs[] = {
5743 * Unmute ADC0-2 and set the default input to mic-in
5745 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5747 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5748 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5749 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5750 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5752 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5754 * Note: PASD motherboards uses the Line In 2 as the input for
5755 * front panel mic (mic 2)
5757 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5761 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5765 * Set up output mixers (0x0c - 0x0f)
5767 /* set vol=0 to output mixers */
5768 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5769 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5770 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5771 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5772 /* set up input amps for analog loopback */
5773 /* Amp Indices: DAC = 0, mixer = 1 */
5774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5776 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5778 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5780 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5782 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5783 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5785 /* FIXME: use matrix-type input source selection */
5786 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5787 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5788 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5789 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5793 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5794 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5795 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5796 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5798 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5799 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5800 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5806 /* capture mixer elements */
5807 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5808 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5809 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5810 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5811 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5813 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5814 /* The multiple "Capture Source" controls confuse alsamixer
5815 * So call somewhat different..
5817 /* .name = "Capture Source", */
5818 .name = "Input Source",
5820 .info = alc882_mux_enum_info,
5821 .get = alc882_mux_enum_get,
5822 .put = alc882_mux_enum_put,
5827 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5828 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5829 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5830 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5831 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5832 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5833 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5835 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5836 /* The multiple "Capture Source" controls confuse alsamixer
5837 * So call somewhat different..
5839 /* .name = "Capture Source", */
5840 .name = "Input Source",
5842 .info = alc882_mux_enum_info,
5843 .get = alc882_mux_enum_get,
5844 .put = alc882_mux_enum_put,
5849 #ifdef CONFIG_SND_HDA_POWER_SAVE
5850 #define alc882_loopbacks alc880_loopbacks
5853 /* pcm configuration: identiacal with ALC880 */
5854 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5855 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5856 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5857 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5860 * configuration and preset
5862 static const char *alc882_models[ALC882_MODEL_LAST] = {
5863 [ALC882_3ST_DIG] = "3stack-dig",
5864 [ALC882_6ST_DIG] = "6stack-dig",
5865 [ALC882_ARIMA] = "arima",
5866 [ALC882_W2JC] = "w2jc",
5867 [ALC882_TARGA] = "targa",
5868 [ALC882_ASUS_A7J] = "asus-a7j",
5869 [ALC882_ASUS_A7M] = "asus-a7m",
5870 [ALC885_MACPRO] = "macpro",
5871 [ALC885_MBP3] = "mbp3",
5872 [ALC885_IMAC24] = "imac24",
5873 [ALC882_AUTO] = "auto",
5876 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5877 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5878 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5879 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
5880 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
5881 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5882 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5883 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5884 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5885 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
5886 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5887 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5888 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5892 static struct alc_config_preset alc882_presets[] = {
5893 [ALC882_3ST_DIG] = {
5894 .mixers = { alc882_base_mixer },
5895 .init_verbs = { alc882_init_verbs },
5896 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5897 .dac_nids = alc882_dac_nids,
5898 .dig_out_nid = ALC882_DIGOUT_NID,
5899 .dig_in_nid = ALC882_DIGIN_NID,
5900 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5901 .channel_mode = alc882_ch_modes,
5903 .input_mux = &alc882_capture_source,
5905 [ALC882_6ST_DIG] = {
5906 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5907 .init_verbs = { alc882_init_verbs },
5908 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5909 .dac_nids = alc882_dac_nids,
5910 .dig_out_nid = ALC882_DIGOUT_NID,
5911 .dig_in_nid = ALC882_DIGIN_NID,
5912 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5913 .channel_mode = alc882_sixstack_modes,
5914 .input_mux = &alc882_capture_source,
5917 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5918 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5919 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5920 .dac_nids = alc882_dac_nids,
5921 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5922 .channel_mode = alc882_sixstack_modes,
5923 .input_mux = &alc882_capture_source,
5926 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5927 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5928 alc880_gpio1_init_verbs },
5929 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5930 .dac_nids = alc882_dac_nids,
5931 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5932 .channel_mode = alc880_threestack_modes,
5934 .input_mux = &alc882_capture_source,
5935 .dig_out_nid = ALC882_DIGOUT_NID,
5938 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5939 .init_verbs = { alc885_mbp3_init_verbs,
5940 alc880_gpio1_init_verbs },
5941 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5942 .dac_nids = alc882_dac_nids,
5943 .channel_mode = alc885_mbp_6ch_modes,
5944 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5945 .input_mux = &alc882_capture_source,
5946 .dig_out_nid = ALC882_DIGOUT_NID,
5947 .dig_in_nid = ALC882_DIGIN_NID,
5948 .unsol_event = alc885_mbp3_unsol_event,
5949 .init_hook = alc885_mbp3_automute,
5952 .mixers = { alc882_macpro_mixer },
5953 .init_verbs = { alc882_macpro_init_verbs },
5954 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5955 .dac_nids = alc882_dac_nids,
5956 .dig_out_nid = ALC882_DIGOUT_NID,
5957 .dig_in_nid = ALC882_DIGIN_NID,
5958 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5959 .channel_mode = alc882_ch_modes,
5960 .input_mux = &alc882_capture_source,
5961 .init_hook = alc885_macpro_init_hook,
5964 .mixers = { alc885_imac24_mixer },
5965 .init_verbs = { alc885_imac24_init_verbs },
5966 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5967 .dac_nids = alc882_dac_nids,
5968 .dig_out_nid = ALC882_DIGOUT_NID,
5969 .dig_in_nid = ALC882_DIGIN_NID,
5970 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5971 .channel_mode = alc882_ch_modes,
5972 .input_mux = &alc882_capture_source,
5973 .unsol_event = alc885_imac24_unsol_event,
5974 .init_hook = alc885_imac24_init_hook,
5977 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5978 alc882_capture_mixer },
5979 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5980 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5981 .dac_nids = alc882_dac_nids,
5982 .dig_out_nid = ALC882_DIGOUT_NID,
5983 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5984 .adc_nids = alc882_adc_nids,
5985 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5986 .channel_mode = alc882_3ST_6ch_modes,
5988 .input_mux = &alc882_capture_source,
5989 .unsol_event = alc882_targa_unsol_event,
5990 .init_hook = alc882_targa_automute,
5992 [ALC882_ASUS_A7J] = {
5993 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5994 alc882_capture_mixer },
5995 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5996 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5997 .dac_nids = alc882_dac_nids,
5998 .dig_out_nid = ALC882_DIGOUT_NID,
5999 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6000 .adc_nids = alc882_adc_nids,
6001 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6002 .channel_mode = alc882_3ST_6ch_modes,
6004 .input_mux = &alc882_capture_source,
6006 [ALC882_ASUS_A7M] = {
6007 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6008 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6009 alc880_gpio1_init_verbs,
6010 alc882_asus_a7m_verbs },
6011 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6012 .dac_nids = alc882_dac_nids,
6013 .dig_out_nid = ALC882_DIGOUT_NID,
6014 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6015 .channel_mode = alc880_threestack_modes,
6017 .input_mux = &alc882_capture_source,
6026 PINFIX_ABIT_AW9D_MAX
6029 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6030 { 0x15, 0x01080104 }, /* side */
6031 { 0x16, 0x01011012 }, /* rear */
6032 { 0x17, 0x01016011 }, /* clfe */
6036 static const struct alc_pincfg *alc882_pin_fixes[] = {
6037 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6040 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6041 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6046 * BIOS auto configuration
6048 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6049 hda_nid_t nid, int pin_type,
6053 struct alc_spec *spec = codec->spec;
6056 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6059 idx = spec->multiout.dac_nids[dac_idx] - 2;
6061 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6063 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6065 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6069 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6071 struct alc_spec *spec = codec->spec;
6074 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6075 for (i = 0; i <= HDA_SIDE; i++) {
6076 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6077 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6079 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6084 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6086 struct alc_spec *spec = codec->spec;
6089 pin = spec->autocfg.hp_pins[0];
6090 if (pin) /* connect to front */
6092 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6095 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6096 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6098 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6100 struct alc_spec *spec = codec->spec;
6103 for (i = 0; i < AUTO_PIN_LAST; i++) {
6104 hda_nid_t nid = spec->autocfg.input_pins[i];
6105 if (alc882_is_input_pin(nid)) {
6106 snd_hda_codec_write(codec, nid, 0,
6107 AC_VERB_SET_PIN_WIDGET_CONTROL,
6108 i <= AUTO_PIN_FRONT_MIC ?
6109 PIN_VREF80 : PIN_IN);
6110 if (nid != ALC882_PIN_CD_NID)
6111 snd_hda_codec_write(codec, nid, 0,
6112 AC_VERB_SET_AMP_GAIN_MUTE,
6118 /* add mic boosts if needed */
6119 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6121 struct alc_spec *spec = codec->spec;
6125 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6126 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6127 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6129 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6133 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6134 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6135 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6137 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6144 /* almost identical with ALC880 parser... */
6145 static int alc882_parse_auto_config(struct hda_codec *codec)
6147 struct alc_spec *spec = codec->spec;
6148 int err = alc880_parse_auto_config(codec);
6153 return 0; /* no config found */
6155 err = alc_auto_add_mic_boost(codec);
6159 /* hack - override the init verbs */
6160 spec->init_verbs[0] = alc882_auto_init_verbs;
6162 return 1; /* config found */
6165 /* additional initialization for auto-configuration model */
6166 static void alc882_auto_init(struct hda_codec *codec)
6168 alc882_auto_init_multi_out(codec);
6169 alc882_auto_init_hp_out(codec);
6170 alc882_auto_init_analog_input(codec);
6173 static int patch_alc882(struct hda_codec *codec)
6175 struct alc_spec *spec;
6176 int err, board_config;
6178 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6184 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6188 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6189 /* Pick up systems that don't supply PCI SSID */
6190 switch (codec->subsystem_id) {
6191 case 0x106b0c00: /* Mac Pro */
6192 board_config = ALC885_MACPRO;
6194 case 0x106b1000: /* iMac 24 */
6195 board_config = ALC885_IMAC24;
6197 case 0x106b00a1: /* Macbook */
6198 case 0x106b2c00: /* Macbook Pro rev3 */
6199 board_config = ALC885_MBP3;
6202 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6203 "trying auto-probe from BIOS...\n");
6204 board_config = ALC882_AUTO;
6208 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6210 if (board_config == ALC882_AUTO) {
6211 /* automatic parse from the BIOS config */
6212 err = alc882_parse_auto_config(codec);
6218 "hda_codec: Cannot set up configuration "
6219 "from BIOS. Using base mode...\n");
6220 board_config = ALC882_3ST_DIG;
6224 if (board_config != ALC882_AUTO)
6225 setup_preset(spec, &alc882_presets[board_config]);
6227 spec->stream_name_analog = "ALC882 Analog";
6228 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6229 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6230 /* FIXME: setup DAC5 */
6231 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6232 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6234 spec->stream_name_digital = "ALC882 Digital";
6235 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6236 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6238 if (!spec->adc_nids && spec->input_mux) {
6239 /* check whether NID 0x07 is valid */
6240 unsigned int wcap = get_wcaps(codec, 0x07);
6242 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6243 if (wcap != AC_WID_AUD_IN) {
6244 spec->adc_nids = alc882_adc_nids_alt;
6245 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6246 spec->mixers[spec->num_mixers] =
6247 alc882_capture_alt_mixer;
6250 spec->adc_nids = alc882_adc_nids;
6251 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6252 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6257 spec->vmaster_nid = 0x0c;
6259 codec->patch_ops = alc_patch_ops;
6260 if (board_config == ALC882_AUTO)
6261 spec->init_hook = alc882_auto_init;
6262 #ifdef CONFIG_SND_HDA_POWER_SAVE
6263 if (!spec->loopback.amplist)
6264 spec->loopback.amplist = alc882_loopbacks;
6273 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6274 * configuration. Each pin widget can choose any input DACs and a mixer.
6275 * Each ADC is connected from a mixer of all inputs. This makes possible
6276 * 6-channel independent captures.
6278 * In addition, an independent DAC for the multi-playback (not used in this
6281 #define ALC883_DIGOUT_NID 0x06
6282 #define ALC883_DIGIN_NID 0x0a
6284 static hda_nid_t alc883_dac_nids[4] = {
6285 /* front, rear, clfe, rear_surr */
6286 0x02, 0x04, 0x03, 0x05
6289 static hda_nid_t alc883_adc_nids[2] = {
6295 /* FIXME: should be a matrix-type input source selection */
6297 static struct hda_input_mux alc883_capture_source = {
6301 { "Front Mic", 0x1 },
6307 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6315 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6325 #define alc883_mux_enum_info alc_mux_enum_info
6326 #define alc883_mux_enum_get alc_mux_enum_get
6328 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6329 struct snd_ctl_elem_value *ucontrol)
6331 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6332 struct alc_spec *spec = codec->spec;
6333 const struct hda_input_mux *imux = spec->input_mux;
6334 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6335 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
6336 hda_nid_t nid = capture_mixers[adc_idx];
6337 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6338 unsigned int i, idx;
6340 idx = ucontrol->value.enumerated.item[0];
6341 if (idx >= imux->num_items)
6342 idx = imux->num_items - 1;
6343 if (*cur_val == idx)
6345 for (i = 0; i < imux->num_items; i++) {
6346 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6347 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6348 imux->items[i].index,
6358 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6365 static struct hda_verb alc883_3ST_ch2_init[] = {
6366 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6367 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6368 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6369 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6376 static struct hda_verb alc883_3ST_ch4_init[] = {
6377 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6378 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6379 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6380 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6381 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6388 static struct hda_verb alc883_3ST_ch6_init[] = {
6389 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6390 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6391 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6392 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6393 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6394 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6398 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6399 { 2, alc883_3ST_ch2_init },
6400 { 4, alc883_3ST_ch4_init },
6401 { 6, alc883_3ST_ch6_init },
6407 static struct hda_verb alc883_sixstack_ch6_init[] = {
6408 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6409 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6410 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6411 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6418 static struct hda_verb alc883_sixstack_ch8_init[] = {
6419 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6420 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6421 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6422 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6426 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6427 { 6, alc883_sixstack_ch6_init },
6428 { 8, alc883_sixstack_ch8_init },
6431 static struct hda_verb alc883_medion_eapd_verbs[] = {
6432 /* eanable EAPD on medion laptop */
6433 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6434 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6438 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6439 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6442 static struct snd_kcontrol_new alc883_base_mixer[] = {
6443 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6444 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6445 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6446 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6447 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6448 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6449 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6450 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6451 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6452 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6454 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6455 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6456 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6457 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6458 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6459 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6461 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6462 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6463 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6464 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6465 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6466 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6467 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6468 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6469 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6471 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6472 /* .name = "Capture Source", */
6473 .name = "Input Source",
6475 .info = alc883_mux_enum_info,
6476 .get = alc883_mux_enum_get,
6477 .put = alc883_mux_enum_put,
6482 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6485 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6486 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6487 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6488 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6489 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6491 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6493 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6494 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6495 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6496 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6497 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6498 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6499 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6501 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6502 /* .name = "Capture Source", */
6503 .name = "Input Source",
6505 .info = alc883_mux_enum_info,
6506 .get = alc883_mux_enum_get,
6507 .put = alc883_mux_enum_put,
6512 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6513 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6514 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6516 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6517 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6518 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6519 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6522 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6523 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6524 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6525 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6526 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6527 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6528 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6529 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6530 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6531 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6533 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6534 /* .name = "Capture Source", */
6535 .name = "Input Source",
6537 .info = alc883_mux_enum_info,
6538 .get = alc883_mux_enum_get,
6539 .put = alc883_mux_enum_put,
6544 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6545 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6546 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6547 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6548 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6549 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6550 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6551 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6552 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6553 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6554 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6555 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6556 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6557 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6558 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6559 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6561 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6562 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6563 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6564 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6565 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6566 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6567 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6568 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6569 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6572 /* .name = "Capture Source", */
6573 .name = "Input Source",
6575 .info = alc883_mux_enum_info,
6576 .get = alc883_mux_enum_get,
6577 .put = alc883_mux_enum_put,
6582 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6583 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6584 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6585 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6586 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6587 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6588 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6589 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6590 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6591 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6592 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6593 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6594 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6595 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6596 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6597 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6598 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6599 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6600 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6601 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6602 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6603 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6604 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6605 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6608 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6609 /* .name = "Capture Source", */
6610 .name = "Input Source",
6612 .info = alc883_mux_enum_info,
6613 .get = alc883_mux_enum_get,
6614 .put = alc883_mux_enum_put,
6619 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6620 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6622 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6623 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6624 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6625 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6626 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6627 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6628 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6629 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6630 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6633 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6634 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6635 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6636 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6637 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6638 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6639 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6642 /* .name = "Capture Source", */
6643 .name = "Input Source",
6645 .info = alc883_mux_enum_info,
6646 .get = alc883_mux_enum_get,
6647 .put = alc883_mux_enum_put,
6652 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6653 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6655 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6656 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6657 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6659 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6661 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6662 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6663 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6664 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6667 /* .name = "Capture Source", */
6668 .name = "Input Source",
6670 .info = alc883_mux_enum_info,
6671 .get = alc883_mux_enum_get,
6672 .put = alc883_mux_enum_put,
6677 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6678 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6679 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6680 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6681 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6683 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6684 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6686 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6687 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6690 /* .name = "Capture Source", */
6691 .name = "Input Source",
6693 .info = alc883_mux_enum_info,
6694 .get = alc883_mux_enum_get,
6695 .put = alc883_mux_enum_put,
6700 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6701 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6702 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6703 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6704 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6705 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6708 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6709 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6710 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6711 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6712 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6713 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6716 /* .name = "Capture Source", */
6717 .name = "Input Source",
6719 .info = alc883_mux_enum_info,
6720 .get = alc883_mux_enum_get,
6721 .put = alc883_mux_enum_put,
6726 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6727 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6729 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6730 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6731 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6734 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6735 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6736 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6737 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6738 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6739 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6742 /* .name = "Capture Source", */
6743 .name = "Input Source",
6745 .info = alc883_mux_enum_info,
6746 .get = alc883_mux_enum_get,
6747 .put = alc883_mux_enum_put,
6752 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6753 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6754 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6755 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6756 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6757 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6758 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6759 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6760 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6761 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6762 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6764 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6765 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6766 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6767 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6768 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6769 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6771 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6772 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6773 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6774 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6775 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6776 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6777 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6778 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6779 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6781 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6782 /* .name = "Capture Source", */
6783 .name = "Input Source",
6785 .info = alc883_mux_enum_info,
6786 .get = alc883_mux_enum_get,
6787 .put = alc883_mux_enum_put,
6792 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6793 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6794 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6795 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6796 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6797 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6798 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6799 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6800 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6801 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6803 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6809 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6810 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6811 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6812 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6813 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6814 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6815 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6816 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6817 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6819 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6820 /* .name = "Capture Source", */
6821 .name = "Input Source",
6823 .info = alc883_mux_enum_info,
6824 .get = alc883_mux_enum_get,
6825 .put = alc883_mux_enum_put,
6830 static struct snd_kcontrol_new alc888_6st_dell_mixer[] = {
6831 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6832 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6833 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6834 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6835 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6836 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6837 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6838 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6839 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6840 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6842 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6843 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6844 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6845 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6847 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6849 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6850 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6851 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6852 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6853 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6854 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6855 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6856 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6857 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6859 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6860 /* .name = "Capture Source", */
6861 .name = "Input Source",
6863 .info = alc883_mux_enum_info,
6864 .get = alc883_mux_enum_get,
6865 .put = alc883_mux_enum_put,
6870 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6871 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6872 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6873 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6874 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6875 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6877 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6879 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6880 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6881 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6882 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6884 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6885 /* .name = "Capture Source", */
6886 .name = "Input Source",
6888 .info = alc883_mux_enum_info,
6889 .get = alc883_mux_enum_get,
6890 .put = alc883_mux_enum_put,
6895 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6898 .name = "Channel Mode",
6899 .info = alc_ch_mode_info,
6900 .get = alc_ch_mode_get,
6901 .put = alc_ch_mode_put,
6906 static struct hda_verb alc883_init_verbs[] = {
6907 /* ADC1: mute amp left and right */
6908 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6909 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6910 /* ADC2: mute amp left and right */
6911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6912 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6913 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6914 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6920 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6924 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6926 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6927 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6928 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6930 /* mute analog input loopbacks */
6931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6937 /* Front Pin: output 0 (0x0c) */
6938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6939 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6940 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6941 /* Rear Pin: output 1 (0x0d) */
6942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6943 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6944 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6945 /* CLFE Pin: output 2 (0x0e) */
6946 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6947 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6948 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6949 /* Side Pin: output 3 (0x0f) */
6950 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6951 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6952 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6953 /* Mic (rear) pin: input vref at 80% */
6954 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6955 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6956 /* Front Mic pin: input vref at 80% */
6957 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6958 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6959 /* Line In pin: input */
6960 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6961 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6962 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6963 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6964 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6965 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6966 /* CD pin widget for input */
6967 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6969 /* FIXME: use matrix-type input source selection */
6970 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6972 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6974 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6975 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6977 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6984 /* toggle speaker-output according to the hp-jack state */
6985 static void alc883_mitac_hp_automute(struct hda_codec *codec)
6987 unsigned int present;
6989 present = snd_hda_codec_read(codec, 0x15, 0,
6990 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6991 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6992 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6993 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
6994 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6997 /* auto-toggle front mic */
6999 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7001 unsigned int present;
7004 present = snd_hda_codec_read(codec, 0x18, 0,
7005 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7006 bits = present ? HDA_AMP_MUTE : 0;
7007 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7011 static void alc883_mitac_automute(struct hda_codec *codec)
7013 alc883_mitac_hp_automute(codec);
7014 /* alc883_mitac_mic_automute(codec); */
7017 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7020 switch (res >> 26) {
7021 case ALC880_HP_EVENT:
7022 alc883_mitac_hp_automute(codec);
7024 case ALC880_MIC_EVENT:
7025 /* alc883_mitac_mic_automute(codec); */
7030 static struct hda_verb alc883_mitac_verbs[] = {
7032 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7033 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7035 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7036 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7038 /* enable unsolicited event */
7039 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7040 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7045 static struct hda_verb alc883_tagra_verbs[] = {
7046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7050 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7052 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7053 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7054 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7056 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7057 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7058 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7059 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7064 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7065 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7066 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7067 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7071 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7074 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7075 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7079 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7080 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7083 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7084 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7088 static struct hda_verb alc883_haier_w66_verbs[] = {
7089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7092 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7094 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7095 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7096 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7097 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7101 static struct hda_verb alc888_6st_hp_verbs[] = {
7102 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7103 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
7104 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
7105 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7109 static struct hda_verb alc888_3st_hp_verbs[] = {
7110 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7111 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7112 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7116 static struct hda_verb alc888_6st_dell_verbs[] = {
7117 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */
7119 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */
7120 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7121 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7125 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7126 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7127 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7128 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7129 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7133 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7134 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7135 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7136 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7137 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7141 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7142 { 2, alc888_3st_hp_2ch_init },
7143 { 6, alc888_3st_hp_6ch_init },
7146 /* toggle front-jack and RCA according to the hp-jack state */
7147 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7149 unsigned int present;
7151 present = snd_hda_codec_read(codec, 0x1b, 0,
7152 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7153 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7154 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7155 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7156 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7159 /* toggle RCA according to the front-jack state */
7160 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7162 unsigned int present;
7164 present = snd_hda_codec_read(codec, 0x14, 0,
7165 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7166 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7167 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7170 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7173 if ((res >> 26) == ALC880_HP_EVENT)
7174 alc888_lenovo_ms7195_front_automute(codec);
7175 if ((res >> 26) == ALC880_FRONT_EVENT)
7176 alc888_lenovo_ms7195_rca_automute(codec);
7179 static struct hda_verb alc883_medion_md2_verbs[] = {
7180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7185 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7189 /* toggle speaker-output according to the hp-jack state */
7190 static void alc883_medion_md2_automute(struct hda_codec *codec)
7192 unsigned int present;
7194 present = snd_hda_codec_read(codec, 0x14, 0,
7195 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7196 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7197 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7200 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7203 if ((res >> 26) == ALC880_HP_EVENT)
7204 alc883_medion_md2_automute(codec);
7207 /* toggle speaker-output according to the hp-jack state */
7208 static void alc883_tagra_automute(struct hda_codec *codec)
7210 unsigned int present;
7213 present = snd_hda_codec_read(codec, 0x14, 0,
7214 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7215 bits = present ? HDA_AMP_MUTE : 0;
7216 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7217 HDA_AMP_MUTE, bits);
7218 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7222 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7224 if ((res >> 26) == ALC880_HP_EVENT)
7225 alc883_tagra_automute(codec);
7228 static void alc883_haier_w66_automute(struct hda_codec *codec)
7230 unsigned int present;
7233 present = snd_hda_codec_read(codec, 0x1b, 0,
7234 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7235 bits = present ? 0x80 : 0;
7236 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7240 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7243 if ((res >> 26) == ALC880_HP_EVENT)
7244 alc883_haier_w66_automute(codec);
7247 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7249 unsigned int present;
7252 present = snd_hda_codec_read(codec, 0x14, 0,
7253 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7254 bits = present ? HDA_AMP_MUTE : 0;
7255 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7256 HDA_AMP_MUTE, bits);
7259 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7261 unsigned int present;
7264 present = snd_hda_codec_read(codec, 0x1b, 0,
7265 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7266 bits = present ? HDA_AMP_MUTE : 0;
7267 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7268 HDA_AMP_MUTE, bits);
7269 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7270 HDA_AMP_MUTE, bits);
7273 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7276 if ((res >> 26) == ALC880_HP_EVENT)
7277 alc883_lenovo_101e_all_automute(codec);
7278 if ((res >> 26) == ALC880_FRONT_EVENT)
7279 alc883_lenovo_101e_ispeaker_automute(codec);
7282 /* toggle speaker-output according to the hp-jack state */
7283 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7285 unsigned int present;
7287 present = snd_hda_codec_read(codec, 0x14, 0,
7288 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7289 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7290 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7291 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7292 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7295 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7298 if ((res >> 26) == ALC880_HP_EVENT)
7299 alc883_acer_aspire_automute(codec);
7302 static struct hda_verb alc883_acer_eapd_verbs[] = {
7303 /* HP Pin: output 0 (0x0c) */
7304 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7305 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7306 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7307 /* Front Pin: output 0 (0x0c) */
7308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7309 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7310 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7311 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7312 /* eanable EAPD on medion laptop */
7313 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7314 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7315 /* enable unsolicited event */
7316 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7320 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7322 unsigned int present;
7324 present = snd_hda_codec_read(codec, 0x1b, 0,
7325 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7326 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7327 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7328 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7329 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7330 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7331 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7332 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7333 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7336 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7339 switch (res >> 26) {
7340 case ALC880_HP_EVENT:
7341 printk("hp_event\n");
7342 alc888_6st_dell_front_automute(codec);
7348 * generic initialization of ADC, input mixers and output mixers
7350 static struct hda_verb alc883_auto_init_verbs[] = {
7352 * Unmute ADC0-2 and set the default input to mic-in
7354 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7356 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7357 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7359 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7361 * Note: PASD motherboards uses the Line In 2 as the input for
7362 * front panel mic (mic 2)
7364 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7372 * Set up output mixers (0x0c - 0x0f)
7374 /* set vol=0 to output mixers */
7375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7376 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7377 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7378 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7379 /* set up input amps for analog loopback */
7380 /* Amp Indices: DAC = 0, mixer = 1 */
7381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7387 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7388 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7389 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7390 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7392 /* FIXME: use matrix-type input source selection */
7393 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7398 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7404 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7410 /* capture mixer elements */
7411 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7412 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7413 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7414 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7415 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7417 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7418 /* The multiple "Capture Source" controls confuse alsamixer
7419 * So call somewhat different..
7421 /* .name = "Capture Source", */
7422 .name = "Input Source",
7424 .info = alc882_mux_enum_info,
7425 .get = alc882_mux_enum_get,
7426 .put = alc882_mux_enum_put,
7431 #ifdef CONFIG_SND_HDA_POWER_SAVE
7432 #define alc883_loopbacks alc880_loopbacks
7435 /* pcm configuration: identiacal with ALC880 */
7436 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7437 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7438 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7439 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7440 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7443 * configuration and preset
7445 static const char *alc883_models[ALC883_MODEL_LAST] = {
7446 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7447 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7448 [ALC883_3ST_6ch] = "3stack-6ch",
7449 [ALC883_6ST_DIG] = "6stack-dig",
7450 [ALC883_TARGA_DIG] = "targa-dig",
7451 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7452 [ALC883_ACER] = "acer",
7453 [ALC883_ACER_ASPIRE] = "acer-aspire",
7454 [ALC883_MEDION] = "medion",
7455 [ALC883_MEDION_MD2] = "medion-md2",
7456 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7457 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7458 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7459 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7460 [ALC883_HAIER_W66] = "haier-w66",
7461 [ALC888_6ST_HP] = "6stack-hp",
7462 [ALC888_3ST_HP] = "3stack-hp",
7463 [ALC888_6ST_DELL] = "6stack-dell",
7464 [ALC883_MITAC] = "mitac",
7465 [ALC883_AUTO] = "auto",
7468 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7469 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7470 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7471 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7472 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7473 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7474 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7475 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7476 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7477 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7478 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7479 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7480 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7481 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7482 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7483 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7484 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7485 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7486 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7487 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7488 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7489 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7490 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7491 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7492 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7493 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7494 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7495 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7496 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7497 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7498 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7499 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7500 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7501 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7502 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7503 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7504 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7505 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7506 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7507 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7508 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7509 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7510 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7511 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7512 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7513 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7514 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7518 static struct alc_config_preset alc883_presets[] = {
7519 [ALC883_3ST_2ch_DIG] = {
7520 .mixers = { alc883_3ST_2ch_mixer },
7521 .init_verbs = { alc883_init_verbs },
7522 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7523 .dac_nids = alc883_dac_nids,
7524 .dig_out_nid = ALC883_DIGOUT_NID,
7525 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7526 .adc_nids = alc883_adc_nids,
7527 .dig_in_nid = ALC883_DIGIN_NID,
7528 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7529 .channel_mode = alc883_3ST_2ch_modes,
7530 .input_mux = &alc883_capture_source,
7532 [ALC883_3ST_6ch_DIG] = {
7533 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7534 .init_verbs = { alc883_init_verbs },
7535 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7536 .dac_nids = alc883_dac_nids,
7537 .dig_out_nid = ALC883_DIGOUT_NID,
7538 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7539 .adc_nids = alc883_adc_nids,
7540 .dig_in_nid = ALC883_DIGIN_NID,
7541 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7542 .channel_mode = alc883_3ST_6ch_modes,
7544 .input_mux = &alc883_capture_source,
7546 [ALC883_3ST_6ch] = {
7547 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7548 .init_verbs = { alc883_init_verbs },
7549 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7550 .dac_nids = alc883_dac_nids,
7551 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7552 .adc_nids = alc883_adc_nids,
7553 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7554 .channel_mode = alc883_3ST_6ch_modes,
7556 .input_mux = &alc883_capture_source,
7558 [ALC883_6ST_DIG] = {
7559 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7560 .init_verbs = { alc883_init_verbs },
7561 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7562 .dac_nids = alc883_dac_nids,
7563 .dig_out_nid = ALC883_DIGOUT_NID,
7564 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7565 .adc_nids = alc883_adc_nids,
7566 .dig_in_nid = ALC883_DIGIN_NID,
7567 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7568 .channel_mode = alc883_sixstack_modes,
7569 .input_mux = &alc883_capture_source,
7571 [ALC883_TARGA_DIG] = {
7572 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7573 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7574 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7575 .dac_nids = alc883_dac_nids,
7576 .dig_out_nid = ALC883_DIGOUT_NID,
7577 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7578 .adc_nids = alc883_adc_nids,
7579 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7580 .channel_mode = alc883_3ST_6ch_modes,
7582 .input_mux = &alc883_capture_source,
7583 .unsol_event = alc883_tagra_unsol_event,
7584 .init_hook = alc883_tagra_automute,
7586 [ALC883_TARGA_2ch_DIG] = {
7587 .mixers = { alc883_tagra_2ch_mixer},
7588 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7589 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7590 .dac_nids = alc883_dac_nids,
7591 .dig_out_nid = ALC883_DIGOUT_NID,
7592 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7593 .adc_nids = alc883_adc_nids,
7594 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7595 .channel_mode = alc883_3ST_2ch_modes,
7596 .input_mux = &alc883_capture_source,
7597 .unsol_event = alc883_tagra_unsol_event,
7598 .init_hook = alc883_tagra_automute,
7601 .mixers = { alc883_base_mixer },
7602 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7603 * and the headphone jack. Turn this on and rely on the
7604 * standard mute methods whenever the user wants to turn
7605 * these outputs off.
7607 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7608 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7609 .dac_nids = alc883_dac_nids,
7610 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7611 .adc_nids = alc883_adc_nids,
7612 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7613 .channel_mode = alc883_3ST_2ch_modes,
7614 .input_mux = &alc883_capture_source,
7616 [ALC883_ACER_ASPIRE] = {
7617 .mixers = { alc883_acer_aspire_mixer },
7618 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7620 .dac_nids = alc883_dac_nids,
7621 .dig_out_nid = ALC883_DIGOUT_NID,
7622 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7623 .adc_nids = alc883_adc_nids,
7624 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7625 .channel_mode = alc883_3ST_2ch_modes,
7626 .input_mux = &alc883_capture_source,
7627 .unsol_event = alc883_acer_aspire_unsol_event,
7628 .init_hook = alc883_acer_aspire_automute,
7631 .mixers = { alc883_fivestack_mixer,
7632 alc883_chmode_mixer },
7633 .init_verbs = { alc883_init_verbs,
7634 alc883_medion_eapd_verbs },
7635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7636 .dac_nids = alc883_dac_nids,
7637 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7638 .adc_nids = alc883_adc_nids,
7639 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7640 .channel_mode = alc883_sixstack_modes,
7641 .input_mux = &alc883_capture_source,
7643 [ALC883_MEDION_MD2] = {
7644 .mixers = { alc883_medion_md2_mixer},
7645 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7646 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7647 .dac_nids = alc883_dac_nids,
7648 .dig_out_nid = ALC883_DIGOUT_NID,
7649 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7650 .adc_nids = alc883_adc_nids,
7651 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7652 .channel_mode = alc883_3ST_2ch_modes,
7653 .input_mux = &alc883_capture_source,
7654 .unsol_event = alc883_medion_md2_unsol_event,
7655 .init_hook = alc883_medion_md2_automute,
7657 [ALC883_LAPTOP_EAPD] = {
7658 .mixers = { alc883_base_mixer },
7659 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7660 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7661 .dac_nids = alc883_dac_nids,
7662 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7663 .adc_nids = alc883_adc_nids,
7664 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7665 .channel_mode = alc883_3ST_2ch_modes,
7666 .input_mux = &alc883_capture_source,
7668 [ALC883_LENOVO_101E_2ch] = {
7669 .mixers = { alc883_lenovo_101e_2ch_mixer},
7670 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7672 .dac_nids = alc883_dac_nids,
7673 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7674 .adc_nids = alc883_adc_nids,
7675 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7676 .channel_mode = alc883_3ST_2ch_modes,
7677 .input_mux = &alc883_lenovo_101e_capture_source,
7678 .unsol_event = alc883_lenovo_101e_unsol_event,
7679 .init_hook = alc883_lenovo_101e_all_automute,
7681 [ALC883_LENOVO_NB0763] = {
7682 .mixers = { alc883_lenovo_nb0763_mixer },
7683 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7684 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7685 .dac_nids = alc883_dac_nids,
7686 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7687 .adc_nids = alc883_adc_nids,
7688 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7689 .channel_mode = alc883_3ST_2ch_modes,
7691 .input_mux = &alc883_lenovo_nb0763_capture_source,
7692 .unsol_event = alc883_medion_md2_unsol_event,
7693 .init_hook = alc883_medion_md2_automute,
7695 [ALC888_LENOVO_MS7195_DIG] = {
7696 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7697 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7698 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7699 .dac_nids = alc883_dac_nids,
7700 .dig_out_nid = ALC883_DIGOUT_NID,
7701 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7702 .adc_nids = alc883_adc_nids,
7703 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7704 .channel_mode = alc883_3ST_6ch_modes,
7706 .input_mux = &alc883_capture_source,
7707 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7708 .init_hook = alc888_lenovo_ms7195_front_automute,
7710 [ALC883_HAIER_W66] = {
7711 .mixers = { alc883_tagra_2ch_mixer},
7712 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7713 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7714 .dac_nids = alc883_dac_nids,
7715 .dig_out_nid = ALC883_DIGOUT_NID,
7716 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7717 .adc_nids = alc883_adc_nids,
7718 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7719 .channel_mode = alc883_3ST_2ch_modes,
7720 .input_mux = &alc883_capture_source,
7721 .unsol_event = alc883_haier_w66_unsol_event,
7722 .init_hook = alc883_haier_w66_automute,
7725 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7726 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7727 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7728 .dac_nids = alc883_dac_nids,
7729 .dig_out_nid = ALC883_DIGOUT_NID,
7730 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7731 .adc_nids = alc883_adc_nids,
7732 .dig_in_nid = ALC883_DIGIN_NID,
7733 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7734 .channel_mode = alc883_sixstack_modes,
7735 .input_mux = &alc883_capture_source,
7738 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7739 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7740 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7741 .dac_nids = alc883_dac_nids,
7742 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7743 .adc_nids = alc883_adc_nids,
7744 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7745 .channel_mode = alc888_3st_hp_modes,
7747 .input_mux = &alc883_capture_source,
7749 [ALC888_6ST_DELL] = {
7750 .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer },
7751 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7752 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7753 .dac_nids = alc883_dac_nids,
7754 .dig_out_nid = ALC883_DIGOUT_NID,
7755 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7756 .adc_nids = alc883_adc_nids,
7757 .dig_in_nid = ALC883_DIGIN_NID,
7758 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7759 .channel_mode = alc883_sixstack_modes,
7760 .input_mux = &alc883_capture_source,
7761 .unsol_event = alc888_6st_dell_unsol_event,
7762 .init_hook = alc888_6st_dell_front_automute,
7765 .mixers = { alc883_mitac_mixer },
7766 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7767 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7768 .dac_nids = alc883_dac_nids,
7769 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7770 .adc_nids = alc883_adc_nids,
7771 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7772 .channel_mode = alc883_3ST_2ch_modes,
7773 .input_mux = &alc883_capture_source,
7774 .unsol_event = alc883_mitac_unsol_event,
7775 .init_hook = alc883_mitac_automute,
7781 * BIOS auto configuration
7783 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7784 hda_nid_t nid, int pin_type,
7788 struct alc_spec *spec = codec->spec;
7791 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7794 idx = spec->multiout.dac_nids[dac_idx] - 2;
7796 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7798 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7800 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7804 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7806 struct alc_spec *spec = codec->spec;
7809 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7810 for (i = 0; i <= HDA_SIDE; i++) {
7811 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7812 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7814 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7819 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7821 struct alc_spec *spec = codec->spec;
7824 pin = spec->autocfg.hp_pins[0];
7825 if (pin) /* connect to front */
7827 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7830 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7831 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7833 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7835 struct alc_spec *spec = codec->spec;
7838 for (i = 0; i < AUTO_PIN_LAST; i++) {
7839 hda_nid_t nid = spec->autocfg.input_pins[i];
7840 if (alc883_is_input_pin(nid)) {
7841 snd_hda_codec_write(codec, nid, 0,
7842 AC_VERB_SET_PIN_WIDGET_CONTROL,
7843 (i <= AUTO_PIN_FRONT_MIC ?
7844 PIN_VREF80 : PIN_IN));
7845 if (nid != ALC883_PIN_CD_NID)
7846 snd_hda_codec_write(codec, nid, 0,
7847 AC_VERB_SET_AMP_GAIN_MUTE,
7853 /* almost identical with ALC880 parser... */
7854 static int alc883_parse_auto_config(struct hda_codec *codec)
7856 struct alc_spec *spec = codec->spec;
7857 int err = alc880_parse_auto_config(codec);
7862 return 0; /* no config found */
7864 err = alc_auto_add_mic_boost(codec);
7868 /* hack - override the init verbs */
7869 spec->init_verbs[0] = alc883_auto_init_verbs;
7870 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7873 return 1; /* config found */
7876 /* additional initialization for auto-configuration model */
7877 static void alc883_auto_init(struct hda_codec *codec)
7879 alc883_auto_init_multi_out(codec);
7880 alc883_auto_init_hp_out(codec);
7881 alc883_auto_init_analog_input(codec);
7884 static int patch_alc883(struct hda_codec *codec)
7886 struct alc_spec *spec;
7887 int err, board_config;
7889 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7895 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7898 if (board_config < 0) {
7899 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7900 "trying auto-probe from BIOS...\n");
7901 board_config = ALC883_AUTO;
7904 if (board_config == ALC883_AUTO) {
7905 /* automatic parse from the BIOS config */
7906 err = alc883_parse_auto_config(codec);
7912 "hda_codec: Cannot set up configuration "
7913 "from BIOS. Using base mode...\n");
7914 board_config = ALC883_3ST_2ch_DIG;
7918 if (board_config != ALC883_AUTO)
7919 setup_preset(spec, &alc883_presets[board_config]);
7921 spec->stream_name_analog = "ALC883 Analog";
7922 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7923 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7924 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
7926 spec->stream_name_digital = "ALC883 Digital";
7927 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7928 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7930 if (!spec->adc_nids && spec->input_mux) {
7931 spec->adc_nids = alc883_adc_nids;
7932 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7935 spec->vmaster_nid = 0x0c;
7937 codec->patch_ops = alc_patch_ops;
7938 if (board_config == ALC883_AUTO)
7939 spec->init_hook = alc883_auto_init;
7940 #ifdef CONFIG_SND_HDA_POWER_SAVE
7941 if (!spec->loopback.amplist)
7942 spec->loopback.amplist = alc883_loopbacks;
7952 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7953 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7955 #define alc262_dac_nids alc260_dac_nids
7956 #define alc262_adc_nids alc882_adc_nids
7957 #define alc262_adc_nids_alt alc882_adc_nids_alt
7959 #define alc262_modes alc260_modes
7960 #define alc262_capture_source alc882_capture_source
7962 static struct snd_kcontrol_new alc262_base_mixer[] = {
7963 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7964 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7971 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7972 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7973 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7975 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7976 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7977 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7979 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7980 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7984 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7985 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7986 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7987 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7988 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7997 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7998 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7999 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8004 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8005 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8006 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8008 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8009 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8015 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8018 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8019 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8020 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8021 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8022 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8023 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8024 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8028 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8029 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8030 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8031 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8033 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8034 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8035 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8036 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8039 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8040 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8041 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8042 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8043 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8047 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8048 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8049 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8054 /* mute/unmute internal speaker according to the hp jack and mute state */
8055 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8057 struct alc_spec *spec = codec->spec;
8059 if (force || !spec->sense_updated) {
8060 unsigned int present;
8061 present = snd_hda_codec_read(codec, 0x15, 0,
8062 AC_VERB_GET_PIN_SENSE, 0);
8063 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8064 spec->sense_updated = 1;
8066 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8067 spec->jack_present ? HDA_AMP_MUTE : 0);
8070 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8073 if ((res >> 26) != ALC880_HP_EVENT)
8075 alc262_hp_t5735_automute(codec, 1);
8078 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8080 alc262_hp_t5735_automute(codec, 1);
8083 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8084 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8085 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8086 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8089 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8094 static struct hda_verb alc262_hp_t5735_verbs[] = {
8095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8098 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8102 static struct hda_bind_ctls alc262_hp_rp5700_bind_front_vol = {
8103 .ops = &snd_hda_bind_vol,
8105 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8106 HDA_COMPOSE_AMP_VAL(0x0e, 3, 0, HDA_OUTPUT),
8111 static struct hda_bind_ctls alc262_hp_rp5700_bind_front_sw = {
8112 .ops = &snd_hda_bind_sw,
8114 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8115 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
8120 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8121 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_rp5700_bind_front_vol),
8122 HDA_BIND_SW("PCM Playback Switch", &alc262_hp_rp5700_bind_front_sw),
8123 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8124 HDA_CODEC_MUTE("Master Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8125 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8126 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8132 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8133 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8134 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8135 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8136 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8137 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8138 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8139 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8140 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8141 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8142 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8146 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8153 /* bind hp and internal speaker mute (with plug check) */
8154 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8155 struct snd_ctl_elem_value *ucontrol)
8157 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8158 long *valp = ucontrol->value.integer.value;
8161 /* change hp mute */
8162 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8164 valp[0] ? 0 : HDA_AMP_MUTE);
8165 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8167 valp[1] ? 0 : HDA_AMP_MUTE);
8169 /* change speaker according to HP jack state */
8170 struct alc_spec *spec = codec->spec;
8172 if (spec->jack_present)
8173 mute = HDA_AMP_MUTE;
8175 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8177 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8178 HDA_AMP_MUTE, mute);
8183 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8184 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8186 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8187 .name = "Master Playback Switch",
8188 .info = snd_hda_mixer_amp_switch_info,
8189 .get = snd_hda_mixer_amp_switch_get,
8190 .put = alc262_sony_master_sw_put,
8191 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8195 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8196 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8200 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8201 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8202 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8206 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8207 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8211 #define alc262_capture_mixer alc882_capture_mixer
8212 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8215 * generic initialization of ADC, input mixers and output mixers
8217 static struct hda_verb alc262_init_verbs[] = {
8219 * Unmute ADC0-2 and set the default input to mic-in
8221 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8223 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8224 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8225 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8226 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8230 * Note: PASD motherboards uses the Line In 2 as the input for
8231 * front panel mic (mic 2)
8233 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8241 * Set up output mixers (0x0c - 0x0e)
8243 /* set vol=0 to output mixers */
8244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8245 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8246 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8247 /* set up input amps for analog loopback */
8248 /* Amp Indices: DAC = 0, mixer = 1 */
8249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8258 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8259 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8260 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8261 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8263 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8265 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8269 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8270 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8272 /* FIXME: use matrix-type input source selection */
8273 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8274 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8293 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8294 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8299 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8300 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8301 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8302 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8304 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8305 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8309 static struct hda_verb alc262_sony_unsol_verbs[] = {
8310 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8311 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8312 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8314 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8318 /* mute/unmute internal speaker according to the hp jack and mute state */
8319 static void alc262_hippo_automute(struct hda_codec *codec)
8321 struct alc_spec *spec = codec->spec;
8323 unsigned int present;
8325 /* need to execute and sync at first */
8326 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8327 present = snd_hda_codec_read(codec, 0x15, 0,
8328 AC_VERB_GET_PIN_SENSE, 0);
8329 spec->jack_present = (present & 0x80000000) != 0;
8330 if (spec->jack_present) {
8331 /* mute internal speaker */
8332 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8333 HDA_AMP_MUTE, HDA_AMP_MUTE);
8335 /* unmute internal speaker if necessary */
8336 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8337 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8338 HDA_AMP_MUTE, mute);
8342 /* unsolicited event for HP jack sensing */
8343 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8346 if ((res >> 26) != ALC880_HP_EVENT)
8348 alc262_hippo_automute(codec);
8351 static void alc262_hippo1_automute(struct hda_codec *codec)
8354 unsigned int present;
8356 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8357 present = snd_hda_codec_read(codec, 0x1b, 0,
8358 AC_VERB_GET_PIN_SENSE, 0);
8359 present = (present & 0x80000000) != 0;
8361 /* mute internal speaker */
8362 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8363 HDA_AMP_MUTE, HDA_AMP_MUTE);
8365 /* unmute internal speaker if necessary */
8366 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8367 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8368 HDA_AMP_MUTE, mute);
8372 /* unsolicited event for HP jack sensing */
8373 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8376 if ((res >> 26) != ALC880_HP_EVENT)
8378 alc262_hippo1_automute(codec);
8383 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8386 #define ALC_HP_EVENT 0x37
8388 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8389 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8394 static struct hda_input_mux alc262_fujitsu_capture_source = {
8403 static struct hda_input_mux alc262_HP_capture_source = {
8407 { "Front Mic", 0x1 },
8414 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8418 { "Front Mic", 0x2 },
8424 /* mute/unmute internal speaker according to the hp jack and mute state */
8425 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8427 struct alc_spec *spec = codec->spec;
8430 if (force || !spec->sense_updated) {
8431 unsigned int present;
8432 /* need to execute and sync at first */
8433 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8434 present = snd_hda_codec_read(codec, 0x14, 0,
8435 AC_VERB_GET_PIN_SENSE, 0);
8436 spec->jack_present = (present & 0x80000000) != 0;
8437 spec->sense_updated = 1;
8439 if (spec->jack_present) {
8440 /* mute internal speaker */
8441 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8442 HDA_AMP_MUTE, HDA_AMP_MUTE);
8444 /* unmute internal speaker if necessary */
8445 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8446 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8447 HDA_AMP_MUTE, mute);
8451 /* unsolicited event for HP jack sensing */
8452 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8455 if ((res >> 26) != ALC_HP_EVENT)
8457 alc262_fujitsu_automute(codec, 1);
8460 /* bind volumes of both NID 0x0c and 0x0d */
8461 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8462 .ops = &snd_hda_bind_vol,
8464 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8465 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8470 /* bind hp and internal speaker mute (with plug check) */
8471 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8472 struct snd_ctl_elem_value *ucontrol)
8474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8475 long *valp = ucontrol->value.integer.value;
8478 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8480 valp[0] ? 0 : HDA_AMP_MUTE);
8481 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8483 valp[1] ? 0 : HDA_AMP_MUTE);
8485 alc262_fujitsu_automute(codec, 0);
8489 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8490 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8493 .name = "Master Playback Switch",
8494 .info = snd_hda_mixer_amp_switch_info,
8495 .get = snd_hda_mixer_amp_switch_get,
8496 .put = alc262_fujitsu_master_sw_put,
8497 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8499 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8500 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8501 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8504 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8505 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8506 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8510 /* additional init verbs for Benq laptops */
8511 static struct hda_verb alc262_EAPD_verbs[] = {
8512 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8513 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8517 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8519 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8521 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8522 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8526 /* Samsung Q1 Ultra Vista model setup */
8527 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8528 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8529 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8533 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8537 static struct hda_verb alc262_ultra_verbs[] = {
8538 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8540 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8541 /* Mic is on Node 0x19 */
8542 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8543 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8544 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8545 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8547 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8548 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8552 static struct hda_input_mux alc262_ultra_capture_source = {
8559 /* mute/unmute internal speaker according to the hp jack and mute state */
8560 static void alc262_ultra_automute(struct hda_codec *codec)
8562 struct alc_spec *spec = codec->spec;
8564 unsigned int present;
8566 /* need to execute and sync at first */
8567 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8568 present = snd_hda_codec_read(codec, 0x15, 0,
8569 AC_VERB_GET_PIN_SENSE, 0);
8570 spec->jack_present = (present & 0x80000000) != 0;
8571 if (spec->jack_present) {
8572 /* mute internal speaker */
8573 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8574 HDA_AMP_MUTE, HDA_AMP_MUTE);
8576 /* unmute internal speaker if necessary */
8577 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8578 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8579 HDA_AMP_MUTE, mute);
8583 /* unsolicited event for HP jack sensing */
8584 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8587 if ((res >> 26) != ALC880_HP_EVENT)
8589 alc262_ultra_automute(codec);
8592 /* add playback controls from the parsed DAC table */
8593 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8594 const struct auto_pin_cfg *cfg)
8599 spec->multiout.num_dacs = 1; /* only use one dac */
8600 spec->multiout.dac_nids = spec->private_dac_nids;
8601 spec->multiout.dac_nids[0] = 2;
8603 nid = cfg->line_out_pins[0];
8605 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8606 "Front Playback Volume",
8607 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8610 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8611 "Front Playback Switch",
8612 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8617 nid = cfg->speaker_pins[0];
8620 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8621 "Speaker Playback Volume",
8622 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8626 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8627 "Speaker Playback Switch",
8628 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8633 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8634 "Speaker Playback Switch",
8635 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8641 nid = cfg->hp_pins[0];
8643 /* spec->multiout.hp_nid = 2; */
8645 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8646 "Headphone Playback Volume",
8647 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8651 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8652 "Headphone Playback Switch",
8653 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8658 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8659 "Headphone Playback Switch",
8660 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8669 /* identical with ALC880 */
8670 #define alc262_auto_create_analog_input_ctls \
8671 alc880_auto_create_analog_input_ctls
8674 * generic initialization of ADC, input mixers and output mixers
8676 static struct hda_verb alc262_volume_init_verbs[] = {
8678 * Unmute ADC0-2 and set the default input to mic-in
8680 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8681 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8682 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8684 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8687 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8689 * Note: PASD motherboards uses the Line In 2 as the input for
8690 * front panel mic (mic 2)
8692 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8693 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8694 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8695 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8700 * Set up output mixers (0x0c - 0x0f)
8702 /* set vol=0 to output mixers */
8703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8707 /* set up input amps for analog loopback */
8708 /* Amp Indices: DAC = 0, mixer = 1 */
8709 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8710 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8711 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8713 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8716 /* FIXME: use matrix-type input source selection */
8717 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8718 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8719 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8720 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8721 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8722 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8725 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8726 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8727 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8731 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8737 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8739 * Unmute ADC0-2 and set the default input to mic-in
8741 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8743 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8744 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8745 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8746 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8748 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8750 * Note: PASD motherboards uses the Line In 2 as the input for
8751 * front panel mic (mic 2)
8753 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8754 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8755 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8757 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8763 * Set up output mixers (0x0c - 0x0e)
8765 /* set vol=0 to output mixers */
8766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8767 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8768 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8770 /* set up input amps for analog loopback */
8771 /* Amp Indices: DAC = 0, mixer = 1 */
8772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8773 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8774 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8775 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8776 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8777 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8781 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8783 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8786 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8787 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8790 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8791 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8793 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8795 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8796 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8797 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8798 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8799 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8800 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8803 /* FIXME: use matrix-type input source selection */
8804 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8805 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8806 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8807 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8808 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8809 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8811 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8812 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8813 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8814 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8824 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8826 * Unmute ADC0-2 and set the default input to mic-in
8828 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8829 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8830 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8831 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8832 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8833 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8835 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8837 * Note: PASD motherboards uses the Line In 2 as the input for front
8840 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8847 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8850 * Set up output mixers (0x0c - 0x0e)
8852 /* set vol=0 to output mixers */
8853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8854 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8855 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8857 /* set up input amps for analog loopback */
8858 /* Amp Indices: DAC = 0, mixer = 1 */
8859 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8861 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8862 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8863 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8864 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8867 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8868 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8869 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8870 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8871 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8872 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8873 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8875 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8878 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8879 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8881 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8882 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8883 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8884 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8885 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8886 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8888 /* FIXME: use matrix-type input source selection */
8889 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8890 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8891 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8892 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8893 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8895 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
8896 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8897 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
8899 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8900 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8901 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8902 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8903 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8904 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8905 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8912 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8918 #ifdef CONFIG_SND_HDA_POWER_SAVE
8919 #define alc262_loopbacks alc880_loopbacks
8922 /* pcm configuration: identiacal with ALC880 */
8923 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8924 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8925 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8926 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8929 * BIOS auto configuration
8931 static int alc262_parse_auto_config(struct hda_codec *codec)
8933 struct alc_spec *spec = codec->spec;
8935 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
8937 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8941 if (!spec->autocfg.line_outs)
8942 return 0; /* can't find valid BIOS pin config */
8943 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
8946 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
8950 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
8952 if (spec->autocfg.dig_out_pin)
8953 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
8954 if (spec->autocfg.dig_in_pin)
8955 spec->dig_in_nid = ALC262_DIGIN_NID;
8957 if (spec->kctl_alloc)
8958 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8960 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
8961 spec->num_mux_defs = 1;
8962 spec->input_mux = &spec->private_imux;
8964 err = alc_auto_add_mic_boost(codec);
8971 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8972 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8973 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8976 /* init callback for auto-configuration model -- overriding the default init */
8977 static void alc262_auto_init(struct hda_codec *codec)
8979 alc262_auto_init_multi_out(codec);
8980 alc262_auto_init_hp_out(codec);
8981 alc262_auto_init_analog_input(codec);
8985 * configuration and preset
8987 static const char *alc262_models[ALC262_MODEL_LAST] = {
8988 [ALC262_BASIC] = "basic",
8989 [ALC262_HIPPO] = "hippo",
8990 [ALC262_HIPPO_1] = "hippo_1",
8991 [ALC262_FUJITSU] = "fujitsu",
8992 [ALC262_HP_BPC] = "hp-bpc",
8993 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
8994 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
8995 [ALC262_HP_RP5700] = "hp-rp5700",
8996 [ALC262_BENQ_ED8] = "benq",
8997 [ALC262_BENQ_T31] = "benq-t31",
8998 [ALC262_SONY_ASSAMD] = "sony-assamd",
8999 [ALC262_ULTRA] = "ultra",
9000 [ALC262_AUTO] = "auto",
9003 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9004 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9005 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9006 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9007 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9008 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9009 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9010 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9011 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9012 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9013 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9014 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9015 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9016 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9017 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9018 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9019 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9020 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9021 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9022 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9023 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9024 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9025 ALC262_HP_TC_T5735),
9026 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9027 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9028 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9029 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9030 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9031 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9032 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9033 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9034 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9035 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9036 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9040 static struct alc_config_preset alc262_presets[] = {
9042 .mixers = { alc262_base_mixer },
9043 .init_verbs = { alc262_init_verbs },
9044 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9045 .dac_nids = alc262_dac_nids,
9047 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9048 .channel_mode = alc262_modes,
9049 .input_mux = &alc262_capture_source,
9052 .mixers = { alc262_base_mixer },
9053 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9054 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9055 .dac_nids = alc262_dac_nids,
9057 .dig_out_nid = ALC262_DIGOUT_NID,
9058 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9059 .channel_mode = alc262_modes,
9060 .input_mux = &alc262_capture_source,
9061 .unsol_event = alc262_hippo_unsol_event,
9062 .init_hook = alc262_hippo_automute,
9064 [ALC262_HIPPO_1] = {
9065 .mixers = { alc262_hippo1_mixer },
9066 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9067 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9068 .dac_nids = alc262_dac_nids,
9070 .dig_out_nid = ALC262_DIGOUT_NID,
9071 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9072 .channel_mode = alc262_modes,
9073 .input_mux = &alc262_capture_source,
9074 .unsol_event = alc262_hippo1_unsol_event,
9075 .init_hook = alc262_hippo1_automute,
9077 [ALC262_FUJITSU] = {
9078 .mixers = { alc262_fujitsu_mixer },
9079 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9080 alc262_fujitsu_unsol_verbs },
9081 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9082 .dac_nids = alc262_dac_nids,
9084 .dig_out_nid = ALC262_DIGOUT_NID,
9085 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9086 .channel_mode = alc262_modes,
9087 .input_mux = &alc262_fujitsu_capture_source,
9088 .unsol_event = alc262_fujitsu_unsol_event,
9091 .mixers = { alc262_HP_BPC_mixer },
9092 .init_verbs = { alc262_HP_BPC_init_verbs },
9093 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9094 .dac_nids = alc262_dac_nids,
9096 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9097 .channel_mode = alc262_modes,
9098 .input_mux = &alc262_HP_capture_source,
9100 [ALC262_HP_BPC_D7000_WF] = {
9101 .mixers = { alc262_HP_BPC_WildWest_mixer },
9102 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9103 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9104 .dac_nids = alc262_dac_nids,
9106 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9107 .channel_mode = alc262_modes,
9108 .input_mux = &alc262_HP_D7000_capture_source,
9110 [ALC262_HP_BPC_D7000_WL] = {
9111 .mixers = { alc262_HP_BPC_WildWest_mixer,
9112 alc262_HP_BPC_WildWest_option_mixer },
9113 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9114 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9115 .dac_nids = alc262_dac_nids,
9117 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9118 .channel_mode = alc262_modes,
9119 .input_mux = &alc262_HP_D7000_capture_source,
9121 [ALC262_HP_TC_T5735] = {
9122 .mixers = { alc262_hp_t5735_mixer },
9123 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9124 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9125 .dac_nids = alc262_dac_nids,
9127 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9128 .channel_mode = alc262_modes,
9129 .input_mux = &alc262_capture_source,
9130 .unsol_event = alc262_hp_t5735_unsol_event,
9131 .init_hook = alc262_hp_t5735_init_hook,
9133 [ALC262_HP_RP5700] = {
9134 .mixers = { alc262_hp_rp5700_mixer },
9135 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9136 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9137 .dac_nids = alc262_dac_nids,
9138 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9139 .channel_mode = alc262_modes,
9140 .input_mux = &alc262_hp_rp5700_capture_source,
9142 [ALC262_BENQ_ED8] = {
9143 .mixers = { alc262_base_mixer },
9144 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9145 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9146 .dac_nids = alc262_dac_nids,
9148 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9149 .channel_mode = alc262_modes,
9150 .input_mux = &alc262_capture_source,
9152 [ALC262_SONY_ASSAMD] = {
9153 .mixers = { alc262_sony_mixer },
9154 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9155 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9156 .dac_nids = alc262_dac_nids,
9158 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9159 .channel_mode = alc262_modes,
9160 .input_mux = &alc262_capture_source,
9161 .unsol_event = alc262_hippo_unsol_event,
9162 .init_hook = alc262_hippo_automute,
9164 [ALC262_BENQ_T31] = {
9165 .mixers = { alc262_benq_t31_mixer },
9166 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9167 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9168 .dac_nids = alc262_dac_nids,
9170 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9171 .channel_mode = alc262_modes,
9172 .input_mux = &alc262_capture_source,
9173 .unsol_event = alc262_hippo_unsol_event,
9174 .init_hook = alc262_hippo_automute,
9177 .mixers = { alc262_ultra_mixer },
9178 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
9179 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9180 .dac_nids = alc262_dac_nids,
9182 .dig_out_nid = ALC262_DIGOUT_NID,
9183 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9184 .channel_mode = alc262_modes,
9185 .input_mux = &alc262_ultra_capture_source,
9186 .unsol_event = alc262_ultra_unsol_event,
9187 .init_hook = alc262_ultra_automute,
9191 static int patch_alc262(struct hda_codec *codec)
9193 struct alc_spec *spec;
9197 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9203 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9208 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9209 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9210 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9211 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9215 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9219 if (board_config < 0) {
9220 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9221 "trying auto-probe from BIOS...\n");
9222 board_config = ALC262_AUTO;
9225 if (board_config == ALC262_AUTO) {
9226 /* automatic parse from the BIOS config */
9227 err = alc262_parse_auto_config(codec);
9233 "hda_codec: Cannot set up configuration "
9234 "from BIOS. Using base mode...\n");
9235 board_config = ALC262_BASIC;
9239 if (board_config != ALC262_AUTO)
9240 setup_preset(spec, &alc262_presets[board_config]);
9242 spec->stream_name_analog = "ALC262 Analog";
9243 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9244 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9246 spec->stream_name_digital = "ALC262 Digital";
9247 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9248 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9250 if (!spec->adc_nids && spec->input_mux) {
9251 /* check whether NID 0x07 is valid */
9252 unsigned int wcap = get_wcaps(codec, 0x07);
9255 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9256 if (wcap != AC_WID_AUD_IN) {
9257 spec->adc_nids = alc262_adc_nids_alt;
9258 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9259 spec->mixers[spec->num_mixers] =
9260 alc262_capture_alt_mixer;
9263 spec->adc_nids = alc262_adc_nids;
9264 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9265 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9270 spec->vmaster_nid = 0x0c;
9272 codec->patch_ops = alc_patch_ops;
9273 if (board_config == ALC262_AUTO)
9274 spec->init_hook = alc262_auto_init;
9275 #ifdef CONFIG_SND_HDA_POWER_SAVE
9276 if (!spec->loopback.amplist)
9277 spec->loopback.amplist = alc262_loopbacks;
9284 * ALC268 channel source setting (2 channel)
9286 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9287 #define alc268_modes alc260_modes
9289 static hda_nid_t alc268_dac_nids[2] = {
9294 static hda_nid_t alc268_adc_nids[2] = {
9299 static hda_nid_t alc268_adc_nids_alt[1] = {
9304 static struct snd_kcontrol_new alc268_base_mixer[] = {
9305 /* output mixer control */
9306 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9307 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9308 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9310 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9311 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9312 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9316 static struct hda_verb alc268_eapd_verbs[] = {
9317 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9318 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9322 /* Toshiba specific */
9323 #define alc268_toshiba_automute alc262_hippo_automute
9325 static struct hda_verb alc268_toshiba_verbs[] = {
9326 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9331 /* bind volumes of both NID 0x02 and 0x03 */
9332 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9333 .ops = &snd_hda_bind_vol,
9335 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9336 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9341 /* mute/unmute internal speaker according to the hp jack and mute state */
9342 static void alc268_acer_automute(struct hda_codec *codec, int force)
9344 struct alc_spec *spec = codec->spec;
9347 if (force || !spec->sense_updated) {
9348 unsigned int present;
9349 present = snd_hda_codec_read(codec, 0x14, 0,
9350 AC_VERB_GET_PIN_SENSE, 0);
9351 spec->jack_present = (present & 0x80000000) != 0;
9352 spec->sense_updated = 1;
9354 if (spec->jack_present)
9355 mute = HDA_AMP_MUTE; /* mute internal speaker */
9356 else /* unmute internal speaker if necessary */
9357 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9358 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9359 HDA_AMP_MUTE, mute);
9363 /* bind hp and internal speaker mute (with plug check) */
9364 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9365 struct snd_ctl_elem_value *ucontrol)
9367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9368 long *valp = ucontrol->value.integer.value;
9371 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9373 valp[0] ? 0 : HDA_AMP_MUTE);
9374 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9376 valp[1] ? 0 : HDA_AMP_MUTE);
9378 alc268_acer_automute(codec, 0);
9382 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9383 /* output mixer control */
9384 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9387 .name = "Master Playback Switch",
9388 .info = snd_hda_mixer_amp_switch_info,
9389 .get = snd_hda_mixer_amp_switch_get,
9390 .put = alc268_acer_master_sw_put,
9391 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9393 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9394 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9395 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9399 static struct hda_verb alc268_acer_verbs[] = {
9400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9401 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9403 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9407 /* unsolicited event for HP jack sensing */
9408 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9411 if ((res >> 26) != ALC880_HP_EVENT)
9413 alc268_toshiba_automute(codec);
9416 static void alc268_acer_unsol_event(struct hda_codec *codec,
9419 if ((res >> 26) != ALC880_HP_EVENT)
9421 alc268_acer_automute(codec, 1);
9424 static void alc268_acer_init_hook(struct hda_codec *codec)
9426 alc268_acer_automute(codec, 1);
9429 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9430 /* output mixer control */
9431 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9432 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9433 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9435 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9436 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9440 static struct hda_verb alc268_dell_verbs[] = {
9441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9443 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9447 /* mute/unmute internal speaker according to the hp jack and mute state */
9448 static void alc268_dell_automute(struct hda_codec *codec)
9450 unsigned int present;
9453 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
9454 if (present & 0x80000000)
9455 mute = HDA_AMP_MUTE;
9457 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9458 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9459 HDA_AMP_MUTE, mute);
9462 static void alc268_dell_unsol_event(struct hda_codec *codec,
9465 if ((res >> 26) != ALC880_HP_EVENT)
9467 alc268_dell_automute(codec);
9470 #define alc268_dell_init_hook alc268_dell_automute
9473 * generic initialization of ADC, input mixers and output mixers
9475 static struct hda_verb alc268_base_init_verbs[] = {
9476 /* Unmute DAC0-1 and set vol = 0 */
9477 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9478 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9479 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9480 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9481 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9482 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9485 * Set up output mixers (0x0c - 0x0e)
9487 /* set vol=0 to output mixers */
9488 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9489 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9490 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9491 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9493 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9494 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9498 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9499 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9500 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9502 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9503 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9506 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9507 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9508 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9509 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9510 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9511 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9512 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9514 /* Unmute Selector 23h,24h and set the default input to mic-in */
9516 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
9517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9518 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
9519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9525 * generic initialization of ADC, input mixers and output mixers
9527 static struct hda_verb alc268_volume_init_verbs[] = {
9528 /* set output DAC */
9529 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9530 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9531 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9532 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9534 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9535 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9536 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9537 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9538 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9543 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9544 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9546 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9547 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9548 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9549 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9551 /* set PCBEEP vol = 0 */
9552 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
9557 #define alc268_mux_enum_info alc_mux_enum_info
9558 #define alc268_mux_enum_get alc_mux_enum_get
9560 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9561 struct snd_ctl_elem_value *ucontrol)
9563 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9564 struct alc_spec *spec = codec->spec;
9566 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9567 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9568 hda_nid_t nid = capture_mixers[adc_idx];
9570 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
9572 &spec->cur_mux[adc_idx]);
9575 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9576 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9577 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9579 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9580 /* The multiple "Capture Source" controls confuse alsamixer
9581 * So call somewhat different..
9583 /* .name = "Capture Source", */
9584 .name = "Input Source",
9586 .info = alc268_mux_enum_info,
9587 .get = alc268_mux_enum_get,
9588 .put = alc268_mux_enum_put,
9593 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9594 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9595 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9596 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9597 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9599 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9600 /* The multiple "Capture Source" controls confuse alsamixer
9601 * So call somewhat different..
9603 /* .name = "Capture Source", */
9604 .name = "Input Source",
9606 .info = alc268_mux_enum_info,
9607 .get = alc268_mux_enum_get,
9608 .put = alc268_mux_enum_put,
9613 static struct hda_input_mux alc268_capture_source = {
9617 { "Front Mic", 0x1 },
9623 #ifdef CONFIG_SND_DEBUG
9624 static struct snd_kcontrol_new alc268_test_mixer[] = {
9625 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9626 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9627 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9628 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9630 /* Volume widgets */
9631 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9632 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9633 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9634 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
9635 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
9636 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
9637 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
9638 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
9639 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
9640 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
9641 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
9642 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
9643 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
9644 /* The below appears problematic on some hardwares */
9645 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
9646 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9647 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
9648 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
9649 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
9651 /* Modes for retasking pin widgets */
9652 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
9653 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
9654 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
9655 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
9657 /* Controls for GPIO pins, assuming they are configured as outputs */
9658 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
9659 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
9660 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
9661 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
9663 /* Switches to allow the digital SPDIF output pin to be enabled.
9664 * The ALC268 does not have an SPDIF input.
9666 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
9668 /* A switch allowing EAPD to be enabled. Some laptops seem to use
9669 * this output to turn on an external amplifier.
9671 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
9672 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
9678 /* create input playback/capture controls for the given pin */
9679 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9680 const char *ctlname, int idx)
9685 sprintf(name, "%s Playback Volume", ctlname);
9687 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9688 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9692 } else if (nid == 0x15) {
9693 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9694 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9700 sprintf(name, "%s Playback Switch", ctlname);
9701 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9702 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9708 /* add playback controls from the parsed DAC table */
9709 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9710 const struct auto_pin_cfg *cfg)
9715 spec->multiout.num_dacs = 2; /* only use one dac */
9716 spec->multiout.dac_nids = spec->private_dac_nids;
9717 spec->multiout.dac_nids[0] = 2;
9718 spec->multiout.dac_nids[1] = 3;
9720 nid = cfg->line_out_pins[0];
9722 alc268_new_analog_output(spec, nid, "Front", 0);
9724 nid = cfg->speaker_pins[0];
9726 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9727 "Speaker Playback Volume",
9728 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9732 nid = cfg->hp_pins[0];
9734 alc268_new_analog_output(spec, nid, "Headphone", 0);
9736 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9738 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9739 "Mono Playback Switch",
9740 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9747 /* create playback/capture controls for input pins */
9748 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9749 const struct auto_pin_cfg *cfg)
9751 struct hda_input_mux *imux = &spec->private_imux;
9754 for (i = 0; i < AUTO_PIN_LAST; i++) {
9755 switch(cfg->input_pins[i]) {
9757 idx1 = 0; /* Mic 1 */
9760 idx1 = 1; /* Mic 2 */
9763 idx1 = 2; /* Line In */
9771 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9772 imux->items[imux->num_items].index = idx1;
9778 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9780 struct alc_spec *spec = codec->spec;
9781 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9782 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9783 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9784 unsigned int dac_vol1, dac_vol2;
9787 snd_hda_codec_write(codec, speaker_nid, 0,
9788 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9789 snd_hda_codec_write(codec, 0x0f, 0,
9790 AC_VERB_SET_AMP_GAIN_MUTE,
9792 snd_hda_codec_write(codec, 0x10, 0,
9793 AC_VERB_SET_AMP_GAIN_MUTE,
9796 snd_hda_codec_write(codec, 0x0f, 0,
9797 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9798 snd_hda_codec_write(codec, 0x10, 0,
9799 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9802 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
9803 if (line_nid == 0x14)
9804 dac_vol2 = AMP_OUT_ZERO;
9805 else if (line_nid == 0x15)
9806 dac_vol1 = AMP_OUT_ZERO;
9808 dac_vol2 = AMP_OUT_ZERO;
9809 else if (hp_nid == 0x15)
9810 dac_vol1 = AMP_OUT_ZERO;
9811 if (line_nid != 0x16 || hp_nid != 0x16 ||
9812 spec->autocfg.line_out_pins[1] != 0x16 ||
9813 spec->autocfg.line_out_pins[2] != 0x16)
9814 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
9816 snd_hda_codec_write(codec, 0x02, 0,
9817 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
9818 snd_hda_codec_write(codec, 0x03, 0,
9819 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
9822 /* pcm configuration: identiacal with ALC880 */
9823 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9824 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9825 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9826 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9829 * BIOS auto configuration
9831 static int alc268_parse_auto_config(struct hda_codec *codec)
9833 struct alc_spec *spec = codec->spec;
9835 static hda_nid_t alc268_ignore[] = { 0 };
9837 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9841 if (!spec->autocfg.line_outs)
9842 return 0; /* can't find valid BIOS pin config */
9844 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
9847 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
9851 spec->multiout.max_channels = 2;
9853 /* digital only support output */
9854 if (spec->autocfg.dig_out_pin)
9855 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
9857 if (spec->kctl_alloc)
9858 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9860 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
9861 spec->num_mux_defs = 1;
9862 spec->input_mux = &spec->private_imux;
9864 err = alc_auto_add_mic_boost(codec);
9871 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9872 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9873 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9875 /* init callback for auto-configuration model -- overriding the default init */
9876 static void alc268_auto_init(struct hda_codec *codec)
9878 alc268_auto_init_multi_out(codec);
9879 alc268_auto_init_hp_out(codec);
9880 alc268_auto_init_mono_speaker_out(codec);
9881 alc268_auto_init_analog_input(codec);
9885 * configuration and preset
9887 static const char *alc268_models[ALC268_MODEL_LAST] = {
9888 [ALC268_3ST] = "3stack",
9889 [ALC268_TOSHIBA] = "toshiba",
9890 [ALC268_ACER] = "acer",
9891 [ALC268_DELL] = "dell",
9892 #ifdef CONFIG_SND_DEBUG
9893 [ALC268_TEST] = "test",
9895 [ALC268_AUTO] = "auto",
9898 static struct snd_pci_quirk alc268_cfg_tbl[] = {
9899 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
9900 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
9901 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
9902 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
9903 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
9904 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
9905 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
9906 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
9907 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
9908 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
9912 static struct alc_config_preset alc268_presets[] = {
9914 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9915 .init_verbs = { alc268_base_init_verbs },
9916 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9917 .dac_nids = alc268_dac_nids,
9918 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9919 .adc_nids = alc268_adc_nids_alt,
9921 .dig_out_nid = ALC268_DIGOUT_NID,
9922 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9923 .channel_mode = alc268_modes,
9924 .input_mux = &alc268_capture_source,
9926 [ALC268_TOSHIBA] = {
9927 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9928 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9929 alc268_toshiba_verbs },
9930 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9931 .dac_nids = alc268_dac_nids,
9932 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9933 .adc_nids = alc268_adc_nids_alt,
9935 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9936 .channel_mode = alc268_modes,
9937 .input_mux = &alc268_capture_source,
9938 .unsol_event = alc268_toshiba_unsol_event,
9939 .init_hook = alc268_toshiba_automute,
9942 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
9943 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9944 alc268_acer_verbs },
9945 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9946 .dac_nids = alc268_dac_nids,
9947 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9948 .adc_nids = alc268_adc_nids_alt,
9950 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9951 .channel_mode = alc268_modes,
9952 .input_mux = &alc268_capture_source,
9953 .unsol_event = alc268_acer_unsol_event,
9954 .init_hook = alc268_acer_init_hook,
9957 .mixers = { alc268_dell_mixer },
9958 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9959 alc268_dell_verbs },
9960 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9961 .dac_nids = alc268_dac_nids,
9963 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9964 .channel_mode = alc268_modes,
9965 .unsol_event = alc268_dell_unsol_event,
9966 .init_hook = alc268_dell_init_hook,
9967 .input_mux = &alc268_capture_source,
9969 #ifdef CONFIG_SND_DEBUG
9971 .mixers = { alc268_test_mixer, alc268_capture_mixer },
9972 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9973 alc268_volume_init_verbs },
9974 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9975 .dac_nids = alc268_dac_nids,
9976 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9977 .adc_nids = alc268_adc_nids_alt,
9979 .dig_out_nid = ALC268_DIGOUT_NID,
9980 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9981 .channel_mode = alc268_modes,
9982 .input_mux = &alc268_capture_source,
9987 static int patch_alc268(struct hda_codec *codec)
9989 struct alc_spec *spec;
9993 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
9999 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10003 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10004 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10005 "trying auto-probe from BIOS...\n");
10006 board_config = ALC268_AUTO;
10009 if (board_config == ALC268_AUTO) {
10010 /* automatic parse from the BIOS config */
10011 err = alc268_parse_auto_config(codec);
10017 "hda_codec: Cannot set up configuration "
10018 "from BIOS. Using base mode...\n");
10019 board_config = ALC268_3ST;
10023 if (board_config != ALC268_AUTO)
10024 setup_preset(spec, &alc268_presets[board_config]);
10026 spec->stream_name_analog = "ALC268 Analog";
10027 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10028 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10029 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10031 spec->stream_name_digital = "ALC268 Digital";
10032 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10034 if (!spec->adc_nids && spec->input_mux) {
10035 /* check whether NID 0x07 is valid */
10036 unsigned int wcap = get_wcaps(codec, 0x07);
10039 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10040 if (wcap != AC_WID_AUD_IN) {
10041 spec->adc_nids = alc268_adc_nids_alt;
10042 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10043 spec->mixers[spec->num_mixers] =
10044 alc268_capture_alt_mixer;
10045 spec->num_mixers++;
10047 spec->adc_nids = alc268_adc_nids;
10048 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10049 spec->mixers[spec->num_mixers] =
10050 alc268_capture_mixer;
10051 spec->num_mixers++;
10055 spec->vmaster_nid = 0x02;
10057 codec->patch_ops = alc_patch_ops;
10058 if (board_config == ALC268_AUTO)
10059 spec->init_hook = alc268_auto_init;
10065 * ALC269 channel source setting (2 channel)
10067 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10069 #define alc269_dac_nids alc260_dac_nids
10071 static hda_nid_t alc269_adc_nids[1] = {
10076 #define alc269_modes alc260_modes
10077 #define alc269_capture_source alc880_lg_lw_capture_source
10079 static struct snd_kcontrol_new alc269_base_mixer[] = {
10080 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10081 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10083 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10089 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10091 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10095 /* capture mixer elements */
10096 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10097 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10098 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10100 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10101 /* The multiple "Capture Source" controls confuse alsamixer
10102 * So call somewhat different..
10104 /* .name = "Capture Source", */
10105 .name = "Input Source",
10107 .info = alc_mux_enum_info,
10108 .get = alc_mux_enum_get,
10109 .put = alc_mux_enum_put,
10115 * generic initialization of ADC, input mixers and output mixers
10117 static struct hda_verb alc269_init_verbs[] = {
10119 * Unmute ADC0 and set the default input to mic-in
10121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10123 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10124 * analog-loopback mixer widget
10125 * Note: PASD motherboards uses the Line In 2 as the input for
10126 * front panel mic (mic 2)
10128 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10136 * Set up output mixers (0x0c - 0x0e)
10138 /* set vol=0 to output mixers */
10139 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10140 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10142 /* set up input amps for analog loopback */
10143 /* Amp Indices: DAC = 0, mixer = 1 */
10144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10146 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10147 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10149 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10153 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10154 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10155 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10159 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10161 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10162 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10163 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10164 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10165 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10167 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10170 /* FIXME: use matrix-type input source selection */
10171 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10172 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10173 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10174 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10175 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10176 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10179 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10180 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10184 /* add playback controls from the parsed DAC table */
10185 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10186 const struct auto_pin_cfg *cfg)
10191 spec->multiout.num_dacs = 1; /* only use one dac */
10192 spec->multiout.dac_nids = spec->private_dac_nids;
10193 spec->multiout.dac_nids[0] = 2;
10195 nid = cfg->line_out_pins[0];
10197 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10198 "Front Playback Volume",
10199 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10202 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10203 "Front Playback Switch",
10204 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10209 nid = cfg->speaker_pins[0];
10211 if (!cfg->line_out_pins[0]) {
10212 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10213 "Speaker Playback Volume",
10214 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10220 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10221 "Speaker Playback Switch",
10222 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10227 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10228 "Speaker Playback Switch",
10229 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10235 nid = cfg->hp_pins[0];
10237 /* spec->multiout.hp_nid = 2; */
10238 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10239 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10240 "Headphone Playback Volume",
10241 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10247 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10248 "Headphone Playback Switch",
10249 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10254 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10255 "Headphone Playback Switch",
10256 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10265 #define alc269_auto_create_analog_input_ctls \
10266 alc880_auto_create_analog_input_ctls
10268 #ifdef CONFIG_SND_HDA_POWER_SAVE
10269 #define alc269_loopbacks alc880_loopbacks
10272 /* pcm configuration: identiacal with ALC880 */
10273 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10274 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10275 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10276 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10279 * BIOS auto configuration
10281 static int alc269_parse_auto_config(struct hda_codec *codec)
10283 struct alc_spec *spec = codec->spec;
10285 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10287 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10292 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10295 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10299 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10301 if (spec->autocfg.dig_out_pin)
10302 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10304 if (spec->kctl_alloc)
10305 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10307 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10308 spec->num_mux_defs = 1;
10309 spec->input_mux = &spec->private_imux;
10311 err = alc_auto_add_mic_boost(codec);
10318 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10319 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10320 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10323 /* init callback for auto-configuration model -- overriding the default init */
10324 static void alc269_auto_init(struct hda_codec *codec)
10326 alc269_auto_init_multi_out(codec);
10327 alc269_auto_init_hp_out(codec);
10328 alc269_auto_init_analog_input(codec);
10332 * configuration and preset
10334 static const char *alc269_models[ALC269_MODEL_LAST] = {
10335 [ALC269_BASIC] = "basic",
10338 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10342 static struct alc_config_preset alc269_presets[] = {
10344 .mixers = { alc269_base_mixer },
10345 .init_verbs = { alc269_init_verbs },
10346 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10347 .dac_nids = alc269_dac_nids,
10349 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10350 .channel_mode = alc269_modes,
10351 .input_mux = &alc269_capture_source,
10355 static int patch_alc269(struct hda_codec *codec)
10357 struct alc_spec *spec;
10361 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10365 codec->spec = spec;
10367 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10371 if (board_config < 0) {
10372 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10373 "trying auto-probe from BIOS...\n");
10374 board_config = ALC269_AUTO;
10377 if (board_config == ALC269_AUTO) {
10378 /* automatic parse from the BIOS config */
10379 err = alc269_parse_auto_config(codec);
10385 "hda_codec: Cannot set up configuration "
10386 "from BIOS. Using base mode...\n");
10387 board_config = ALC269_BASIC;
10391 if (board_config != ALC269_AUTO)
10392 setup_preset(spec, &alc269_presets[board_config]);
10394 spec->stream_name_analog = "ALC269 Analog";
10395 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10396 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10398 spec->stream_name_digital = "ALC269 Digital";
10399 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10400 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10402 spec->adc_nids = alc269_adc_nids;
10403 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10404 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10405 spec->num_mixers++;
10407 codec->patch_ops = alc_patch_ops;
10408 if (board_config == ALC269_AUTO)
10409 spec->init_hook = alc269_auto_init;
10410 #ifdef CONFIG_SND_HDA_POWER_SAVE
10411 if (!spec->loopback.amplist)
10412 spec->loopback.amplist = alc269_loopbacks;
10419 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10423 * set the path ways for 2 channel output
10424 * need to set the codec line out and mic 1 pin widgets to inputs
10426 static struct hda_verb alc861_threestack_ch2_init[] = {
10427 /* set pin widget 1Ah (line in) for input */
10428 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10429 /* set pin widget 18h (mic1/2) for input, for mic also enable
10432 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10434 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10436 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10437 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10443 * need to set the codec line out and mic 1 pin widgets to outputs
10445 static struct hda_verb alc861_threestack_ch6_init[] = {
10446 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10447 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10448 /* set pin widget 18h (mic1) for output (CLFE)*/
10449 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10451 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10452 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10454 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10456 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10457 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10462 static struct hda_channel_mode alc861_threestack_modes[2] = {
10463 { 2, alc861_threestack_ch2_init },
10464 { 6, alc861_threestack_ch6_init },
10466 /* Set mic1 as input and unmute the mixer */
10467 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10468 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10469 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10472 /* Set mic1 as output and mute mixer */
10473 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10474 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10475 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10479 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10480 { 2, alc861_uniwill_m31_ch2_init },
10481 { 4, alc861_uniwill_m31_ch4_init },
10484 /* Set mic1 and line-in as input and unmute the mixer */
10485 static struct hda_verb alc861_asus_ch2_init[] = {
10486 /* set pin widget 1Ah (line in) for input */
10487 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10488 /* set pin widget 18h (mic1/2) for input, for mic also enable
10491 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10493 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10495 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10496 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10500 /* Set mic1 nad line-in as output and mute mixer */
10501 static struct hda_verb alc861_asus_ch6_init[] = {
10502 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10503 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10504 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10505 /* set pin widget 18h (mic1) for output (CLFE)*/
10506 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10507 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10508 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10509 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10511 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10513 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10514 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10519 static struct hda_channel_mode alc861_asus_modes[2] = {
10520 { 2, alc861_asus_ch2_init },
10521 { 6, alc861_asus_ch6_init },
10526 static struct snd_kcontrol_new alc861_base_mixer[] = {
10527 /* output mixer control */
10528 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10529 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10530 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10531 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10532 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10534 /*Input mixer control */
10535 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10536 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10537 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10538 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10539 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10540 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10542 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10543 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10546 /* Capture mixer control */
10547 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10548 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10550 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10551 .name = "Capture Source",
10553 .info = alc_mux_enum_info,
10554 .get = alc_mux_enum_get,
10555 .put = alc_mux_enum_put,
10560 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10561 /* output mixer control */
10562 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10563 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10564 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10565 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10566 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10568 /* Input mixer control */
10569 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10570 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10571 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10572 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10573 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10574 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10576 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10577 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10580 /* Capture mixer control */
10581 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10582 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10585 .name = "Capture Source",
10587 .info = alc_mux_enum_info,
10588 .get = alc_mux_enum_get,
10589 .put = alc_mux_enum_put,
10592 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10593 .name = "Channel Mode",
10594 .info = alc_ch_mode_info,
10595 .get = alc_ch_mode_get,
10596 .put = alc_ch_mode_put,
10597 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10602 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10603 /* output mixer control */
10604 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10606 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10608 /*Capture mixer control */
10609 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10610 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10613 .name = "Capture Source",
10615 .info = alc_mux_enum_info,
10616 .get = alc_mux_enum_get,
10617 .put = alc_mux_enum_put,
10623 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10624 /* output mixer control */
10625 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10626 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10627 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10628 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10629 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10631 /* Input mixer control */
10632 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10633 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10634 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10635 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10636 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10637 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10639 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10640 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10643 /* Capture mixer control */
10644 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10645 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10648 .name = "Capture Source",
10650 .info = alc_mux_enum_info,
10651 .get = alc_mux_enum_get,
10652 .put = alc_mux_enum_put,
10655 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10656 .name = "Channel Mode",
10657 .info = alc_ch_mode_info,
10658 .get = alc_ch_mode_get,
10659 .put = alc_ch_mode_put,
10660 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10665 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10666 /* output mixer control */
10667 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10668 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10669 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10670 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10671 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10673 /* Input mixer control */
10674 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10675 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10676 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10677 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10678 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10679 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10681 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10682 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10683 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10685 /* Capture mixer control */
10686 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10687 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10690 .name = "Capture Source",
10692 .info = alc_mux_enum_info,
10693 .get = alc_mux_enum_get,
10694 .put = alc_mux_enum_put,
10697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10698 .name = "Channel Mode",
10699 .info = alc_ch_mode_info,
10700 .get = alc_ch_mode_get,
10701 .put = alc_ch_mode_put,
10702 .private_value = ARRAY_SIZE(alc861_asus_modes),
10707 /* additional mixer */
10708 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10709 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10710 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10711 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10712 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10717 * generic initialization of ADC, input mixers and output mixers
10719 static struct hda_verb alc861_base_init_verbs[] = {
10721 * Unmute ADC0 and set the default input to mic-in
10723 /* port-A for surround (rear panel) */
10724 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10725 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10726 /* port-B for mic-in (rear panel) with vref */
10727 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10728 /* port-C for line-in (rear panel) */
10729 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10730 /* port-D for Front */
10731 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10732 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10733 /* port-E for HP out (front panel) */
10734 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10735 /* route front PCM to HP */
10736 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10737 /* port-F for mic-in (front panel) with vref */
10738 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10739 /* port-G for CLFE (rear panel) */
10740 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10741 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10742 /* port-H for side (rear panel) */
10743 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10744 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10746 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10747 /* route front mic to ADC1*/
10748 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10749 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10751 /* Unmute DAC0~3 & spdif out*/
10752 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10753 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10754 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10755 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10758 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10759 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10760 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10761 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10762 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10764 /* Unmute Stereo Mixer 15 */
10765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10770 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10772 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10773 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10774 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10778 /* hp used DAC 3 (Front) */
10779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10780 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10785 static struct hda_verb alc861_threestack_init_verbs[] = {
10787 * Unmute ADC0 and set the default input to mic-in
10789 /* port-A for surround (rear panel) */
10790 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10791 /* port-B for mic-in (rear panel) with vref */
10792 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10793 /* port-C for line-in (rear panel) */
10794 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10795 /* port-D for Front */
10796 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10797 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10798 /* port-E for HP out (front panel) */
10799 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10800 /* route front PCM to HP */
10801 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10802 /* port-F for mic-in (front panel) with vref */
10803 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10804 /* port-G for CLFE (rear panel) */
10805 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10806 /* port-H for side (rear panel) */
10807 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10809 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10810 /* route front mic to ADC1*/
10811 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10812 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10813 /* Unmute DAC0~3 & spdif out*/
10814 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10815 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10816 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10817 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10818 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10820 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10821 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10822 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10823 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10824 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10826 /* Unmute Stereo Mixer 15 */
10827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10832 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10834 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10835 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10836 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10838 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10840 /* hp used DAC 3 (Front) */
10841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10846 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
10848 * Unmute ADC0 and set the default input to mic-in
10850 /* port-A for surround (rear panel) */
10851 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10852 /* port-B for mic-in (rear panel) with vref */
10853 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10854 /* port-C for line-in (rear panel) */
10855 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10856 /* port-D for Front */
10857 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10858 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10859 /* port-E for HP out (front panel) */
10860 /* this has to be set to VREF80 */
10861 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10862 /* route front PCM to HP */
10863 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10864 /* port-F for mic-in (front panel) with vref */
10865 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10866 /* port-G for CLFE (rear panel) */
10867 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10868 /* port-H for side (rear panel) */
10869 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10871 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10872 /* route front mic to ADC1*/
10873 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10874 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10875 /* Unmute DAC0~3 & spdif out*/
10876 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10877 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10878 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10879 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10880 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10882 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10883 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10884 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10885 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10886 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10888 /* Unmute Stereo Mixer 15 */
10889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10894 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10896 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10897 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10898 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10899 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10900 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10902 /* hp used DAC 3 (Front) */
10903 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10908 static struct hda_verb alc861_asus_init_verbs[] = {
10910 * Unmute ADC0 and set the default input to mic-in
10912 /* port-A for surround (rear panel)
10913 * according to codec#0 this is the HP jack
10915 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
10916 /* route front PCM to HP */
10917 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
10918 /* port-B for mic-in (rear panel) with vref */
10919 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10920 /* port-C for line-in (rear panel) */
10921 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10922 /* port-D for Front */
10923 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10924 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10925 /* port-E for HP out (front panel) */
10926 /* this has to be set to VREF80 */
10927 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10928 /* route front PCM to HP */
10929 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10930 /* port-F for mic-in (front panel) with vref */
10931 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10932 /* port-G for CLFE (rear panel) */
10933 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10934 /* port-H for side (rear panel) */
10935 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10937 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10938 /* route front mic to ADC1*/
10939 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10940 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10941 /* Unmute DAC0~3 & spdif out*/
10942 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10943 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10944 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10945 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10947 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10948 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10949 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10950 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10951 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10953 /* Unmute Stereo Mixer 15 */
10954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10956 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10959 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10960 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10961 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10962 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10963 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10964 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10965 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10966 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10967 /* hp used DAC 3 (Front) */
10968 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10969 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10973 /* additional init verbs for ASUS laptops */
10974 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
10975 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
10976 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
10981 * generic initialization of ADC, input mixers and output mixers
10983 static struct hda_verb alc861_auto_init_verbs[] = {
10985 * Unmute ADC0 and set the default input to mic-in
10987 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
10988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10990 /* Unmute DAC0~3 & spdif out*/
10991 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10992 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10993 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10994 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10997 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10998 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10999 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11000 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11001 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11003 /* Unmute Stereo Mixer 15 */
11004 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11009 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11010 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11011 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11012 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11013 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11014 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11015 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11018 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11019 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11022 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11024 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11025 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11027 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11032 static struct hda_verb alc861_toshiba_init_verbs[] = {
11033 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11038 /* toggle speaker-output according to the hp-jack state */
11039 static void alc861_toshiba_automute(struct hda_codec *codec)
11041 unsigned int present;
11043 present = snd_hda_codec_read(codec, 0x0f, 0,
11044 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11045 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11046 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11047 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11048 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11051 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11054 if ((res >> 26) == ALC880_HP_EVENT)
11055 alc861_toshiba_automute(codec);
11058 /* pcm configuration: identiacal with ALC880 */
11059 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11060 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11061 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11062 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11065 #define ALC861_DIGOUT_NID 0x07
11067 static struct hda_channel_mode alc861_8ch_modes[1] = {
11071 static hda_nid_t alc861_dac_nids[4] = {
11072 /* front, surround, clfe, side */
11073 0x03, 0x06, 0x05, 0x04
11076 static hda_nid_t alc660_dac_nids[3] = {
11077 /* front, clfe, surround */
11081 static hda_nid_t alc861_adc_nids[1] = {
11086 static struct hda_input_mux alc861_capture_source = {
11090 { "Front Mic", 0x3 },
11097 /* fill in the dac_nids table from the parsed pin configuration */
11098 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11099 const struct auto_pin_cfg *cfg)
11104 spec->multiout.dac_nids = spec->private_dac_nids;
11105 for (i = 0; i < cfg->line_outs; i++) {
11106 nid = cfg->line_out_pins[i];
11108 if (i >= ARRAY_SIZE(alc861_dac_nids))
11110 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11113 spec->multiout.num_dacs = cfg->line_outs;
11117 /* add playback controls from the parsed DAC table */
11118 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11119 const struct auto_pin_cfg *cfg)
11122 static const char *chname[4] = {
11123 "Front", "Surround", NULL /*CLFE*/, "Side"
11128 for (i = 0; i < cfg->line_outs; i++) {
11129 nid = spec->multiout.dac_nids[i];
11134 err = add_control(spec, ALC_CTL_BIND_MUTE,
11135 "Center Playback Switch",
11136 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11140 err = add_control(spec, ALC_CTL_BIND_MUTE,
11141 "LFE Playback Switch",
11142 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11147 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11149 if (nid == alc861_dac_nids[idx])
11151 sprintf(name, "%s Playback Switch", chname[idx]);
11152 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11153 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11162 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11170 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11172 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11173 "Headphone Playback Switch",
11174 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11177 spec->multiout.hp_nid = nid;
11182 /* create playback/capture controls for input pins */
11183 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11184 const struct auto_pin_cfg *cfg)
11186 struct hda_input_mux *imux = &spec->private_imux;
11187 int i, err, idx, idx1;
11189 for (i = 0; i < AUTO_PIN_LAST; i++) {
11190 switch (cfg->input_pins[i]) {
11193 idx = 2; /* Line In */
11197 idx = 2; /* Line In */
11201 idx = 1; /* Mic In */
11205 idx = 1; /* Mic In */
11215 err = new_analog_input(spec, cfg->input_pins[i],
11216 auto_pin_cfg_labels[i], idx, 0x15);
11220 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11221 imux->items[imux->num_items].index = idx1;
11227 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11228 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11229 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11232 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11233 /* The multiple "Capture Source" controls confuse alsamixer
11234 * So call somewhat different..
11236 /* .name = "Capture Source", */
11237 .name = "Input Source",
11239 .info = alc_mux_enum_info,
11240 .get = alc_mux_enum_get,
11241 .put = alc_mux_enum_put,
11246 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11248 int pin_type, int dac_idx)
11250 /* set as output */
11252 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11254 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11259 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11261 struct alc_spec *spec = codec->spec;
11264 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11265 for (i = 0; i < spec->autocfg.line_outs; i++) {
11266 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11267 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11269 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11270 spec->multiout.dac_nids[i]);
11274 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11276 struct alc_spec *spec = codec->spec;
11279 pin = spec->autocfg.hp_pins[0];
11280 if (pin) /* connect to front */
11281 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11282 spec->multiout.dac_nids[0]);
11285 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11287 struct alc_spec *spec = codec->spec;
11290 for (i = 0; i < AUTO_PIN_LAST; i++) {
11291 hda_nid_t nid = spec->autocfg.input_pins[i];
11292 if (nid >= 0x0c && nid <= 0x11) {
11293 snd_hda_codec_write(codec, nid, 0,
11294 AC_VERB_SET_PIN_WIDGET_CONTROL,
11295 i <= AUTO_PIN_FRONT_MIC ?
11296 PIN_VREF80 : PIN_IN);
11301 /* parse the BIOS configuration and set up the alc_spec */
11302 /* return 1 if successful, 0 if the proper config is not found,
11303 * or a negative error code
11305 static int alc861_parse_auto_config(struct hda_codec *codec)
11307 struct alc_spec *spec = codec->spec;
11309 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11311 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11315 if (!spec->autocfg.line_outs)
11316 return 0; /* can't find valid BIOS pin config */
11318 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11321 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11324 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11327 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11331 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11333 if (spec->autocfg.dig_out_pin)
11334 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11336 if (spec->kctl_alloc)
11337 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11339 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11341 spec->num_mux_defs = 1;
11342 spec->input_mux = &spec->private_imux;
11344 spec->adc_nids = alc861_adc_nids;
11345 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11346 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11347 spec->num_mixers++;
11352 /* additional initialization for auto-configuration model */
11353 static void alc861_auto_init(struct hda_codec *codec)
11355 alc861_auto_init_multi_out(codec);
11356 alc861_auto_init_hp_out(codec);
11357 alc861_auto_init_analog_input(codec);
11360 #ifdef CONFIG_SND_HDA_POWER_SAVE
11361 static struct hda_amp_list alc861_loopbacks[] = {
11362 { 0x15, HDA_INPUT, 0 },
11363 { 0x15, HDA_INPUT, 1 },
11364 { 0x15, HDA_INPUT, 2 },
11365 { 0x15, HDA_INPUT, 3 },
11372 * configuration and preset
11374 static const char *alc861_models[ALC861_MODEL_LAST] = {
11375 [ALC861_3ST] = "3stack",
11376 [ALC660_3ST] = "3stack-660",
11377 [ALC861_3ST_DIG] = "3stack-dig",
11378 [ALC861_6ST_DIG] = "6stack-dig",
11379 [ALC861_UNIWILL_M31] = "uniwill-m31",
11380 [ALC861_TOSHIBA] = "toshiba",
11381 [ALC861_ASUS] = "asus",
11382 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11383 [ALC861_AUTO] = "auto",
11386 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11387 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11388 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11389 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11390 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11391 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11392 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11393 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11394 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11395 * Any other models that need this preset?
11397 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11398 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11399 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11400 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11401 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11402 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11403 /* FIXME: the below seems conflict */
11404 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11405 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11406 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11410 static struct alc_config_preset alc861_presets[] = {
11412 .mixers = { alc861_3ST_mixer },
11413 .init_verbs = { alc861_threestack_init_verbs },
11414 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11415 .dac_nids = alc861_dac_nids,
11416 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11417 .channel_mode = alc861_threestack_modes,
11419 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11420 .adc_nids = alc861_adc_nids,
11421 .input_mux = &alc861_capture_source,
11423 [ALC861_3ST_DIG] = {
11424 .mixers = { alc861_base_mixer },
11425 .init_verbs = { alc861_threestack_init_verbs },
11426 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11427 .dac_nids = alc861_dac_nids,
11428 .dig_out_nid = ALC861_DIGOUT_NID,
11429 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11430 .channel_mode = alc861_threestack_modes,
11432 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11433 .adc_nids = alc861_adc_nids,
11434 .input_mux = &alc861_capture_source,
11436 [ALC861_6ST_DIG] = {
11437 .mixers = { alc861_base_mixer },
11438 .init_verbs = { alc861_base_init_verbs },
11439 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11440 .dac_nids = alc861_dac_nids,
11441 .dig_out_nid = ALC861_DIGOUT_NID,
11442 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11443 .channel_mode = alc861_8ch_modes,
11444 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11445 .adc_nids = alc861_adc_nids,
11446 .input_mux = &alc861_capture_source,
11449 .mixers = { alc861_3ST_mixer },
11450 .init_verbs = { alc861_threestack_init_verbs },
11451 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11452 .dac_nids = alc660_dac_nids,
11453 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11454 .channel_mode = alc861_threestack_modes,
11456 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11457 .adc_nids = alc861_adc_nids,
11458 .input_mux = &alc861_capture_source,
11460 [ALC861_UNIWILL_M31] = {
11461 .mixers = { alc861_uniwill_m31_mixer },
11462 .init_verbs = { alc861_uniwill_m31_init_verbs },
11463 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11464 .dac_nids = alc861_dac_nids,
11465 .dig_out_nid = ALC861_DIGOUT_NID,
11466 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11467 .channel_mode = alc861_uniwill_m31_modes,
11469 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11470 .adc_nids = alc861_adc_nids,
11471 .input_mux = &alc861_capture_source,
11473 [ALC861_TOSHIBA] = {
11474 .mixers = { alc861_toshiba_mixer },
11475 .init_verbs = { alc861_base_init_verbs,
11476 alc861_toshiba_init_verbs },
11477 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11478 .dac_nids = alc861_dac_nids,
11479 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11480 .channel_mode = alc883_3ST_2ch_modes,
11481 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11482 .adc_nids = alc861_adc_nids,
11483 .input_mux = &alc861_capture_source,
11484 .unsol_event = alc861_toshiba_unsol_event,
11485 .init_hook = alc861_toshiba_automute,
11488 .mixers = { alc861_asus_mixer },
11489 .init_verbs = { alc861_asus_init_verbs },
11490 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11491 .dac_nids = alc861_dac_nids,
11492 .dig_out_nid = ALC861_DIGOUT_NID,
11493 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11494 .channel_mode = alc861_asus_modes,
11497 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11498 .adc_nids = alc861_adc_nids,
11499 .input_mux = &alc861_capture_source,
11501 [ALC861_ASUS_LAPTOP] = {
11502 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11503 .init_verbs = { alc861_asus_init_verbs,
11504 alc861_asus_laptop_init_verbs },
11505 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11506 .dac_nids = alc861_dac_nids,
11507 .dig_out_nid = ALC861_DIGOUT_NID,
11508 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11509 .channel_mode = alc883_3ST_2ch_modes,
11511 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11512 .adc_nids = alc861_adc_nids,
11513 .input_mux = &alc861_capture_source,
11518 static int patch_alc861(struct hda_codec *codec)
11520 struct alc_spec *spec;
11524 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11528 codec->spec = spec;
11530 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11534 if (board_config < 0) {
11535 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11536 "trying auto-probe from BIOS...\n");
11537 board_config = ALC861_AUTO;
11540 if (board_config == ALC861_AUTO) {
11541 /* automatic parse from the BIOS config */
11542 err = alc861_parse_auto_config(codec);
11548 "hda_codec: Cannot set up configuration "
11549 "from BIOS. Using base mode...\n");
11550 board_config = ALC861_3ST_DIG;
11554 if (board_config != ALC861_AUTO)
11555 setup_preset(spec, &alc861_presets[board_config]);
11557 spec->stream_name_analog = "ALC861 Analog";
11558 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11559 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11561 spec->stream_name_digital = "ALC861 Digital";
11562 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11563 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11565 spec->vmaster_nid = 0x03;
11567 codec->patch_ops = alc_patch_ops;
11568 if (board_config == ALC861_AUTO)
11569 spec->init_hook = alc861_auto_init;
11570 #ifdef CONFIG_SND_HDA_POWER_SAVE
11571 if (!spec->loopback.amplist)
11572 spec->loopback.amplist = alc861_loopbacks;
11579 * ALC861-VD support
11583 * In addition, an independent DAC
11585 #define ALC861VD_DIGOUT_NID 0x06
11587 static hda_nid_t alc861vd_dac_nids[4] = {
11588 /* front, surr, clfe, side surr */
11589 0x02, 0x03, 0x04, 0x05
11592 /* dac_nids for ALC660vd are in a different order - according to
11593 * Realtek's driver.
11594 * This should probably tesult in a different mixer for 6stack models
11595 * of ALC660vd codecs, but for now there is only 3stack mixer
11596 * - and it is the same as in 861vd.
11597 * adc_nids in ALC660vd are (is) the same as in 861vd
11599 static hda_nid_t alc660vd_dac_nids[3] = {
11600 /* front, rear, clfe, rear_surr */
11604 static hda_nid_t alc861vd_adc_nids[1] = {
11610 /* FIXME: should be a matrix-type input source selection */
11611 static struct hda_input_mux alc861vd_capture_source = {
11615 { "Front Mic", 0x1 },
11621 static struct hda_input_mux alc861vd_dallas_capture_source = {
11624 { "Front Mic", 0x0 },
11625 { "ATAPI Mic", 0x1 },
11626 { "Line In", 0x5 },
11630 static struct hda_input_mux alc861vd_hp_capture_source = {
11633 { "Front Mic", 0x0 },
11634 { "ATAPI Mic", 0x1 },
11638 #define alc861vd_mux_enum_info alc_mux_enum_info
11639 #define alc861vd_mux_enum_get alc_mux_enum_get
11641 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
11642 struct snd_ctl_elem_value *ucontrol)
11644 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11645 struct alc_spec *spec = codec->spec;
11646 const struct hda_input_mux *imux = spec->input_mux;
11647 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11648 static hda_nid_t capture_mixers[1] = { 0x22 };
11649 hda_nid_t nid = capture_mixers[adc_idx];
11650 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11651 unsigned int i, idx;
11653 idx = ucontrol->value.enumerated.item[0];
11654 if (idx >= imux->num_items)
11655 idx = imux->num_items - 1;
11656 if (*cur_val == idx)
11658 for (i = 0; i < imux->num_items; i++) {
11659 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11660 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11661 imux->items[i].index,
11671 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11678 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11679 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11680 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11681 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11682 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11689 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11690 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11691 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11692 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11693 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11697 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11698 { 6, alc861vd_6stack_ch6_init },
11699 { 8, alc861vd_6stack_ch8_init },
11702 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11704 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11705 .name = "Channel Mode",
11706 .info = alc_ch_mode_info,
11707 .get = alc_ch_mode_get,
11708 .put = alc_ch_mode_put,
11713 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11714 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11715 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11718 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11719 /* The multiple "Capture Source" controls confuse alsamixer
11720 * So call somewhat different..
11722 /* .name = "Capture Source", */
11723 .name = "Input Source",
11725 .info = alc861vd_mux_enum_info,
11726 .get = alc861vd_mux_enum_get,
11727 .put = alc861vd_mux_enum_put,
11732 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11733 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11735 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11736 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11737 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11739 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11740 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11742 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11744 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11746 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11747 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11749 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11750 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11756 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11758 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11759 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11760 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11762 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11763 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11768 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11769 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11774 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
11775 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11776 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11782 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11784 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11785 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11786 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11788 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11789 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11794 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11795 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11800 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
11801 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11802 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
11803 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11805 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11811 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11812 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11813 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11815 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11816 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11821 /* Pin assignment: Front=0x14, HP = 0x15,
11822 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
11824 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
11825 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11826 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11827 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11828 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11829 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11830 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11831 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11832 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11833 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
11834 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
11838 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
11839 * Front Mic=0x18, ATAPI Mic = 0x19,
11841 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
11842 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11843 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11844 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11845 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11848 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11849 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11855 * generic initialization of ADC, input mixers and output mixers
11857 static struct hda_verb alc861vd_volume_init_verbs[] = {
11859 * Unmute ADC0 and set the default input to mic-in
11861 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11862 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11864 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
11865 * the analog-loopback mixer widget
11867 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11872 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11874 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
11875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11881 * Set up output mixers (0x02 - 0x05)
11883 /* set vol=0 to output mixers */
11884 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11885 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11886 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11887 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11889 /* set up input amps for analog loopback */
11890 /* Amp Indices: DAC = 0, mixer = 1 */
11891 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11892 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11893 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11894 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11895 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11896 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11897 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11898 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11904 * 3-stack pin configuration:
11905 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
11907 static struct hda_verb alc861vd_3stack_init_verbs[] = {
11909 * Set pin mode and muting
11911 /* set front pin widgets 0x14 for output */
11912 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11913 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11914 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11916 /* Mic (rear) pin: input vref at 80% */
11917 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11918 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11919 /* Front Mic pin: input vref at 80% */
11920 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11921 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11922 /* Line In pin: input */
11923 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11924 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11925 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11927 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11928 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11929 /* CD pin widget for input */
11930 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11936 * 6-stack pin configuration:
11938 static struct hda_verb alc861vd_6stack_init_verbs[] = {
11940 * Set pin mode and muting
11942 /* set front pin widgets 0x14 for output */
11943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11944 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11945 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11947 /* Rear Pin: output 1 (0x0d) */
11948 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11949 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11950 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11951 /* CLFE Pin: output 2 (0x0e) */
11952 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11953 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11954 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
11955 /* Side Pin: output 3 (0x0f) */
11956 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11957 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11958 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
11960 /* Mic (rear) pin: input vref at 80% */
11961 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11962 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11963 /* Front Mic pin: input vref at 80% */
11964 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11965 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11966 /* Line In pin: input */
11967 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11968 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11969 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11970 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11971 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11972 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11973 /* CD pin widget for input */
11974 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11979 static struct hda_verb alc861vd_eapd_verbs[] = {
11980 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11984 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
11985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11988 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11989 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11993 /* toggle speaker-output according to the hp-jack state */
11994 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
11996 unsigned int present;
11997 unsigned char bits;
11999 present = snd_hda_codec_read(codec, 0x1b, 0,
12000 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12001 bits = present ? HDA_AMP_MUTE : 0;
12002 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12003 HDA_AMP_MUTE, bits);
12006 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12008 unsigned int present;
12009 unsigned char bits;
12011 present = snd_hda_codec_read(codec, 0x18, 0,
12012 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12013 bits = present ? HDA_AMP_MUTE : 0;
12014 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12015 HDA_AMP_MUTE, bits);
12018 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12020 alc861vd_lenovo_hp_automute(codec);
12021 alc861vd_lenovo_mic_automute(codec);
12024 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12027 switch (res >> 26) {
12028 case ALC880_HP_EVENT:
12029 alc861vd_lenovo_hp_automute(codec);
12031 case ALC880_MIC_EVENT:
12032 alc861vd_lenovo_mic_automute(codec);
12037 static struct hda_verb alc861vd_dallas_verbs[] = {
12038 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12039 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12040 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12041 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12043 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12044 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12045 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12046 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12047 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12048 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12049 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12050 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12056 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12058 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12059 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12061 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12062 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12066 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12068 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12076 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12077 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12082 /* toggle speaker-output according to the hp-jack state */
12083 static void alc861vd_dallas_automute(struct hda_codec *codec)
12085 unsigned int present;
12087 present = snd_hda_codec_read(codec, 0x15, 0,
12088 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12089 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12090 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12093 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12095 if ((res >> 26) == ALC880_HP_EVENT)
12096 alc861vd_dallas_automute(codec);
12099 #ifdef CONFIG_SND_HDA_POWER_SAVE
12100 #define alc861vd_loopbacks alc880_loopbacks
12103 /* pcm configuration: identiacal with ALC880 */
12104 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12105 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12106 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12107 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12110 * configuration and preset
12112 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12113 [ALC660VD_3ST] = "3stack-660",
12114 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12115 [ALC861VD_3ST] = "3stack",
12116 [ALC861VD_3ST_DIG] = "3stack-digout",
12117 [ALC861VD_6ST_DIG] = "6stack-digout",
12118 [ALC861VD_LENOVO] = "lenovo",
12119 [ALC861VD_DALLAS] = "dallas",
12120 [ALC861VD_HP] = "hp",
12121 [ALC861VD_AUTO] = "auto",
12124 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12125 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12126 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12127 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12128 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12129 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12130 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12131 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12132 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12133 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12134 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12135 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12136 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12137 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12138 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12142 static struct alc_config_preset alc861vd_presets[] = {
12144 .mixers = { alc861vd_3st_mixer },
12145 .init_verbs = { alc861vd_volume_init_verbs,
12146 alc861vd_3stack_init_verbs },
12147 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12148 .dac_nids = alc660vd_dac_nids,
12149 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12150 .adc_nids = alc861vd_adc_nids,
12151 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12152 .channel_mode = alc861vd_3stack_2ch_modes,
12153 .input_mux = &alc861vd_capture_source,
12155 [ALC660VD_3ST_DIG] = {
12156 .mixers = { alc861vd_3st_mixer },
12157 .init_verbs = { alc861vd_volume_init_verbs,
12158 alc861vd_3stack_init_verbs },
12159 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12160 .dac_nids = alc660vd_dac_nids,
12161 .dig_out_nid = ALC861VD_DIGOUT_NID,
12162 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12163 .adc_nids = alc861vd_adc_nids,
12164 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12165 .channel_mode = alc861vd_3stack_2ch_modes,
12166 .input_mux = &alc861vd_capture_source,
12169 .mixers = { alc861vd_3st_mixer },
12170 .init_verbs = { alc861vd_volume_init_verbs,
12171 alc861vd_3stack_init_verbs },
12172 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12173 .dac_nids = alc861vd_dac_nids,
12174 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12175 .channel_mode = alc861vd_3stack_2ch_modes,
12176 .input_mux = &alc861vd_capture_source,
12178 [ALC861VD_3ST_DIG] = {
12179 .mixers = { alc861vd_3st_mixer },
12180 .init_verbs = { alc861vd_volume_init_verbs,
12181 alc861vd_3stack_init_verbs },
12182 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12183 .dac_nids = alc861vd_dac_nids,
12184 .dig_out_nid = ALC861VD_DIGOUT_NID,
12185 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12186 .channel_mode = alc861vd_3stack_2ch_modes,
12187 .input_mux = &alc861vd_capture_source,
12189 [ALC861VD_6ST_DIG] = {
12190 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12191 .init_verbs = { alc861vd_volume_init_verbs,
12192 alc861vd_6stack_init_verbs },
12193 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12194 .dac_nids = alc861vd_dac_nids,
12195 .dig_out_nid = ALC861VD_DIGOUT_NID,
12196 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12197 .channel_mode = alc861vd_6stack_modes,
12198 .input_mux = &alc861vd_capture_source,
12200 [ALC861VD_LENOVO] = {
12201 .mixers = { alc861vd_lenovo_mixer },
12202 .init_verbs = { alc861vd_volume_init_verbs,
12203 alc861vd_3stack_init_verbs,
12204 alc861vd_eapd_verbs,
12205 alc861vd_lenovo_unsol_verbs },
12206 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12207 .dac_nids = alc660vd_dac_nids,
12208 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12209 .adc_nids = alc861vd_adc_nids,
12210 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12211 .channel_mode = alc861vd_3stack_2ch_modes,
12212 .input_mux = &alc861vd_capture_source,
12213 .unsol_event = alc861vd_lenovo_unsol_event,
12214 .init_hook = alc861vd_lenovo_automute,
12216 [ALC861VD_DALLAS] = {
12217 .mixers = { alc861vd_dallas_mixer },
12218 .init_verbs = { alc861vd_dallas_verbs },
12219 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12220 .dac_nids = alc861vd_dac_nids,
12221 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12222 .adc_nids = alc861vd_adc_nids,
12223 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12224 .channel_mode = alc861vd_3stack_2ch_modes,
12225 .input_mux = &alc861vd_dallas_capture_source,
12226 .unsol_event = alc861vd_dallas_unsol_event,
12227 .init_hook = alc861vd_dallas_automute,
12230 .mixers = { alc861vd_hp_mixer },
12231 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12232 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12233 .dac_nids = alc861vd_dac_nids,
12234 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12235 .dig_out_nid = ALC861VD_DIGOUT_NID,
12236 .adc_nids = alc861vd_adc_nids,
12237 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12238 .channel_mode = alc861vd_3stack_2ch_modes,
12239 .input_mux = &alc861vd_hp_capture_source,
12240 .unsol_event = alc861vd_dallas_unsol_event,
12241 .init_hook = alc861vd_dallas_automute,
12246 * BIOS auto configuration
12248 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12249 hda_nid_t nid, int pin_type, int dac_idx)
12251 /* set as output */
12252 snd_hda_codec_write(codec, nid, 0,
12253 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12254 snd_hda_codec_write(codec, nid, 0,
12255 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12258 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12260 struct alc_spec *spec = codec->spec;
12263 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12264 for (i = 0; i <= HDA_SIDE; i++) {
12265 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12266 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12268 alc861vd_auto_set_output_and_unmute(codec, nid,
12274 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12276 struct alc_spec *spec = codec->spec;
12279 pin = spec->autocfg.hp_pins[0];
12280 if (pin) /* connect to front and use dac 0 */
12281 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12284 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12285 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12287 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12289 struct alc_spec *spec = codec->spec;
12292 for (i = 0; i < AUTO_PIN_LAST; i++) {
12293 hda_nid_t nid = spec->autocfg.input_pins[i];
12294 if (alc861vd_is_input_pin(nid)) {
12295 snd_hda_codec_write(codec, nid, 0,
12296 AC_VERB_SET_PIN_WIDGET_CONTROL,
12297 i <= AUTO_PIN_FRONT_MIC ?
12298 PIN_VREF80 : PIN_IN);
12299 if (nid != ALC861VD_PIN_CD_NID)
12300 snd_hda_codec_write(codec, nid, 0,
12301 AC_VERB_SET_AMP_GAIN_MUTE,
12307 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12308 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12310 /* add playback controls from the parsed DAC table */
12311 /* Based on ALC880 version. But ALC861VD has separate,
12312 * different NIDs for mute/unmute switch and volume control */
12313 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12314 const struct auto_pin_cfg *cfg)
12317 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12318 hda_nid_t nid_v, nid_s;
12321 for (i = 0; i < cfg->line_outs; i++) {
12322 if (!spec->multiout.dac_nids[i])
12324 nid_v = alc861vd_idx_to_mixer_vol(
12326 spec->multiout.dac_nids[i]));
12327 nid_s = alc861vd_idx_to_mixer_switch(
12329 spec->multiout.dac_nids[i]));
12333 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12334 "Center Playback Volume",
12335 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12339 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12340 "LFE Playback Volume",
12341 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12345 err = add_control(spec, ALC_CTL_BIND_MUTE,
12346 "Center Playback Switch",
12347 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12351 err = add_control(spec, ALC_CTL_BIND_MUTE,
12352 "LFE Playback Switch",
12353 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12358 sprintf(name, "%s Playback Volume", chname[i]);
12359 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12360 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12364 sprintf(name, "%s Playback Switch", chname[i]);
12365 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12366 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12375 /* add playback controls for speaker and HP outputs */
12376 /* Based on ALC880 version. But ALC861VD has separate,
12377 * different NIDs for mute/unmute switch and volume control */
12378 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12379 hda_nid_t pin, const char *pfx)
12381 hda_nid_t nid_v, nid_s;
12388 if (alc880_is_fixed_pin(pin)) {
12389 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12390 /* specify the DAC as the extra output */
12391 if (!spec->multiout.hp_nid)
12392 spec->multiout.hp_nid = nid_v;
12394 spec->multiout.extra_out_nid[0] = nid_v;
12395 /* control HP volume/switch on the output mixer amp */
12396 nid_v = alc861vd_idx_to_mixer_vol(
12397 alc880_fixed_pin_idx(pin));
12398 nid_s = alc861vd_idx_to_mixer_switch(
12399 alc880_fixed_pin_idx(pin));
12401 sprintf(name, "%s Playback Volume", pfx);
12402 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12403 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12406 sprintf(name, "%s Playback Switch", pfx);
12407 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12408 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12411 } else if (alc880_is_multi_pin(pin)) {
12412 /* set manual connection */
12413 /* we have only a switch on HP-out PIN */
12414 sprintf(name, "%s Playback Switch", pfx);
12415 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12416 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12423 /* parse the BIOS configuration and set up the alc_spec
12424 * return 1 if successful, 0 if the proper config is not found,
12425 * or a negative error code
12426 * Based on ALC880 version - had to change it to override
12427 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12428 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12430 struct alc_spec *spec = codec->spec;
12432 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12434 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12438 if (!spec->autocfg.line_outs)
12439 return 0; /* can't find valid BIOS pin config */
12441 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12444 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12447 err = alc861vd_auto_create_extra_out(spec,
12448 spec->autocfg.speaker_pins[0],
12452 err = alc861vd_auto_create_extra_out(spec,
12453 spec->autocfg.hp_pins[0],
12457 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12461 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12463 if (spec->autocfg.dig_out_pin)
12464 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12466 if (spec->kctl_alloc)
12467 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12469 spec->init_verbs[spec->num_init_verbs++]
12470 = alc861vd_volume_init_verbs;
12472 spec->num_mux_defs = 1;
12473 spec->input_mux = &spec->private_imux;
12475 err = alc_auto_add_mic_boost(codec);
12482 /* additional initialization for auto-configuration model */
12483 static void alc861vd_auto_init(struct hda_codec *codec)
12485 alc861vd_auto_init_multi_out(codec);
12486 alc861vd_auto_init_hp_out(codec);
12487 alc861vd_auto_init_analog_input(codec);
12490 static int patch_alc861vd(struct hda_codec *codec)
12492 struct alc_spec *spec;
12493 int err, board_config;
12495 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12499 codec->spec = spec;
12501 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12505 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12506 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12507 "ALC861VD, trying auto-probe from BIOS...\n");
12508 board_config = ALC861VD_AUTO;
12511 if (board_config == ALC861VD_AUTO) {
12512 /* automatic parse from the BIOS config */
12513 err = alc861vd_parse_auto_config(codec);
12519 "hda_codec: Cannot set up configuration "
12520 "from BIOS. Using base mode...\n");
12521 board_config = ALC861VD_3ST;
12525 if (board_config != ALC861VD_AUTO)
12526 setup_preset(spec, &alc861vd_presets[board_config]);
12528 spec->stream_name_analog = "ALC861VD Analog";
12529 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12530 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12532 spec->stream_name_digital = "ALC861VD Digital";
12533 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12534 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12536 spec->adc_nids = alc861vd_adc_nids;
12537 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12539 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12540 spec->num_mixers++;
12542 spec->vmaster_nid = 0x02;
12544 codec->patch_ops = alc_patch_ops;
12546 if (board_config == ALC861VD_AUTO)
12547 spec->init_hook = alc861vd_auto_init;
12548 #ifdef CONFIG_SND_HDA_POWER_SAVE
12549 if (!spec->loopback.amplist)
12550 spec->loopback.amplist = alc861vd_loopbacks;
12559 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12560 * configuration. Each pin widget can choose any input DACs and a mixer.
12561 * Each ADC is connected from a mixer of all inputs. This makes possible
12562 * 6-channel independent captures.
12564 * In addition, an independent DAC for the multi-playback (not used in this
12567 #define ALC662_DIGOUT_NID 0x06
12568 #define ALC662_DIGIN_NID 0x0a
12570 static hda_nid_t alc662_dac_nids[4] = {
12571 /* front, rear, clfe, rear_surr */
12575 static hda_nid_t alc662_adc_nids[1] = {
12580 /* FIXME: should be a matrix-type input source selection */
12582 static struct hda_input_mux alc662_capture_source = {
12586 { "Front Mic", 0x1 },
12592 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12600 static struct hda_input_mux alc662_eeepc_capture_source = {
12608 #define alc662_mux_enum_info alc_mux_enum_info
12609 #define alc662_mux_enum_get alc_mux_enum_get
12611 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12612 struct snd_ctl_elem_value *ucontrol)
12614 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12615 struct alc_spec *spec = codec->spec;
12616 const struct hda_input_mux *imux = spec->input_mux;
12617 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12618 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12619 hda_nid_t nid = capture_mixers[adc_idx];
12620 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12621 unsigned int i, idx;
12623 idx = ucontrol->value.enumerated.item[0];
12624 if (idx >= imux->num_items)
12625 idx = imux->num_items - 1;
12626 if (*cur_val == idx)
12628 for (i = 0; i < imux->num_items; i++) {
12629 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12630 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12631 imux->items[i].index,
12640 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12647 static struct hda_verb alc662_3ST_ch2_init[] = {
12648 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12649 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12650 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12651 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12658 static struct hda_verb alc662_3ST_ch6_init[] = {
12659 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12660 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12661 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12662 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12663 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12664 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12668 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12669 { 2, alc662_3ST_ch2_init },
12670 { 6, alc662_3ST_ch6_init },
12676 static struct hda_verb alc662_sixstack_ch6_init[] = {
12677 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12678 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12679 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12686 static struct hda_verb alc662_sixstack_ch8_init[] = {
12687 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12688 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12689 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12693 static struct hda_channel_mode alc662_5stack_modes[2] = {
12694 { 2, alc662_sixstack_ch6_init },
12695 { 6, alc662_sixstack_ch8_init },
12698 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12699 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12702 static struct snd_kcontrol_new alc662_base_mixer[] = {
12703 /* output mixer control */
12704 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12705 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12706 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12707 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12708 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12709 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12710 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12711 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12712 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12714 /*Input mixer control */
12715 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12716 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12717 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12718 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12719 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12720 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12721 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12722 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12726 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12727 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12728 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12729 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12730 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12731 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12732 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12733 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12734 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12735 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12736 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12737 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12738 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12739 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12743 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12744 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12745 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12746 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12747 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12748 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12749 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12750 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12751 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12753 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12754 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12755 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12756 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12759 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12760 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12761 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12762 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12766 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12767 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12768 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12769 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12770 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
12771 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12772 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12773 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12774 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12779 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12780 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12782 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12783 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12785 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12786 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12787 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12789 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12790 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12791 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12795 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
12796 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12797 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12798 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12799 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12800 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12801 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12802 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12803 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12804 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12805 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
12806 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12807 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12813 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
12815 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12816 .name = "Channel Mode",
12817 .info = alc_ch_mode_info,
12818 .get = alc_ch_mode_get,
12819 .put = alc_ch_mode_put,
12824 static struct hda_verb alc662_init_verbs[] = {
12825 /* ADC: mute amp left and right */
12826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12827 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12828 /* Front mixer: unmute input/output amp left and right (volume = 0) */
12830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12838 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12839 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12840 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12843 /* Front Pin: output 0 (0x0c) */
12844 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12847 /* Rear Pin: output 1 (0x0d) */
12848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12851 /* CLFE Pin: output 2 (0x0e) */
12852 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12853 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12855 /* Mic (rear) pin: input vref at 80% */
12856 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12857 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12858 /* Front Mic pin: input vref at 80% */
12859 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12860 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12861 /* Line In pin: input */
12862 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12863 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12864 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12866 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12867 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12868 /* CD pin widget for input */
12869 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12871 /* FIXME: use matrix-type input source selection */
12872 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12875 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12879 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12880 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12881 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12882 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12886 static struct hda_verb alc662_sue_init_verbs[] = {
12887 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
12888 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
12892 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
12893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12898 /* Set Unsolicited Event*/
12899 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
12900 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12901 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12906 * generic initialization of ADC, input mixers and output mixers
12908 static struct hda_verb alc662_auto_init_verbs[] = {
12910 * Unmute ADC and set the default input to mic-in
12912 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12915 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12917 * Note: PASD motherboards uses the Line In 2 as the input for front
12918 * panel mic (mic 2)
12920 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12928 * Set up output mixers (0x0c - 0x0f)
12930 /* set vol=0 to output mixers */
12931 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12932 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12933 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12935 /* set up input amps for analog loopback */
12936 /* Amp Indices: DAC = 0, mixer = 1 */
12937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12940 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12941 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12942 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12945 /* FIXME: use matrix-type input source selection */
12946 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12948 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12953 /* capture mixer elements */
12954 static struct snd_kcontrol_new alc662_capture_mixer[] = {
12955 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12956 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12958 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12959 /* The multiple "Capture Source" controls confuse alsamixer
12960 * So call somewhat different..
12962 /* .name = "Capture Source", */
12963 .name = "Input Source",
12965 .info = alc662_mux_enum_info,
12966 .get = alc662_mux_enum_get,
12967 .put = alc662_mux_enum_put,
12972 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
12974 unsigned int present;
12975 unsigned char bits;
12977 present = snd_hda_codec_read(codec, 0x14, 0,
12978 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12979 bits = present ? HDA_AMP_MUTE : 0;
12980 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12981 HDA_AMP_MUTE, bits);
12984 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
12986 unsigned int present;
12987 unsigned char bits;
12989 present = snd_hda_codec_read(codec, 0x1b, 0,
12990 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12991 bits = present ? HDA_AMP_MUTE : 0;
12992 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12993 HDA_AMP_MUTE, bits);
12994 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12995 HDA_AMP_MUTE, bits);
12998 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13001 if ((res >> 26) == ALC880_HP_EVENT)
13002 alc662_lenovo_101e_all_automute(codec);
13003 if ((res >> 26) == ALC880_FRONT_EVENT)
13004 alc662_lenovo_101e_ispeaker_automute(codec);
13007 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13009 unsigned int present;
13011 present = snd_hda_codec_read(codec, 0x18, 0,
13012 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13013 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13014 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13015 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13016 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13017 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13018 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13019 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13020 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13023 /* unsolicited event for HP jack sensing */
13024 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13027 if ((res >> 26) == ALC880_HP_EVENT)
13028 alc262_hippo1_automute( codec );
13030 if ((res >> 26) == ALC880_MIC_EVENT)
13031 alc662_eeepc_mic_automute(codec);
13034 static void alc662_eeepc_inithook(struct hda_codec *codec)
13036 alc262_hippo1_automute( codec );
13037 alc662_eeepc_mic_automute(codec);
13040 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13043 unsigned int present;
13045 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13046 present = snd_hda_codec_read(codec, 0x14, 0,
13047 AC_VERB_GET_PIN_SENSE, 0);
13048 present = (present & 0x80000000) != 0;
13050 /* mute internal speaker */
13051 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13052 HDA_AMP_MUTE, HDA_AMP_MUTE);
13054 /* unmute internal speaker if necessary */
13055 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13056 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13057 HDA_AMP_MUTE, mute);
13061 /* unsolicited event for HP jack sensing */
13062 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13065 if ((res >> 26) == ALC880_HP_EVENT)
13066 alc662_eeepc_ep20_automute(codec);
13069 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13071 alc662_eeepc_ep20_automute(codec);
13074 #ifdef CONFIG_SND_HDA_POWER_SAVE
13075 #define alc662_loopbacks alc880_loopbacks
13079 /* pcm configuration: identiacal with ALC880 */
13080 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13081 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13082 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13083 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13086 * configuration and preset
13088 static const char *alc662_models[ALC662_MODEL_LAST] = {
13089 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13090 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13091 [ALC662_3ST_6ch] = "3stack-6ch",
13092 [ALC662_5ST_DIG] = "6stack-dig",
13093 [ALC662_LENOVO_101E] = "lenovo-101e",
13094 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13095 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13096 [ALC662_AUTO] = "auto",
13099 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13100 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13101 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13102 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13106 static struct alc_config_preset alc662_presets[] = {
13107 [ALC662_3ST_2ch_DIG] = {
13108 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13109 .init_verbs = { alc662_init_verbs },
13110 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13111 .dac_nids = alc662_dac_nids,
13112 .dig_out_nid = ALC662_DIGOUT_NID,
13113 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13114 .adc_nids = alc662_adc_nids,
13115 .dig_in_nid = ALC662_DIGIN_NID,
13116 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13117 .channel_mode = alc662_3ST_2ch_modes,
13118 .input_mux = &alc662_capture_source,
13120 [ALC662_3ST_6ch_DIG] = {
13121 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13122 alc662_capture_mixer },
13123 .init_verbs = { alc662_init_verbs },
13124 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13125 .dac_nids = alc662_dac_nids,
13126 .dig_out_nid = ALC662_DIGOUT_NID,
13127 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13128 .adc_nids = alc662_adc_nids,
13129 .dig_in_nid = ALC662_DIGIN_NID,
13130 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13131 .channel_mode = alc662_3ST_6ch_modes,
13133 .input_mux = &alc662_capture_source,
13135 [ALC662_3ST_6ch] = {
13136 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13137 alc662_capture_mixer },
13138 .init_verbs = { alc662_init_verbs },
13139 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13140 .dac_nids = alc662_dac_nids,
13141 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13142 .adc_nids = alc662_adc_nids,
13143 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13144 .channel_mode = alc662_3ST_6ch_modes,
13146 .input_mux = &alc662_capture_source,
13148 [ALC662_5ST_DIG] = {
13149 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13150 alc662_capture_mixer },
13151 .init_verbs = { alc662_init_verbs },
13152 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13153 .dac_nids = alc662_dac_nids,
13154 .dig_out_nid = ALC662_DIGOUT_NID,
13155 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13156 .adc_nids = alc662_adc_nids,
13157 .dig_in_nid = ALC662_DIGIN_NID,
13158 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13159 .channel_mode = alc662_5stack_modes,
13160 .input_mux = &alc662_capture_source,
13162 [ALC662_LENOVO_101E] = {
13163 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13164 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13165 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13166 .dac_nids = alc662_dac_nids,
13167 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13168 .adc_nids = alc662_adc_nids,
13169 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13170 .channel_mode = alc662_3ST_2ch_modes,
13171 .input_mux = &alc662_lenovo_101e_capture_source,
13172 .unsol_event = alc662_lenovo_101e_unsol_event,
13173 .init_hook = alc662_lenovo_101e_all_automute,
13175 [ALC662_ASUS_EEEPC_P701] = {
13176 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13177 .init_verbs = { alc662_init_verbs,
13178 alc662_eeepc_sue_init_verbs },
13179 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13180 .dac_nids = alc662_dac_nids,
13181 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
13182 .adc_nids = alc662_adc_nids,
13183 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13184 .channel_mode = alc662_3ST_2ch_modes,
13185 .input_mux = &alc662_eeepc_capture_source,
13186 .unsol_event = alc662_eeepc_unsol_event,
13187 .init_hook = alc662_eeepc_inithook,
13189 [ALC662_ASUS_EEEPC_EP20] = {
13190 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13191 alc662_chmode_mixer },
13192 .init_verbs = { alc662_init_verbs,
13193 alc662_eeepc_ep20_sue_init_verbs },
13194 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13195 .dac_nids = alc662_dac_nids,
13196 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13197 .adc_nids = alc662_adc_nids,
13198 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13199 .channel_mode = alc662_3ST_6ch_modes,
13200 .input_mux = &alc662_lenovo_101e_capture_source,
13201 .unsol_event = alc662_eeepc_ep20_unsol_event,
13202 .init_hook = alc662_eeepc_ep20_inithook,
13209 * BIOS auto configuration
13212 /* add playback controls from the parsed DAC table */
13213 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13214 const struct auto_pin_cfg *cfg)
13217 static const char *chname[4] = {
13218 "Front", "Surround", NULL /*CLFE*/, "Side"
13223 for (i = 0; i < cfg->line_outs; i++) {
13224 if (!spec->multiout.dac_nids[i])
13226 nid = alc880_idx_to_dac(i);
13229 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13230 "Center Playback Volume",
13231 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13235 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13236 "LFE Playback Volume",
13237 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13241 err = add_control(spec, ALC_CTL_BIND_MUTE,
13242 "Center Playback Switch",
13243 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13247 err = add_control(spec, ALC_CTL_BIND_MUTE,
13248 "LFE Playback Switch",
13249 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13254 sprintf(name, "%s Playback Volume", chname[i]);
13255 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13256 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13260 sprintf(name, "%s Playback Switch", chname[i]);
13261 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13262 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13271 /* add playback controls for speaker and HP outputs */
13272 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13282 if (alc880_is_fixed_pin(pin)) {
13283 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13284 /* printk("DAC nid=%x\n",nid); */
13285 /* specify the DAC as the extra output */
13286 if (!spec->multiout.hp_nid)
13287 spec->multiout.hp_nid = nid;
13289 spec->multiout.extra_out_nid[0] = nid;
13290 /* control HP volume/switch on the output mixer amp */
13291 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13292 sprintf(name, "%s Playback Volume", pfx);
13293 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13294 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13297 sprintf(name, "%s Playback Switch", pfx);
13298 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13299 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13302 } else if (alc880_is_multi_pin(pin)) {
13303 /* set manual connection */
13304 /* we have only a switch on HP-out PIN */
13305 sprintf(name, "%s Playback Switch", pfx);
13306 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13307 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13314 /* create playback/capture controls for input pins */
13315 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13316 const struct auto_pin_cfg *cfg)
13318 struct hda_input_mux *imux = &spec->private_imux;
13321 for (i = 0; i < AUTO_PIN_LAST; i++) {
13322 if (alc880_is_input_pin(cfg->input_pins[i])) {
13323 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13324 err = new_analog_input(spec, cfg->input_pins[i],
13325 auto_pin_cfg_labels[i],
13329 imux->items[imux->num_items].label =
13330 auto_pin_cfg_labels[i];
13331 imux->items[imux->num_items].index =
13332 alc880_input_pin_idx(cfg->input_pins[i]);
13339 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13340 hda_nid_t nid, int pin_type,
13343 /* set as output */
13344 snd_hda_codec_write(codec, nid, 0,
13345 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
13346 snd_hda_codec_write(codec, nid, 0,
13347 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
13348 /* need the manual connection? */
13349 if (alc880_is_multi_pin(nid)) {
13350 struct alc_spec *spec = codec->spec;
13351 int idx = alc880_multi_pin_idx(nid);
13352 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13353 AC_VERB_SET_CONNECT_SEL,
13354 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13358 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13360 struct alc_spec *spec = codec->spec;
13363 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13364 for (i = 0; i <= HDA_SIDE; i++) {
13365 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13366 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13368 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13373 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13375 struct alc_spec *spec = codec->spec;
13378 pin = spec->autocfg.hp_pins[0];
13379 if (pin) /* connect to front */
13381 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13384 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13385 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13387 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13389 struct alc_spec *spec = codec->spec;
13392 for (i = 0; i < AUTO_PIN_LAST; i++) {
13393 hda_nid_t nid = spec->autocfg.input_pins[i];
13394 if (alc662_is_input_pin(nid)) {
13395 snd_hda_codec_write(codec, nid, 0,
13396 AC_VERB_SET_PIN_WIDGET_CONTROL,
13397 (i <= AUTO_PIN_FRONT_MIC ?
13398 PIN_VREF80 : PIN_IN));
13399 if (nid != ALC662_PIN_CD_NID)
13400 snd_hda_codec_write(codec, nid, 0,
13401 AC_VERB_SET_AMP_GAIN_MUTE,
13407 static int alc662_parse_auto_config(struct hda_codec *codec)
13409 struct alc_spec *spec = codec->spec;
13411 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13413 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13417 if (!spec->autocfg.line_outs)
13418 return 0; /* can't find valid BIOS pin config */
13420 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13423 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13426 err = alc662_auto_create_extra_out(spec,
13427 spec->autocfg.speaker_pins[0],
13431 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13435 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13439 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13441 if (spec->autocfg.dig_out_pin)
13442 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13444 if (spec->kctl_alloc)
13445 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13447 spec->num_mux_defs = 1;
13448 spec->input_mux = &spec->private_imux;
13450 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13451 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13452 spec->num_mixers++;
13456 /* additional initialization for auto-configuration model */
13457 static void alc662_auto_init(struct hda_codec *codec)
13459 alc662_auto_init_multi_out(codec);
13460 alc662_auto_init_hp_out(codec);
13461 alc662_auto_init_analog_input(codec);
13464 static int patch_alc662(struct hda_codec *codec)
13466 struct alc_spec *spec;
13467 int err, board_config;
13469 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13473 codec->spec = spec;
13475 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13478 if (board_config < 0) {
13479 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13480 "trying auto-probe from BIOS...\n");
13481 board_config = ALC662_AUTO;
13484 if (board_config == ALC662_AUTO) {
13485 /* automatic parse from the BIOS config */
13486 err = alc662_parse_auto_config(codec);
13492 "hda_codec: Cannot set up configuration "
13493 "from BIOS. Using base mode...\n");
13494 board_config = ALC662_3ST_2ch_DIG;
13498 if (board_config != ALC662_AUTO)
13499 setup_preset(spec, &alc662_presets[board_config]);
13501 spec->stream_name_analog = "ALC662 Analog";
13502 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13503 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13505 spec->stream_name_digital = "ALC662 Digital";
13506 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13507 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13509 if (!spec->adc_nids && spec->input_mux) {
13510 spec->adc_nids = alc662_adc_nids;
13511 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13514 spec->vmaster_nid = 0x02;
13516 codec->patch_ops = alc_patch_ops;
13517 if (board_config == ALC662_AUTO)
13518 spec->init_hook = alc662_auto_init;
13519 #ifdef CONFIG_SND_HDA_POWER_SAVE
13520 if (!spec->loopback.amplist)
13521 spec->loopback.amplist = alc662_loopbacks;
13530 struct hda_codec_preset snd_hda_preset_realtek[] = {
13531 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13532 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13533 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13534 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13535 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13536 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13537 .patch = patch_alc861 },
13538 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13539 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13540 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13541 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13542 .patch = patch_alc883 },
13543 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13544 .patch = patch_alc662 },
13545 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13546 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13547 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13548 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13549 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13550 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13551 {} /* terminator */