qualcommax: ipq807x: fix LEDs on QNAP QHora-301W
authorINAGAKI Hiroshi <musashino.open@gmail.com>
Sat, 16 Mar 2024 06:28:31 +0000 (15:28 +0900)
committerRobert Marko <robimarko@gmail.com>
Sun, 17 Mar 2024 16:31:02 +0000 (17:31 +0100)
On QNAP QHora-301W, all LEDs don't have "function" property and only
"color" property is available for the newer binding of LED on Linux
Kernel.
2e659930d3 ("qualcommax: drop redundant label with new LED
color/function format") removes "label" property from LEDs, then,
multiple "<color>:" (ex.: "amber:"/"green:"/"red:") will be appeared as
LED names and renamed to "<color>:_<num>" ("ex.: "green:_1", "green:_2",
...) by kernel.

logs:

[    4.246494] leds-gpio leds: Led green: renamed to green:_1 due to name collision
[    4.248978] leds-gpio leds: Led green: renamed to green:_2 due to name collision
[    4.256345] leds-gpio leds: Led green: renamed to green:_3 due to name collision
[    4.263770] leds-gpio leds: Led green: renamed to green:_4 due to name collision
[    4.271105] leds-gpio leds: Led amber: renamed to amber:_1 due to name collision
[    4.278487] leds-gpio leds: Led green: renamed to green:_5 due to name collision
[    4.285856] leds-gpio leds: Led amber: renamed to amber:_2 due to name collision
[    4.293257] leds-gpio leds: Led green: renamed to green:_6 due to name collision
[    4.300616] leds-gpio leds: Led amber: renamed to amber:_3 due to name collision
[    4.308002] leds-gpio leds: Led green: renamed to green:_7 due to name collision
[    4.315384] leds-gpio leds: Led amber: renamed to amber:_4 due to name collision
[    4.322760] leds-gpio leds: Led green: renamed to green:_8 due to name collision
[    4.330135] leds-gpio leds: Led amber: renamed to amber:_5 due to name collision

/sys/class/leds:

amber:          amber:_4        green:_2        green:_6
amber:_1        green:_5        green:_3        green:_7
amber:_2        green:          green:_4        green:_8
amber:_3        green:_1        green:_5        red:

Fix this issue by adding missing "function" (and "function-enumerator")
property to LEDs on QNAP QHora-301W.
Note: there are no appropriate functions in dt-bindings/leds/common.h
for some LEDs, so use the hardcoded strings for them instead.

Fixes: 2e659930d3 ("qualcommax: drop redundant label with new LED color/function format")
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts
target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds

index 081e932b5c7eb8c3eff5273356534cb093d2bfb1..2fe723591e77f48b28f0b63b7ed0b02909f6002e 100644 (file)
                led_system_green: led-system-green {
                        gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
                };
 
                led_system_red: led-system-red {
                        gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
                };
 
                led_pwr_green: led-pwr-green {
                        gpios = <&tlmm 4 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_POWER;
                };
 
                led-wifi-green {
                        gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WLAN;
                };
 
                led-lan4-green {
                        gpios = <&tlmm 6 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <4>;
                };
 
                led-lan4-amber {
                        gpios = <&tlmm 7 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_AMBER>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <4>;
                };
 
                led-lan3-green {
                        gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <3>;
                };
 
                led-lan3-amber {
                        gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_AMBER>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <3>;
                };
 
                led-lan2-green {
                        gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <2>;
                };
 
                led-lan2-amber {
                        gpios = <&tlmm 13 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_AMBER>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <2>;
                };
 
                led-lan1-green {
                        gpios = <&tlmm 14 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <1>;
                };
 
                led-lan1-amber {
                        gpios = <&tlmm 15 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_AMBER>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <1>;
                };
 
                led-10g-1-green {
                        gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = "10g";
+                       function-enumerator = <1>;
                };
 
                led-10g-1-amber {
                        gpios = <&tlmm 56 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_AMBER>;
+                       function = "10g";
+                       function-enumerator = <1>;
                };
 
                led-10g-2-green {
                        gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_GREEN>;
+                       function = "10g";
+                       function-enumerator = <2>;
                };
 
                led-10g-2-amber {
                        gpios = <&tlmm 52 GPIO_ACTIVE_HIGH>;
                        color = <LED_COLOR_ID_AMBER>;
+                       function = "10g";
+                       function-enumerator = <2>;
                };
        };
 };
index d6f5db7093f529a8a92f6cb6196b7f4b11b8f3e6..737c64fcecf7fc2282b8d11e67302e068d262163 100644 (file)
@@ -51,12 +51,12 @@ xiaomi,ax9000)
        ucidef_set_led_netdev "lan4-port-link" "LAN4-PORT-LINK" "90000.mdio-1:00:green:lan" "lan4" "tx rx link_10 link_100 link_1000"
        ;;
 qnap,301w)
-       ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "lan1"
-       ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "lan2"
-       ucidef_set_led_netdev "lan3" "LAN3" "green:lan3" "lan3"
-       ucidef_set_led_netdev "lan4" "LAN4" "green:lan4" "lan4"
-       ucidef_set_led_netdev "10G_1" "10G_1" "green:10g_1" "10g-1"
-       ucidef_set_led_netdev "10G_2" "10G_2" "green:10g_2" "10g-2"
+       ucidef_set_led_netdev "lan1" "LAN1" "green:lan-1" "lan1"
+       ucidef_set_led_netdev "lan2" "LAN2" "green:lan-2" "lan2"
+       ucidef_set_led_netdev "lan3" "LAN3" "green:lan-3" "lan3"
+       ucidef_set_led_netdev "lan4" "LAN4" "green:lan-4" "lan4"
+       ucidef_set_led_netdev "10G_1" "10G_1" "green:10g-1" "10g-1"
+       ucidef_set_led_netdev "10G_2" "10G_2" "green:10g-2" "10g-2"
        ;;
 yuncore,ax880)
        ucidef_set_led_netdev "wan-port-link" "WAN-PORT-LINK" "90000.mdio-1:18:green:wan" "wan" "tx rx link_10 link_100 link_1000 link_2500"