From: Jaroslav Kysela <perex@perex.cz>
To: ALSA development <alsa-devel@alsa-project.org>
Cc: Takashi Iwai <tiwai@suse.de>, Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH v4 0/6] ALSA: control - add generic LED API
Date: Wed, 17 Mar 2021 18:29:39 +0100 [thread overview]
Message-ID: <20210317172945.842280-1-perex@perex.cz> (raw)
This patchset tries to resolve the diversity in the audio LED
control among the ALSA drivers. A new control layer registration
is introduced which allows to run additional operations on
top of the elementary ALSA sound controls.
A new control access group (three bits in the access flags)
was introduced to carry the LED group information for
the sound controls. The low-level sound drivers can just
mark those controls using this access group. This information
is not exported to the user space, but user space can
manage the LED sound control associations through sysfs
(last patch) per Mark's request. It makes things fully
configurable in the kernel and user space (UCM).
The actual state ('route') evaluation is really easy
(the minimal value check for all channels / controls / cards).
If there's more complicated logic for a given hardware,
the card driver may eventually export a new read-only
sound control for the LED group and do the logic itself.
The new LED trigger control code is completely separated
and possibly optional (there's no symbol dependency).
The full code separation allows eventually to move this
LED trigger control to the user space in future.
Actually it replaces the already present functionality
in the kernel space (HDA drivers) and allows a quick adoption
for the recent hardware (ASoC codecs including SoundWire).
# lsmod | grep snd_ctl_led
snd_ctl_led 24576 0
The sound driver implementation is really easy:
1) call snd_ctl_led_request() when control LED layer should be
automatically activated
/ it calls module_request("snd-ctl-led") on demand /
2) mark all related kcontrols with
SNDRV_CTL_ELEM_ACCESS_SPK_LED or
SNDRV_CTL_ELEM_ACCESS_MIC_LED
v4 changes:
- the LED access flags are private to kernel now (no user space
API change)
- fixes (kctl management, sysfs cleanup)
- add the sysfs LED marking kcontrol management
- https://lore.kernel.org/alsa-devel/28fffebd-1ce9-7480-0f2f-ed8369abddf1@perex.cz/
v3 changes:
- reorder the controls_rwsem use to fix the remaining mutex issue
card->controls_rwsem <-> snd_ctl_layer_rwsem
v2 changes:
- fix the locking - remove the controls_rwsem read lock
in the element get (the consistency is already protected
with the global snd_ctl_led_mutex and possible partial
value writes are catched with the next value change
notification callback)
- rename state to brightness and show the brightness
unsigned integer value instead the text on/off string
(sync with the LED core routines)
- remove snd_ctl_led_hello() function (CI warning)
- make snd_ctl_led_get_by_access() function static (CI warning)
- move snd_ctl_layer_rwsem lock before the registraction
callback call in snd_ctl_register_layer() - optimization
v1:
- https://lore.kernel.org/alsa-devel/20210211111400.1131020-1-perex@perex.cz/
Original RFC:
- https://lore.kernel.org/alsa-devel/20210207201157.869972-1-perex@perex.cz/
Cc: Hans de Goede <hdegoede@redhat.com>
Jaroslav Kysela (6):
ALSA: control - introduce snd_ctl_notify_one() helper
ALSA: control - add layer registration routines
ALSA: control - add generic LED trigger module as the new control
layer
ALSA: HDA - remove the custom implementation for the audio LED trigger
ALSA: control - add sysfs support to the LED trigger module
ALSA: led control - add sysfs kcontrol LED marking layer
include/sound/control.h | 35 +-
sound/core/Kconfig | 6 +
sound/core/Makefile | 2 +
sound/core/control.c | 182 ++++++--
sound/core/control_led.c | 770 ++++++++++++++++++++++++++++++++
sound/pci/hda/Kconfig | 4 +-
sound/pci/hda/hda_codec.c | 69 +--
sound/pci/hda/hda_generic.c | 162 ++-----
sound/pci/hda/hda_generic.h | 15 +-
sound/pci/hda/hda_local.h | 16 +-
sound/pci/hda/patch_ca0132.c | 4 +-
sound/pci/hda/patch_realtek.c | 2 +-
sound/pci/hda/patch_sigmatel.c | 6 +-
sound/pci/hda/thinkpad_helper.c | 2 +-
14 files changed, 1011 insertions(+), 264 deletions(-)
create mode 100644 sound/core/control_led.c
--
2.29.2
next reply other threads:[~2021-03-17 17:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 17:29 Jaroslav Kysela [this message]
2021-03-17 17:29 ` [PATCH v4 1/6] ALSA: control - introduce snd_ctl_notify_one() helper Jaroslav Kysela
2021-03-17 17:29 ` [PATCH v4 2/6] ALSA: control - add layer registration routines Jaroslav Kysela
2021-03-17 17:29 ` [PATCH v4 3/6] ALSA: control - add generic LED trigger module as the new control layer Jaroslav Kysela
2021-03-17 17:29 ` [PATCH v4 4/6] ALSA: HDA - remove the custom implementation for the audio LED trigger Jaroslav Kysela
2021-03-17 17:29 ` [PATCH v4 5/6] ALSA: control - add sysfs support to the LED trigger module Jaroslav Kysela
2021-03-17 17:29 ` [PATCH v4 6/6] ALSA: led control - add sysfs kcontrol LED marking layer Jaroslav Kysela
2021-03-19 16:34 ` Hans de Goede
2021-03-19 17:22 ` Takashi Iwai
2021-03-19 17:58 ` Jaroslav Kysela
2021-03-19 22:08 ` Hans de Goede
2021-03-20 7:41 ` Takashi Iwai
2021-03-20 9:17 ` Hans de Goede
2021-03-20 9:48 ` Takashi Iwai
2021-03-22 14:16 ` Jaroslav Kysela
2021-03-23 9:38 ` Takashi Iwai
2021-03-23 9:49 ` Takashi Iwai
2021-03-23 10:31 ` Jaroslav Kysela
2021-03-23 10:42 ` Hans de Goede
2021-03-23 11:03 ` Takashi Iwai
2021-03-23 10:50 ` Takashi Iwai
2021-03-23 11:13 ` Jaroslav Kysela
2021-03-23 11:34 ` Takashi Iwai
2021-03-23 12:22 ` Jaroslav Kysela
2021-03-23 21:39 ` Curtis Malainey
2021-03-23 22:49 ` Dylan Reid
2021-03-26 8:07 ` Takashi Iwai
2021-03-19 18:11 ` Jaroslav Kysela
2021-03-19 22:13 ` Hans de Goede
2021-03-30 15:49 ` [PATCH v4 0/6] ALSA: control - add generic LED API Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210317172945.842280-1-perex@perex.cz \
--to=perex@perex.cz \
--cc=alsa-devel@alsa-project.org \
--cc=hdegoede@redhat.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.