Commit 63a3c990 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Add mute LED quirk

AC97 Codec Core,Intel8x0 driver
A new quirk type, AC97_TUNE_MUTE_LED, is added for HP/Compaq laptops.
With this quirk, the EAPD bit is used to control the mute LED in
conjunction with the master mute switch.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 906aaf30
......@@ -554,6 +554,7 @@ enum {
AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */
AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */
AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */
AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */
};
struct ac97_quirk {
......
......@@ -2430,6 +2430,43 @@ static int tune_inv_eapd(ac97_t *ac97)
return 0;
}
static int master_mute_sw_put_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
{
int err = snd_ac97_put_single(kcontrol, ucontrol);
if (err > 0) {
ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000,
ac97->regs[AC97_MASTER] & 0x8000);
}
return err;
}
static int master_mute_sw_put_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
{
int err = snd_ac97_put_double(kcontrol, ucontrol);
if (err > 0) {
ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000,
(ac97->regs[AC97_MASTER] & 0x8080) == 0x8080 ?
0x8000 : 0);
}
return err;
}
static int tune_mute_led(ac97_t *ac97)
{
snd_kcontrol_t *msw = ctl_find(ac97, "Master Playback Switch", NULL);
if (! msw)
return -ENOENT;
if (msw->put == snd_ac97_put_double)
msw->put = master_mute_sw_put_double;
else
msw->put = master_mute_sw_put_single;
snd_ac97_remove_ctl(ac97, "External Amplifier", NULL);
snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, 0x8000); /* mute LED on */
return 0;
}
static int apply_quirk(ac97_t *ac97, int quirk)
{
switch (quirk) {
......@@ -2447,6 +2484,8 @@ static int apply_quirk(ac97_t *ac97, int quirk)
return tune_alc_jack(ac97);
case AC97_TUNE_INV_EAPD:
return tune_inv_eapd(ac97);
case AC97_TUNE_MUTE_LED:
return tune_mute_led(ac97);
}
return -EINVAL;
}
......
......@@ -1737,6 +1737,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
.name = "Compaq Evo D510C",
.type = AC97_TUNE_HP_ONLY
},
{
.vendor = 0x0e11,
.device = 0x0860,
.name = "HP/Compaq nx7010",
.type = AC97_TUNE_MUTE_LED
},
{
.vendor = 0x1014,
.device = 0x1f00,
......@@ -1779,6 +1785,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
.name = "Hewlett-Packard onboard",
.type = AC97_TUNE_HP_ONLY
},
{
.vendor = 0x103c,
.device = 0x0890,
.name = "HP NC6000",
.type = AC97_TUNE_MUTE_LED
},
{
.vendor = 0x103c,
.device = 0x12f1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment