On Sun, 07 Feb 2021 21:11:57 +0100, Jaroslav Kysela wrote:
[DO NOT MERGE!] [This is just an early proposal for comments] [The code is not tested / debugged]
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 path 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, 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.).
Having a common helper in the ALSA core sounds like a good way to go.
My slight concern is that this will end up having the dependency on LEDS stuff unconditionally when CONFIG_SND_LED=y.
Also, are those new access flags exposed to user-space intentionally, so that user-space gets some information?
Last but not least: I'm not sure whether we should limit to only two LEDs (mic and spk). I'm afraid that there will be more LEDs in future; people love decorations :)
thanks,
Takashi