All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Hans de Goede <hdegoede@redhat.com>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: [PATCH v4 6/6] ALSA: led control - add sysfs kcontrol LED marking layer
Date: Sat, 20 Mar 2021 08:41:09 +0100	[thread overview]
Message-ID: <s5h35wqff1m.wl-tiwai@suse.de> (raw)
In-Reply-To: <3820909c-29ce-9f3f-d1e6-c4611e06abe4@redhat.com>

On Fri, 19 Mar 2021 23:08:33 +0100,
Hans de Goede wrote:
> 
> Hi,
> 
> On 3/19/21 6:22 PM, Takashi Iwai wrote:
> > On Fri, 19 Mar 2021 17:34:39 +0100,
> > Hans de Goede wrote:
> >>
> >> Hi,
> >>
> >> On 3/17/21 6:29 PM, Jaroslav Kysela wrote:
> >>> We need to manage the kcontrol entries association for the LED trigger
> >>> from the user space. This patch adds a layer to the sysfs tree like:
> >>>
> >>> /sys/devices/virtual/sound/ctl-led/mic
> >>>    + card0
> >>>    |  + attach
> >>>    |  + detach
> >>>    |  ...
> >>>    + card1
> >>>       + attach
> >>>       ...
> >>>
> >>> Operations:
> >>>
> >>>   attach and detach
> >>>     - amixer style ID is accepted and easy strings for numid and
> >>>       simple names
> >>>   reset
> >>>     - reset all associated kcontrol entries
> >>>   list
> >>>     - list associated kcontrol entries (numid values only)
> >>>
> >>> Additional symlinks:
> >>>
> >>> /sys/devices/virtual/sound/ctl-led/mic/card0/card ->
> >>>   /sys/class/sound/card0
> >>>
> >>> /sys/class/sound/card0/controlC0/led-mic ->
> >>>   /sys/devices/virtual/sound/ctl-led/mic/card0
> >>>
> >>> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
> >>
> >> Thank you so much for this patch.
> >>
> >> I've given this new version a try, dropping my sound/soc/codecs/rt56??.c patches to set the access-flags directly.
> >>
> >> And with these 3 lines in /etc/rc.d/rc.local I get nicely working control of the mute
> >> LED build into the (detachable) USB-keyboard's mute hot-key:
> >>
> >> modprobe snd_ctl_led
> >> echo -n name="Speaker Channel Switch" > /sys/class/sound/card1/controlC1/led-speaker/attach
> >> echo -n name="HP Channel Switch" > /sys/class/sound/card1/controlC1/led-speaker/attach
> >>
> >> This needs to be replaced by some UCM profile code doing the equivalent of course,
> >> but for a proof-of-concept test of the kernel API this introduces the above will do.
> > 
> > IMO, that's the question: how we'll enable this in future.  If the
> > binding of the control/mute mapping is provided via UCM, it's supposed
> > to be changeable by each user.  Then the current sysfs permission
> > doesn't fit.  OTOH, if it's 0666, it's accessible to all users even
> > remotely, which is worse than the access with the normal sound device
> > file.  Or if it's supposed to be changed via udev stuff or systemd?
> > Or is it just for debugging?
> > 
> > Through a quick glance over the series, I'm fine to take those
> > patches, but the only concern is the sysfs entries.  Basically, once
> > when we use sysfs entries, it's set in stone.  So we should be very
> > clear about our strategy how to deploy the control/mute mapping
> > regarding using those sysfs entries.
> > 
> > OTOH, if the interface is thought for debugging or development
> > purpose, it could be done in debugfs, which we can keep playing in
> > further development, too.
> > 
> > And, BTW, the mute LED mode setup doesn't have to be sysfs entries;
> > we'd need primarily only the flags for inverted LED behavior, and
> > those are only two, so it could be simply module options.  Then it's
> > even easier for users to set up than tweaking sysfs entries.
> 
> The flexibility offered by this new sysfs API is necessary for the ASoC
> codec drivers, because Mark does not want to have which controls are
> tied to the LED triggers hard-coded inside the codec drivers.

The hard-coded mapping itself isn't always bad things, IMO.  Of
course, it's a question whether to be done in the codec driver in a
fixed routing.  A machine driver would fit well, instead; i.e. instead
of the control-access bit flag, just bind statically from the machine
driver after instantiating the kctl objects like sysfs does.

> So as Jaroslav mentions in his reply, the plan is to have the UCM
> profiles contain commands to setup the LED triggers to this new
> sysfs API.

IIUC, this won't be only UCM but also the combination of udev +
alsactl + UCM, right?

Would other OS can follow a similar pattern?  Let's check that first
(although I myself think this should be feasible).


thanks,

Takashi

  reply	other threads:[~2021-03-20  7:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 17:29 [PATCH v4 0/6] ALSA: control - add generic LED API Jaroslav Kysela
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 [this message]
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=s5h35wqff1m.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=hdegoede@redhat.com \
    /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.