aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJonathan Woithe <jwoithe@physics.adelaide.edu.au>2008-01-08 06:16:54 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:46 -0500
commitf8225f6d1f68c3d0a0fe844dc40a11cd432a853b (patch)
tree99500452a75b84da8e1ec4317a0c4356991c18df /sound
parenta713b5834731f32757b30de038dcb995afac2ad1 (diff)
[ALSA] hda-codec - Add EAPD controls for ALC260 test model
This implements a switch control for the EAPD signal output by the ALC26x chips. Since some laptops may utilise this to activate useful things it is handy to have a control for this in the ALC26x test models. The patch includes the control in the ALC260 test model. Signed-off-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 617f3ee304b1..0a64d24e7fda 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -608,6 +608,59 @@ static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
608 .private_value = nid | (mask<<16) } 608 .private_value = nid | (mask<<16) }
609#endif /* CONFIG_SND_DEBUG */ 609#endif /* CONFIG_SND_DEBUG */
610 610
611/* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
612 * Again, this is only used in the ALC26x test models to help identify when
613 * the EAPD line must be asserted for features to work.
614 */
615#ifdef CONFIG_SND_DEBUG
616#define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
617
618static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
619 struct snd_ctl_elem_value *ucontrol)
620{
621 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
622 hda_nid_t nid = kcontrol->private_value & 0xffff;
623 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
624 long *valp = ucontrol->value.integer.value;
625 unsigned int val = snd_hda_codec_read(codec, nid, 0,
626 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
627
628 *valp = (val & mask) != 0;
629 return 0;
630}
631
632static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
633 struct snd_ctl_elem_value *ucontrol)
634{
635 int change;
636 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
637 hda_nid_t nid = kcontrol->private_value & 0xffff;
638 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
639 long val = *ucontrol->value.integer.value;
640 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
641 AC_VERB_GET_EAPD_BTLENABLE,
642 0x00);
643
644 /* Set/unset the masked control bit(s) as needed */
645 change = (!val ? 0 : mask) != (ctrl_data & mask);
646 if (!val)
647 ctrl_data &= ~mask;
648 else
649 ctrl_data |= mask;
650 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
651 ctrl_data);
652
653 return change;
654}
655
656#define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
657 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
658 .info = alc_eapd_ctrl_info, \
659 .get = alc_eapd_ctrl_get, \
660 .put = alc_eapd_ctrl_put, \
661 .private_value = nid | (mask<<16) }
662#endif /* CONFIG_SND_DEBUG */
663
611/* 664/*
612 * set up from the preset table 665 * set up from the preset table
613 */ 666 */
@@ -4332,6 +4385,12 @@ static struct snd_kcontrol_new alc260_test_mixer[] = {
4332 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), 4385 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4333 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), 4386 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4334 4387
4388 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4389 * this output to turn on an external amplifier.
4390 */
4391 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4392 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4393
4335 { } /* end */ 4394 { } /* end */
4336}; 4395};
4337static struct hda_verb alc260_test_init_verbs[] = { 4396static struct hda_verb alc260_test_init_verbs[] = {