public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Marek Behún" <marek.behun@nic.cz>
Cc: Ondrej Jirman <megous@megous.com>,
	linux-kernel@vger.kernel.org,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Dan Murphy <dmurphy@ti.com>,
	"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>
Subject: Re: [PATCH RFC] leds: Add support for per-LED device triggers
Date: Sat, 4 Jul 2020 14:59:00 +0200	[thread overview]
Message-ID: <20200704125900.GA20503@amd> (raw)
In-Reply-To: <20200703120602.457cff1a@dellmb.labs.office.nic.cz>

[-- Attachment #1: Type: text/plain, Size: 2596 bytes --]

Hi!

> Some criticism to this approach to HW triggers:
> - every hw trigger for each LED has to be registered via current trigger
>   API. This will grow code size and memory footprint once this API is
>   widely used
> - one HW trigger can only master one LED device (via private_led
>   member). So if I have, for example an ethernet switch with 8 ports,
>   and each port has 2 LEDs, and each LED has 10 possible HW triggering
>   mechanisms, with your proposed API one would need to register 8*2*10
>   = 160 triggers

Well, code is simple, and so far I have seen 2 HW triggering
mechanisms, not 10. Maybe we should have a function to regiter a hw
trigger for a LED, so that internal implementation can be changed
more easily.

Ondrej: You already have code using this, right? Can we get an example?

> I too have been thinking about an API for HW LED triggers, and I
> tinkered with it a little. Some time ago I sent some emails, with
> subjects:
>   "RFC: LED hw triggering API"
>   "about my trigger-sources work"

Perhaps it is time to send them one more time, so Ondrej can say if it
works for him/looks okay for him?

> My current thoughts about how HW LED triggers could work nicely is as
> such:
>   - these members (maybe with different names) shall be added to struct
>     led_classdev:
>       available_hw_triggers()
>         - shall return a NULL terminated list of HW trigger names
>           available for this LED
>       set_hw_trigger()
>         - sets HW trigger for this LED. The LED triggering API shall
>           call this method after previous LED trigger is unset. If
>           called with NULL parameter, unsets HW trigger
>       current_hw_trigger
>         - name of the currently set HW LED trigger for this LED
>   - the driver registering the LED cdev informs abouth the LED being
>     capable of HW triggering - members available_hw_triggers and
>     set_hw_trigger must be set
>   - SW LED trigger and HW LED trigger are mutualy exclusive on one LED
>   - the trigger file in sysfs (/sys/class/leds/LED/trigger) shall first
>     list the available SW triggers, and then available hw triggers for
>     this LED, prefixed with "hw:"
>     When written, if the written trigger name starts with "hw:",
>     instead of setting SW trigger, a HW trigger is set via
>     set_hw_trigger() method

This does not sound bad, either.

Best regards,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2020-07-04 12:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02 14:47 [PATCH RFC] leds: Add support for per-LED device triggers Ondrej Jirman
2020-07-02 14:51 ` Ondřej Jirman
2020-07-03 10:06 ` Marek Behún
2020-07-03 13:08   ` Ondřej Jirman
2020-07-08 14:55     ` Marek Behún
2020-07-04 12:59   ` Pavel Machek [this message]
2020-07-08 14:56     ` Marek Behún
2020-07-04 12:04 ` Pavel Machek
2020-07-04 12:17   ` Ondřej Jirman
2020-07-04 20:07     ` Pavel Machek
2020-07-11 10:04 ` Pavel Machek
2020-07-11 21:01   ` Ondřej Jirman
2020-07-12  7:25     ` Pavel Machek
2020-07-12 13:49       ` Ondřej Jirman
2020-07-12 19:11         ` Pavel Machek
2020-07-12 21:10           ` Marek Behun
2020-07-12 22:12           ` Ondřej Jirman
2020-07-12 22:38           ` Ondřej Jirman
2020-07-12 23:15             ` Marek Behun
2020-07-12 23:18               ` Marek Behun
2020-07-13  7:12                 ` Pavel Machek
2020-07-12 23:20               ` Ondřej Jirman
2020-07-13  1:56           ` Ondřej Jirman
2020-07-15 17:07   ` Marek Behún
2020-07-15 17:55     ` Marek Behún

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=20200704125900.GA20503@amd \
    --to=pavel@ucw.cz \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=megous@megous.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox