提交 f8225f6d 编写于 作者: J Jonathan Woithe 提交者: Jaroslav Kysela

[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: NJonathan Woithe <jwoithe@physics.adelaide.edu.au>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NJaroslav Kysela <perex@perex.cz>
上级 a713b583
...@@ -608,6 +608,59 @@ static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, ...@@ -608,6 +608,59 @@ static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
.private_value = nid | (mask<<16) } .private_value = nid | (mask<<16) }
#endif /* CONFIG_SND_DEBUG */ #endif /* CONFIG_SND_DEBUG */
/* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
* Again, this is only used in the ALC26x test models to help identify when
* the EAPD line must be asserted for features to work.
*/
#ifdef CONFIG_SND_DEBUG
#define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
hda_nid_t nid = kcontrol->private_value & 0xffff;
unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
long *valp = ucontrol->value.integer.value;
unsigned int val = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_EAPD_BTLENABLE, 0x00);
*valp = (val & mask) != 0;
return 0;
}
static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int change;
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
hda_nid_t nid = kcontrol->private_value & 0xffff;
unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
long val = *ucontrol->value.integer.value;
unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_EAPD_BTLENABLE,
0x00);
/* Set/unset the masked control bit(s) as needed */
change = (!val ? 0 : mask) != (ctrl_data & mask);
if (!val)
ctrl_data &= ~mask;
else
ctrl_data |= mask;
snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
ctrl_data);
return change;
}
#define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
.info = alc_eapd_ctrl_info, \
.get = alc_eapd_ctrl_get, \
.put = alc_eapd_ctrl_put, \
.private_value = nid | (mask<<16) }
#endif /* CONFIG_SND_DEBUG */
/* /*
* set up from the preset table * set up from the preset table
*/ */
...@@ -4332,6 +4385,12 @@ static struct snd_kcontrol_new alc260_test_mixer[] = { ...@@ -4332,6 +4385,12 @@ static struct snd_kcontrol_new alc260_test_mixer[] = {
ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
/* A switch allowing EAPD to be enabled. Some laptops seem to use
* this output to turn on an external amplifier.
*/
ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
{ } /* end */ { } /* end */
}; };
static struct hda_verb alc260_test_init_verbs[] = { static struct hda_verb alc260_test_init_verbs[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册