mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-28 17:48:58 +00:00
cf08db988b
Backport initial LEDs hw control support. Currently this is limited to
only rx/tx and link events for the netdev trigger but the API got
accepted and the additional modes are working on and will be backported
later.
Refresh every patch and add the additional config flag for QCA8K new
LEDs support.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 0a4b309f41
)
38 lines
1.4 KiB
Diff
38 lines
1.4 KiB
Diff
From 052c38eb17e866c5b4cd43924e7a5e20167b55c0 Mon Sep 17 00:00:00 2001
|
|
From: Andrew Lunn <andrew@lunn.ch>
|
|
Date: Mon, 29 May 2023 18:32:32 +0200
|
|
Subject: [PATCH 02/13] leds: add API to get attached device for LED hw control
|
|
|
|
Some specific LED triggers blink the LED based on events from a device
|
|
or subsystem.
|
|
For example, an LED could be blinked to indicate a network device is
|
|
receiving packets, or a disk is reading blocks. To correctly enable and
|
|
request the hw control of the LED, the trigger has to check if the
|
|
network interface or block device configured via a /sys/class/led file
|
|
match the one the LED driver provide for hw control for.
|
|
|
|
Provide an API call to get the device which the LED blinks for.
|
|
|
|
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
include/linux/leds.h | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
--- a/include/linux/leds.h
|
|
+++ b/include/linux/leds.h
|
|
@@ -201,6 +201,12 @@ struct led_classdev {
|
|
*/
|
|
int (*hw_control_get)(struct led_classdev *led_cdev,
|
|
unsigned long *flags);
|
|
+ /*
|
|
+ * Get the device this LED blinks in response to.
|
|
+ * e.g. for a PHY LED, it is the network device. If the LED is
|
|
+ * not yet associated to a device, return NULL.
|
|
+ */
|
|
+ struct device *(*hw_control_get_device)(struct led_classdev *led_cdev);
|
|
#endif
|
|
|
|
#ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED
|