aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2023-06-04 04:26:59 +0200
committerDaniel Golle <daniel@makrotopia.org>2023-09-04 23:00:34 +0100
commitcf08db988baca64b878f1887d13e2fb79a708d8c (patch)
treeb0e70dfa0d51212b0ddc011383431d97138a5fe4 /target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch
parente685162a78c07d373bd7b621a716465970680bae (diff)
downloadupstream-cf08db988baca64b878f1887d13e2fb79a708d8c.tar.gz
upstream-cf08db988baca64b878f1887d13e2fb79a708d8c.tar.bz2
upstream-cf08db988baca64b878f1887d13e2fb79a708d8c.zip
generic: backport initial LEDs hw control support
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 0a4b309f41062ef40706162ae53b6428982a0685)
Diffstat (limited to 'target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch')
-rw-r--r--target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch b/target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch
new file mode 100644
index 0000000000..09759bc623
--- /dev/null
+++ b/target/linux/generic/backport-5.15/818-v6.5-06-leds-trigger-netdev-add-basic-check-for-hw-control-s.patch
@@ -0,0 +1,42 @@
+From 6352f25f9fadba59d5df2ba7139495759ccc81d5 Mon Sep 17 00:00:00 2001
+From: Christian Marangi <ansuelsmth@gmail.com>
+Date: Mon, 29 May 2023 18:32:36 +0200
+Subject: [PATCH 06/13] leds: trigger: netdev: add basic check for hw control
+ support
+
+Add basic check for hw control support. Check if the required API are
+defined and check if the defined trigger supported in hw control for the
+LED driver match netdev.
+
+Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/leds/trigger/ledtrig-netdev.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/drivers/leds/trigger/ledtrig-netdev.c
++++ b/drivers/leds/trigger/ledtrig-netdev.c
+@@ -92,8 +92,22 @@ static void set_baseline_state(struct le
+ }
+ }
+
++static bool supports_hw_control(struct led_classdev *led_cdev)
++{
++ if (!led_cdev->hw_control_get || !led_cdev->hw_control_set ||
++ !led_cdev->hw_control_is_supported)
++ return false;
++
++ return !strcmp(led_cdev->hw_control_trigger, led_cdev->trigger->name);
++}
++
+ static bool can_hw_control(struct led_netdev_data *trigger_data)
+ {
++ struct led_classdev *led_cdev = trigger_data->led_cdev;
++
++ if (!supports_hw_control(led_cdev))
++ return false;
++
+ return false;
+ }
+