From: Hans de Goede <hdegoede@redhat.com>
To: Jaroslav Kysela <perex@perex.cz>, Mark Brown <broonie@kernel.org>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: [RFC 2/2] ASoC: rt5670: Add LED trigger support
Date: Thu, 4 Mar 2021 20:39:30 +0100 [thread overview]
Message-ID: <7c6c2f44-e6a1-48e7-773e-033ba4582742@redhat.com> (raw)
In-Reply-To: <4b61303c-cee6-32cc-a9b9-3de7db0043d8@perex.cz>
Hi,
On 3/2/21 10:14 PM, Jaroslav Kysela wrote:
> Dne 01. 03. 21 v 22:26 Hans de Goede napsal(a):
>> Hi,
>>
>> On 3/1/21 9:43 PM, Mark Brown wrote:
>>> On Mon, Mar 01, 2021 at 08:49:34PM +0100, Hans de Goede wrote:
>>>> On 3/1/21 8:15 PM, Mark Brown wrote:
>>>
>>>>> Off the top of my head something like writing a control name into a
>>>>> sysfs file might work, it doesn't scale if you need to use multiple
>>>>> controls as rt5640 does though.
>>>
>>>> Currently ALSA/UCM does not use sysfs files for anything, so this
>>>> feels very inconsistent with how all the rest of this currently works.
>>>
>>> Yes, you'd really want to add string controls in ALSA.
>>
>> Hmm, we already have SNDRV_CTL_ELEM_TYPE_BYTES controls. I think that will
>> work nicely actually, we can have the UCM conf file send a 0 terminated
>> string to the driver that way. It would be nice to have some syntactic
>> sugar on the UCM side to be able to actually specify a string instead
>> of an array of bytes, but I don't think we need any new userspace API
>> for this.
>
> The LEDs are controlled per machine not per card. So do we need to create the 'Speaker/Mic LED Control' control for all cards?
>
> Also, this change sounds really generic. The interface may be implemented in my proposed control led kernel module, not in the codec drivers.
>
> The Mark's sysfs idea is not bad in my opinion. The sequences may be extended in UCM, we have already 'exec' command. Yes, this command is a little heavy for the sysfs writes, but we can add command like 'sysset' or so for sysfs like:
Okay, so this would be a sysfs file per card then? Sol we would have for example
2 new sysfs files like this show up when your module is loaded:
/sys/class/sounds/card0/spk_mute_led_control
/sys/class/sounds/card0/mic_mute_led_control
And reading would iterate over all mixer-elements of the card and print
the names of those which have the relevant access LED flag set, where
as a write would be taken as a control-name to add the access LED flag
too?
And an empty write would be special and clear the flag on all controls?
I guess we don't strictly need that if we only set things up at boot once,
but it might still be handy to force things to a clean state.
>
> # detach all speaker LED controls for card 1
> # similar to 'echo -n "card=1,*" > /sysfs/devices/virtual/sound/ctl-led/speaker/detach'
> sysset "devices/virtual/sound/ctl-led/speaker/detach:card=1,*"
>
> # attach the 'Speaker Playback Switch',10 control to speaker LED trigger in card 1
> # similar to 'echo -n "card=1,iface=MIXER,name='Speaker Playback Switch',index=10" > /sysfs/devices/virtual/sound/ctl-led/speaker/attach
> sysset "devices/virtual/sound/ctl-led/speaker/attach:card=1,iface=MIXER,name='Speaker Playback Switch',index=10"
I think a sysfs file per card would work better, that would certainly be
a lot more inline with how sysfs is normally used...
Also do we need the iface=MIXER part ?
> Security: The LED-control bindings should be handled only in the boot / init phase (thus in UCM BootSequence section) and the sysfs interface files should be read-only for normal users.
Yes that make sense, but it will require some extra helper to that, I guess it
could be an extra flag to the alsactl restore command which already gets run
at boot, or an extra alsactl command ?
Regards,
Hans
next prev parent reply other threads:[~2021-03-04 19:40 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-15 14:24 [RFC 0/2] ASoC: rt5670: Add LED trigger support Hans de Goede
2021-02-15 14:24 ` [RFC 1/2] ASoC: Add new SOC_DOUBLE*_ACCESS() macros Hans de Goede
2021-02-15 14:24 ` [RFC 2/2] ASoC: rt5670: Add LED trigger support Hans de Goede
2021-02-23 13:45 ` Mark Brown
2021-02-23 13:59 ` Hans de Goede
2021-02-23 14:09 ` Mark Brown
2021-02-23 14:21 ` Takashi Iwai
2021-02-23 16:14 ` Jaroslav Kysela
2021-02-23 16:20 ` Takashi Iwai
2021-02-23 20:56 ` Jaroslav Kysela
2021-02-24 7:12 ` Takashi Iwai
2021-02-24 8:14 ` Jaroslav Kysela
2021-02-24 8:52 ` Takashi Iwai
2021-02-24 9:27 ` Jaroslav Kysela
2021-02-24 9:38 ` Takashi Iwai
2021-02-24 9:49 ` Jaroslav Kysela
2021-02-24 10:33 ` Takashi Iwai
2021-02-24 10:56 ` Jaroslav Kysela
2021-02-24 11:43 ` Takashi Iwai
2021-02-24 12:08 ` Jaroslav Kysela
2021-02-24 12:42 ` Takashi Iwai
2021-02-24 17:57 ` Jaroslav Kysela
2021-02-25 11:00 ` Takashi Iwai
2021-02-25 18:09 ` Jaroslav Kysela
2021-02-26 8:41 ` Takashi Iwai
2021-02-26 9:22 ` Jaroslav Kysela
2021-02-23 17:07 ` Hans de Goede
2021-02-23 17:20 ` Mark Brown
2021-02-23 19:03 ` Hans de Goede
2021-02-24 12:59 ` Mark Brown
2021-02-24 19:14 ` Hans de Goede
2021-02-24 19:36 ` Mark Brown
2021-02-24 20:09 ` Hans de Goede
2021-02-25 14:59 ` Mark Brown
2021-02-25 18:45 ` Hans de Goede
2021-03-01 13:23 ` Mark Brown
2021-03-01 13:39 ` Hans de Goede
2021-03-01 19:15 ` Mark Brown
2021-03-01 19:49 ` Hans de Goede
2021-03-01 20:43 ` Mark Brown
2021-03-01 21:26 ` Hans de Goede
2021-03-02 12:41 ` Mark Brown
2021-03-02 21:14 ` Jaroslav Kysela
2021-03-04 19:39 ` Hans de Goede [this message]
2021-03-05 13:02 ` Jaroslav Kysela
2021-03-07 13:51 ` Hans de Goede
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=7c6c2f44-e6a1-48e7-773e-033ba4582742@redhat.com \
--to=hdegoede@redhat.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=perex@perex.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).