diff options
author | Jaroslav Kysela <perex@perex.cz> | 2021-03-17 18:29:42 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-03-30 15:33:58 +0200 |
commit | 22d8de62f11b287b279f1d4473a78c7d5e53e7bc (patch) | |
tree | c70cf12a37bf874e36b727dbefece077b34febe5 /sound/core/control.c | |
parent | 3f0638a0333bfdd0549985aa620f2ab69737af47 (diff) | |
download | linux-stable-22d8de62f11b287b279f1d4473a78c7d5e53e7bc.tar.gz linux-stable-22d8de62f11b287b279f1d4473a78c7d5e53e7bc.tar.bz2 linux-stable-22d8de62f11b287b279f1d4473a78c7d5e53e7bc.zip |
ALSA: control - add generic LED trigger module as the new control layer
The recent laptops have usually two LEDs assigned to reflect
the speaker and microphone mute state. This implementation
adds a tiny layer on top of the control API which calculates
the state for those LEDs using the driver callbacks.
Two new access flags are introduced to describe the controls
which affects the audio path settings (an easy code change
for drivers).
The LED resource can be shared with multiple sound cards with
this code. The user space controls may be added to the state
chain on demand, too.
This code should replace the LED code in the HDA driver and
add a possibility to easy extend the other drivers (ASoC
codecs etc.).
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210317172945.842280-4-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r-- | sound/core/control.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 87630021e434..6825ca75daf5 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -278,6 +278,7 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK | + SNDRV_CTL_ELEM_ACCESS_LED_MASK | SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK); err = snd_ctl_new(&kctl, count, access, NULL); @@ -1047,7 +1048,8 @@ static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl, if (result < 0) return result; /* drop internal access flags */ - info.access &= ~SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK; + info.access &= ~(SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK| + SNDRV_CTL_ELEM_ACCESS_LED_MASK); if (copy_to_user(_info, &info, sizeof(info))) return -EFAULT; return result; |