From: "Marek Behún" <kabel@kernel.org>
To: linux-leds@vger.kernel.org
Cc: netdev@vger.kernel.org, "Pavel Machek" <pavel@ucw.cz>,
"Dan Murphy" <dmurphy@ti.com>,
"Russell King" <linux@armlinux.org.uk>,
"Andrew Lunn" <andrew@lunn.ch>,
"Matthias Schiffer" <matthias.schiffer@ew.tq-group.com>,
"Jacek Anaszewski" <jacek.anaszewski@gmail.com>,
"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
"Marek Behún" <kabel@kernel.org>
Subject: [PATCH leds v2 00/10] Add support for offloading netdev trigger to HW + example implementation for Turris Omnia
Date: Tue, 1 Jun 2021 02:51:45 +0200 [thread overview]
Message-ID: <20210601005155.27997-1-kabel@kernel.org> (raw)
Hello,
this is v2 of series adding support for offloading LED triggers to HW.
The netdev trigger is the first user and leds-turris-omnia is the first
example implementation.
A video comparing SW (left LED) vs HW (right LED) netdev trigger on
Omnia
https://secure.nic.cz/files/mbehun/omnia-wan-netdev-trig-offload.mp4
Changes since v1:
- changed typo in doc
- the netdev trigger data structure now lives in
include/linux/ledtrig-netdev.h instead of ledtrig.h, as suggested by
Andrew. Also the structure is always defined, no guard against
CONFIG_LEDS_TRIGGER_NETDEV
- we do not export netdev_led_trigger variable. The trigger_offload()
method can look at led_cdev->trigger->name to see which trigger it
should try to offload, i.e. compare the string to "netdev"
- netdev trigger is being offloaded only if link is up, and at least one
of the rx, tx parameters are set. No need to offload otherwise
- a patch is added that moves setting flag LED_UNREGISTERING in
led_classdev_unregister() before unsetting trigger. This makes it
possible for the trigger_offload() method to determine whether the
offloading is being disabled because the LED is being unregistered.
The driver may put the LED into HW triggering mode in this case, to
achieve behaviour as was before the driver was loaded
- an example implementation for offloading the netdev trigger for the
WAN LED on Turris Omnia is added. LAN LEDs are not yet supported
Changes since RFC:
- split the patch adding HW offloading support to netdev trigger into
several separate patches (suggested by Pavel):
1. move trigger data structure to include/linux/ledtrig.h
2. support HW offloading
3. change spinlock to mutex
- fixed bug where the .offloaded variable was not set to false when
offloading was disabled (suggested by Pavel)
- removed the code saving one call to set_baseline_state() on the
NETDEV_CHANGE event. It is not needed, the trigger_offload() method
can handle this situation on its own (suggested by Pavel)
- documentation now explicitly says that when offloading is being
disabled, the function must return 0 (no error) (suggested by Pavel)
Marek Behún (10):
leds: trigger: netdev: don't explicitly zero kzalloced data
leds: trigger: add API for HW offloading of triggers
leds: trigger: netdev: move trigger data structure to global include
dir
leds: trigger: netdev: support HW offloading
leds: trigger: netdev: change spinlock to mutex
leds: core: inform trigger that it's deactivation is due to LED
removal
leds: turris-omnia: refactor sw mode setting code into separate
function
leds: turris-omnia: refactor brightness setting function
leds: turris-omnia: initialize each multicolor LED to white color
leds: turris-omnia: support offloading netdev trigger for WAN LED
Documentation/leds/leds-class.rst | 22 ++
drivers/leds/Kconfig | 3 +
drivers/leds/led-class.c | 4 +-
drivers/leds/led-triggers.c | 1 +
drivers/leds/leds-turris-omnia.c | 284 ++++++++++++++++++++++++--
drivers/leds/trigger/ledtrig-netdev.c | 56 ++---
include/linux/leds.h | 29 +++
include/linux/ledtrig-netdev.h | 34 +++
8 files changed, 377 insertions(+), 56 deletions(-)
create mode 100644 include/linux/ledtrig-netdev.h
--
2.26.3
next reply other threads:[~2021-06-01 0:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 0:51 Marek Behún [this message]
2021-06-01 0:51 ` [PATCH leds v2 01/10] leds: trigger: netdev: don't explicitly zero kzalloced data Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 02/10] leds: trigger: add API for HW offloading of triggers Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 03/10] leds: trigger: netdev: move trigger data structure to global include dir Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 04/10] leds: trigger: netdev: support HW offloading Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 05/10] leds: trigger: netdev: change spinlock to mutex Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 06/10] leds: core: inform trigger that it's deactivation is due to LED removal Marek Behún
2021-06-01 21:12 ` Andrew Lunn
2021-06-02 12:44 ` Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 07/10] leds: turris-omnia: refactor sw mode setting code into separate function Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 08/10] leds: turris-omnia: refactor brightness setting function Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 09/10] leds: turris-omnia: initialize each multicolor LED to white color Marek Behún
2021-06-01 0:51 ` [PATCH leds v2 10/10] leds: turris-omnia: support offloading netdev trigger for WAN LED Marek Behún
2021-06-01 1:44 ` Marek Behún
2021-06-01 21:19 ` Andrew Lunn
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=20210601005155.27997-1-kabel@kernel.org \
--to=kabel@kernel.org \
--cc=andrew@lunn.ch \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-leds@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.schiffer@ew.tq-group.com \
--cc=mchehab+huawei@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pavel@ucw.cz \
/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).