From 5c1c823c4ae2a3283b8e5ec0b68c4774456507f2 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 16 Mar 2024 15:28:31 +0900 Subject: [PATCH] qualcommax: ipq807x: fix LEDs on QNAP QHora-301W 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 ":" (ex.: "amber:"/"green:"/"red:") will be appeared as LED names and renamed to ":_" ("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 --- .../arch/arm64/boot/dts/qcom/ipq8072-301w.dts | 28 +++++++++++++++++++ .../ipq807x/base-files/etc/board.d/01_leds | 12 ++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index 081e932b5c..2fe723591e 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts @@ -63,81 +63,109 @@ led_system_green: led-system-green { gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_STATUS; }; led_system_red: led-system-red { gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_STATUS; }; led_pwr_green: led-pwr-green { gpios = <&tlmm 4 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_POWER; }; led-wifi-green { gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_WLAN; }; led-lan4-green { gpios = <&tlmm 6 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <4>; }; led-lan4-amber { gpios = <&tlmm 7 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <4>; }; led-lan3-green { gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; }; led-lan3-amber { gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; }; led-lan2-green { gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; }; led-lan2-amber { gpios = <&tlmm 13 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; }; led-lan1-green { gpios = <&tlmm 14 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; }; led-lan1-amber { gpios = <&tlmm 15 GPIO_ACTIVE_HIGH>; color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; }; led-10g-1-green { gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; color = ; + function = "10g"; + function-enumerator = <1>; }; led-10g-1-amber { gpios = <&tlmm 56 GPIO_ACTIVE_HIGH>; color = ; + function = "10g"; + function-enumerator = <1>; }; led-10g-2-green { gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>; color = ; + function = "10g"; + function-enumerator = <2>; }; led-10g-2-amber { gpios = <&tlmm 52 GPIO_ACTIVE_HIGH>; color = ; + function = "10g"; + function-enumerator = <2>; }; }; }; diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds index d6f5db7093..737c64fcec 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds @@ -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" -- 2.30.2