Browse Source

mvebu: fix LEDs on Fortinet FortiGate devices

On Fortinet FortiGate 30E/50E, some multiple LEDs have no "function"
property and only "color" property is available for the new binding of
LED on Linux Kernel.
9d93b6d091 ("mvebu: drop redundant label with new LED color/function
format") removes "label" property from LEDs, then, multiple "<color>:"
(ex.: "green:"/"red:"/"amber:") will be appeared as LED names and
renamed to "<color>:_<num>" (ex.: "green:_1", "green:_2", ...) by
kernel.

log:

[   12.425170] leds-gpio gpio-leds: Led green: renamed to green:_1 due to name collision
[   12.520390] leds-gpio gpio-leds: Led amber: renamed to amber:_1 due to name collision
[   12.614931] leds-gpio gpio-leds: Led green: renamed to green:_2 due to name collision
[   12.709895] leds-gpio gpio-leds: Led green: renamed to green:_3 due to name collision
[   12.804439] leds-gpio gpio-leds: Led amber: renamed to amber:_2 due to name collision
[   12.898969] leds-gpio gpio-leds: Led green: renamed to green:_4 due to name collision
[   12.993504] leds-gpio gpio-leds: Led amber: renamed to amber:_3 due to name collision
[   13.088033] leds-gpio gpio-leds: Led green: renamed to green:_5 due to name collision
[   13.182570] leds-gpio gpio-leds: Led green: renamed to green:_6 due to name collision
[   13.277103] leds-gpio gpio-leds: Led amber: renamed to amber:_4 due to name collision
[   13.371636] leds-gpio gpio-leds: Led green: renamed to green:_7 due to name collision

/sys/class/leds:

root@OpenWrt:/# ls /sys/class/leds/
amber:        amber:_4      green:_2      green:_6      red:alarm
amber:_1      amber:alarm   green:_3      green:_7      red:status
amber:_2      green:        green:_4      green:status
amber:_3      green:_1      green:_5      red:

Fix this issue by adding missing "function" (and "function-enumerator")
property those to LEDs on Fortinet FortiGate devices.
Note: there is no appropriate function for "ha" LEDs in
dt-bindings/leds/common.h, so use the hardcoded string for them instead.

Fixes: 9d93b6d091 ("mvebu: drop redundant label with new LED color/function format")
Signed-off-by: INAGAKI Hiroshi <[email protected]>
INAGAKI Hiroshi 2 years ago
parent
commit
5038ec5bba

+ 2 - 0
target/linux/mvebu/files-6.1/arch/arm/boot/dts/armada-385-fortinet-fg-30e.dts

@@ -16,12 +16,14 @@
 	led-14 {
 	led-14 {
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_AMBER>;
 		color = <LED_COLOR_ID_AMBER>;
+		function = LED_FUNCTION_SPEED_WAN;
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 	};
 	};
 
 
 	led-15 {
 	led-15 {
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_WAN;
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 	};
 	};
 };
 };

+ 8 - 0
target/linux/mvebu/files-6.1/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts

@@ -16,24 +16,32 @@
 	led-14 {
 	led-14 {
 		gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_WAN;
+		function-enumerator = <1>;
 		linux,default-trigger = "f1072004.mdio-mii:00:1Gbps";
 		linux,default-trigger = "f1072004.mdio-mii:00:1Gbps";
 	};
 	};
 
 
 	led-15 {
 	led-15 {
 		gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_WAN;
+		function-enumerator = <2>;
 		linux,default-trigger = "f1072004.mdio-mii:01:1Gbps";
 		linux,default-trigger = "f1072004.mdio-mii:01:1Gbps";
 	};
 	};
 
 
 	led-16 {
 	led-16 {
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_AMBER>;
 		color = <LED_COLOR_ID_AMBER>;
+		function = LED_FUNCTION_SPEED_LAN;
+		function-enumerator = <5>;
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 	};
 	};
 
 
 	led-17 {
 	led-17 {
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_LAN;
+		function-enumerator = <5>;
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 	};
 	};
 };
 };

+ 18 - 0
target/linux/mvebu/files-6.1/arch/arm/boot/dts/armada-385-fortinet-fg-x0e.dtsi

@@ -54,6 +54,7 @@
 		led-1 {
 		led-1 {
 			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_RED>;
 			color = <LED_COLOR_ID_RED>;
+			function = "ha";
 		};
 		};
 
 
 		led_status_green: led-2 {
 		led_status_green: led-2 {
@@ -65,6 +66,7 @@
 		led-3 {
 		led-3 {
 			gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = "ha";
 		};
 		};
 
 
 		led-4 {
 		led-4 {
@@ -82,48 +84,64 @@
 		led-6 {
 		led-6 {
 			gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <4>;
 			linux,default-trigger = "mv88e6xxx-1:01:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:01:1Gbps";
 		};
 		};
 
 
 		led-7 {
 		led-7 {
 			gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <4>;
 			linux,default-trigger = "mv88e6xxx-1:01:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:01:100Mbps";
 		};
 		};
 
 
 		led-8 {
 		led-8 {
 			gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <3>;
 			linux,default-trigger = "mv88e6xxx-1:02:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:02:100Mbps";
 		};
 		};
 
 
 		led-9 {
 		led-9 {
 			gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <3>;
 			linux,default-trigger = "mv88e6xxx-1:02:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:02:1Gbps";
 		};
 		};
 
 
 		led-10 {
 		led-10 {
 			gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <1>;
 			linux,default-trigger = "mv88e6xxx-1:04:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:04:1Gbps";
 		};
 		};
 
 
 		led-11 {
 		led-11 {
 			gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <1>;
 			linux,default-trigger = "mv88e6xxx-1:04:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:04:100Mbps";
 		};
 		};
 
 
 		led-12 {
 		led-12 {
 			gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <2>;
 			linux,default-trigger = "mv88e6xxx-1:03:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:03:1Gbps";
 		};
 		};
 
 
 		led-13 {
 		led-13 {
 			gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <2>;
 			linux,default-trigger = "mv88e6xxx-1:03:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:03:100Mbps";
 		};
 		};
 	};
 	};

+ 2 - 0
target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-fortinet-fg-30e.dts

@@ -16,12 +16,14 @@
 	led-14 {
 	led-14 {
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_AMBER>;
 		color = <LED_COLOR_ID_AMBER>;
+		function = LED_FUNCTION_SPEED_WAN;
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 	};
 	};
 
 
 	led-15 {
 	led-15 {
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_WAN;
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 	};
 	};
 };
 };

+ 8 - 0
target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-fortinet-fg-50e.dts

@@ -16,24 +16,32 @@
 	led-14 {
 	led-14 {
 		gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_WAN;
+		function-enumerator = <1>;
 		linux,default-trigger = "f1072004.mdio-mii:00:1Gbps";
 		linux,default-trigger = "f1072004.mdio-mii:00:1Gbps";
 	};
 	};
 
 
 	led-15 {
 	led-15 {
 		gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_WAN;
+		function-enumerator = <2>;
 		linux,default-trigger = "f1072004.mdio-mii:01:1Gbps";
 		linux,default-trigger = "f1072004.mdio-mii:01:1Gbps";
 	};
 	};
 
 
 	led-16 {
 	led-16 {
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_AMBER>;
 		color = <LED_COLOR_ID_AMBER>;
+		function = LED_FUNCTION_SPEED_LAN;
+		function-enumerator = <5>;
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 		linux,default-trigger = "mv88e6xxx-1:00:100Mbps";
 	};
 	};
 
 
 	led-17 {
 	led-17 {
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
 		color = <LED_COLOR_ID_GREEN>;
 		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_SPEED_LAN;
+		function-enumerator = <5>;
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 		linux,default-trigger = "mv88e6xxx-1:00:1Gbps";
 	};
 	};
 };
 };

+ 18 - 0
target/linux/mvebu/files-6.6/arch/arm/boot/dts/marvell/armada-385-fortinet-fg-x0e.dtsi

@@ -54,6 +54,7 @@
 		led-1 {
 		led-1 {
 			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_RED>;
 			color = <LED_COLOR_ID_RED>;
+			function = "ha";
 		};
 		};
 
 
 		led_status_green: led-2 {
 		led_status_green: led-2 {
@@ -65,6 +66,7 @@
 		led-3 {
 		led-3 {
 			gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = "ha";
 		};
 		};
 
 
 		led-4 {
 		led-4 {
@@ -82,48 +84,64 @@
 		led-6 {
 		led-6 {
 			gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <4>;
 			linux,default-trigger = "mv88e6xxx-1:01:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:01:1Gbps";
 		};
 		};
 
 
 		led-7 {
 		led-7 {
 			gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <4>;
 			linux,default-trigger = "mv88e6xxx-1:01:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:01:100Mbps";
 		};
 		};
 
 
 		led-8 {
 		led-8 {
 			gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <3>;
 			linux,default-trigger = "mv88e6xxx-1:02:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:02:100Mbps";
 		};
 		};
 
 
 		led-9 {
 		led-9 {
 			gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <3>;
 			linux,default-trigger = "mv88e6xxx-1:02:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:02:1Gbps";
 		};
 		};
 
 
 		led-10 {
 		led-10 {
 			gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <1>;
 			linux,default-trigger = "mv88e6xxx-1:04:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:04:1Gbps";
 		};
 		};
 
 
 		led-11 {
 		led-11 {
 			gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <1>;
 			linux,default-trigger = "mv88e6xxx-1:04:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:04:100Mbps";
 		};
 		};
 
 
 		led-12 {
 		led-12 {
 			gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_GREEN>;
 			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <2>;
 			linux,default-trigger = "mv88e6xxx-1:03:1Gbps";
 			linux,default-trigger = "mv88e6xxx-1:03:1Gbps";
 		};
 		};
 
 
 		led-13 {
 		led-13 {
 			gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
 			gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
 			color = <LED_COLOR_ID_AMBER>;
 			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_SPEED_LAN;
+			function-enumerator = <2>;
 			linux,default-trigger = "mv88e6xxx-1:03:100Mbps";
 			linux,default-trigger = "mv88e6xxx-1:03:100Mbps";
 		};
 		};
 	};
 	};