leds: add "network" LED trigger (lan/wan/wlan)

LED trigger for network interfaces.

 - Aggregated per-family (lan/wan/wlan).
 - Family and flags are taken from device tree properties:
   - "family" : simple family string "lan" | "wan" | "wlan"
   - "mode"   : any combination of "link", "tx", "rx" flags
  Priority/combination:
   * If "mode" present: flags come from "mode" and take precedence.
     Family is taken from "family" if present, otherwise from the LED name.
   * If only "family" present: use its family and default flags = link+tx+rx.
   * If neither present: fall back to LED device name parsing.

 - Suffix "-online" is valid ONLY in the LED name (label),
   e.g. "green:wlan-online". It indicates the online variant but is applied
   only when DT "mode" is absent.

Behaviour:
 - wlan (normal): blink/solid driven by throughput table
 - lan/wan (normal): one-shot blink on TX/RX packet change
 - *-online variants: steady ON while any interface of the family has carrier

 Interfaces are auto-tracked by name match (lan0, wan1, wlan2, phy0, wl1,
 ath0, ra0...). Up to MAX_IFACES (16) interfaces per family

This trigger is intended for board/device authors and drivers to provide simple
network-activity LED behaviour without per-interface wiring in userspace.

Refresh bcm27xx patches in the same commit to account for line shifts in
drivers/leds/trigger/Kconfig and Makefile, ensuring clean applies for
bisectability.

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/19903
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Mieczyslaw Nalewaj
2025-11-27 13:17:50 +01:00
committed by Robert Marko
parent 848c54b5f4
commit 2aa1185fb0
7 changed files with 1286 additions and 3 deletions
+16
View File
@@ -70,6 +70,22 @@ endef
$(eval $(call KernelPackage,ledtrig-gpio))
define KernelPackage/ledtrig-network
SUBMENU:=$(LEDS_MENU)
TITLE:=LED Network Trigger
KCONFIG:=CONFIG_LEDS_TRIGGER_NETWORK
FILES:=$(LED_TRIGGER_DIR)/ledtrig-network.ko
AUTOLOAD:=$(call AutoLoad,50,ledtrig-network)
endef
define KernelPackage/ledtrig-network/description
Kernel module that allows LEDs to be controlled by network interfaces
aggregated by family (lan/wan/wlan), with an optional per-LED '-online' mode.
endef
$(eval $(call KernelPackage,ledtrig-network))
define KernelPackage/ledtrig-transient
SUBMENU:=$(LEDS_MENU)
TITLE:=LED Transient Trigger