Commit d0263836 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

ALSA: hda - Fix mute-LED fixed mode

commit ee52e56e upstream.

The mute-LED mode control has the fixed on/off states that are
supposed to remain on/off regardless of the master switch.  However,
this doesn't work actually because the vmaster hook is called in the
vmaster code itself.

This patch fixes it by calling the hook indirectly after checking the
mute LED mode.
Reported-and-tested-by: default avatarPali Rohár <pali.rohar@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db5cbcca
...@@ -2082,6 +2082,16 @@ static void put_vol_mute(struct hda_codec *codec, unsigned int amp_caps, ...@@ -2082,6 +2082,16 @@ static void put_vol_mute(struct hda_codec *codec, unsigned int amp_caps,
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm); snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm);
} }
/* meta hook to call each driver's vmaster hook */
static void vmaster_hook(void *private_data, int enabled)
{
struct hda_vmaster_mute_hook *hook = private_data;
if (hook->mute_mode != HDA_VMUTE_FOLLOW_MASTER)
enabled = hook->mute_mode;
hook->hook(hook->codec, enabled);
}
/** /**
* snd_hda_codec_amp_read - Read AMP value * snd_hda_codec_amp_read - Read AMP value
* @codec: HD-audio codec * @codec: HD-audio codec
...@@ -2917,9 +2927,9 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec, ...@@ -2917,9 +2927,9 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec,
if (!hook->hook || !hook->sw_kctl) if (!hook->hook || !hook->sw_kctl)
return 0; return 0;
snd_ctl_add_vmaster_hook(hook->sw_kctl, hook->hook, codec);
hook->codec = codec; hook->codec = codec;
hook->mute_mode = HDA_VMUTE_FOLLOW_MASTER; hook->mute_mode = HDA_VMUTE_FOLLOW_MASTER;
snd_ctl_add_vmaster_hook(hook->sw_kctl, vmaster_hook, hook);
if (!expose_enum_ctl) if (!expose_enum_ctl)
return 0; return 0;
kctl = snd_ctl_new1(&vmaster_mute_mode, hook); kctl = snd_ctl_new1(&vmaster_mute_mode, hook);
...@@ -2942,14 +2952,7 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook) ...@@ -2942,14 +2952,7 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook)
*/ */
if (hook->codec->bus->shutdown) if (hook->codec->bus->shutdown)
return; return;
switch (hook->mute_mode) { snd_ctl_sync_vmaster_hook(hook->sw_kctl);
case HDA_VMUTE_FOLLOW_MASTER:
snd_ctl_sync_vmaster_hook(hook->sw_kctl);
break;
default:
hook->hook(hook->codec, hook->mute_mode);
break;
}
} }
EXPORT_SYMBOL_GPL(snd_hda_sync_vmaster_hook); EXPORT_SYMBOL_GPL(snd_hda_sync_vmaster_hook);
......
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