arm64: dts: rockchip: rename and label gpio-led subnodes
authorJohan Jonker <jbx6244@gmail.com>
Tue, 28 Apr 2020 14:49:33 +0000 (16:49 +0200)
committerHeiko Stuebner <heiko@sntech.de>
Mon, 18 May 2020 22:15:56 +0000 (00:15 +0200)
Current dts files with 'gpio-led' nodes were manually verified.
In order to automate this process leds-gpio.txt
has been converted to yaml. With this conversion a check
for pattern properties was added. A test with the command
below gives a screen full of warnings like:

arch/arm64/boot/dts/rockchip/rk3368-r88.dt.yaml: gpio-leds:
'work' does not match any of the regexes:
'(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+'

Fix these errors with help of the following rules:

1: Add nodename in the preferred form.

2: Always add a label that ends with '_led' to prevent conflicts
   with other labels such as 'power' and 'mmc'

3: If leds need pinctrl add a label that ends with '_led_pin'
   also to prevent conflicts with other labels.

patternProperties:
  # The first form is preferred, but fall back to just 'led'
  # anywhere in the node name to at least catch some child nodes.
  "(^led-[0-9a-f]$|led)":

make ARCH=arm64 dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/leds/
leds-gpio.yaml

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Link: https://lore.kernel.org/r/20200428144933.10953-2-jbx6244@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
12 files changed:
arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
arch/arm64/boot/dts/rockchip/rk3368-geekbox.dts
arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts
arch/arm64/boot/dts/rockchip/rk3368-r88.dts
arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts
arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
arch/arm64/boot/dts/rockchip/rk3399-rock960.dts

index 8011e9b..ccb2702 100644 (file)
        leds {
                compatible = "gpio-leds";
 
-               power {
+               power_led: led-0 {
                        label = "firefly:red:power";
                        linux,default-trigger = "ir-power-click";
                        default-state = "on";
                        gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
                };
 
-               user {
+               user_led: led-1 {
                        label = "firefly:blue:user";
                        linux,default-trigger = "ir-user-click";
                        default-state = "off";
index bd54a37..46826b6 100644 (file)
        leds: gpio-leds {
                compatible = "gpio-leds";
                pinctrl-names = "led_pins";
-               pinctrl-0 = <&led_pins>;
+               pinctrl-0 = <&blue_led_pin>;
 
-               led-0 {
+               blue_led: led-0 {
                        label = "blue:heartbeat";
                        gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
        };
 
        leds {
-               led_pins: led-pins {
+               blue_led_pin: blue-led-pin {
                        rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index 8d553c9..34db48c 100644 (file)
@@ -86,7 +86,7 @@
        leds {
                compatible = "gpio-leds";
 
-               power {
+               power_led: led-0 {
                        label = "firefly:blue:power";
                        linux,default-trigger = "heartbeat";
                        gpios = <&rk805 1 GPIO_ACTIVE_LOW>;
@@ -94,7 +94,7 @@
                        mode = <0x23>;
                };
 
-               user {
+               user_led: led-1 {
                        label = "firefly:yellow:user";
                        linux,default-trigger = "mmc1";
                        gpios = <&rk805 0 GPIO_ACTIVE_LOW>;
index bf3e546..0e45378 100644 (file)
        leds {
                compatible = "gpio-leds";
 
-               power {
+               power_led: led-0 {
                        gpios = <&rk805 1 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "mmc0";
                };
 
-               standby {
+               standby_led: led-1 {
                        gpios = <&rk805 0 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "heartbeat";
                };
index 1d0778f..46357d1 100644 (file)
        leds: gpio-leds {
                compatible = "gpio-leds";
 
-               blue {
+               blue_led: led-0 {
                        gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>;
                        label = "geekbox:blue:led";
                        default-state = "on";
                };
 
-               red {
+               red_led: led-1 {
                        gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_HIGH>;
                        label = "geekbox:red:led";
                        default-state = "off";
index 6cc3102..b058ce9 100644 (file)
@@ -50,7 +50,7 @@
        leds: gpio-leds {
                compatible = "gpio-leds";
 
-               red {
+               red_led: led-0 {
                        gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
                        label = "orion:red:led";
                        pinctrl-names = "default";
@@ -58,7 +58,7 @@
                        default-state = "on";
                };
 
-               blue {
+               blue_led: led-1 {
                        gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
                        label = "orion:blue:led";
                        pinctrl-names = "default";
index 006a1fb..236ab0f 100644 (file)
@@ -43,7 +43,7 @@
        leds: gpio-leds {
                compatible = "gpio-leds";
 
-               work {
+               work_led: led-0 {
                        gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
                        label = "r88:green:led";
                        pinctrl-names = "default";
index ebe2ee7..1ce85a5 100644 (file)
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&user_led1>, <&user_led2>, <&user_led3>,
-                           <&user_led4>, <&wlan_led>, <&bt_led>;
+               pinctrl-0 = <&user_led1_pin>, <&user_led2_pin>,
+                           <&user_led3_pin>, <&user_led4_pin>,
+                           <&wlan_led_pin>, <&bt_led_pin>;
 
-               user_led1 {
+               user_led1: led-1 {
                        label = "red:user1";
                        gpios = <&gpio4 25 0>;
                        linux,default-trigger = "heartbeat";
                };
 
-               user_led2 {
+               user_led2: led-2 {
                        label = "red:user2";
                        gpios = <&gpio4 26 0>;
                        linux,default-trigger = "mmc0";
                };
 
-               user_led3 {
+               user_led3: led-3 {
                        label = "red:user3";
                        gpios = <&gpio4 30 0>;
                        linux,default-trigger = "mmc1";
                };
 
-               user_led4 {
+               user_led4: led-4 {
                        label = "red:user4";
                        gpios = <&gpio1 0 0>;
                        panic-indicator;
                        linux,default-trigger = "none";
                };
 
-               wlan_active_led {
+               wlan_active_led: led-5 {
                        label = "red:wlan";
                        gpios = <&gpio1 1 0>;
                        linux,default-trigger = "phy0tx";
                        default-state = "off";
                };
 
-               bt_active_led {
+               bt_active_led: led-6 {
                        label = "red:bt";
                        gpios = <&gpio1 4 0>;
                        linux,default-trigger = "hci0-power";
        };
 
        leds {
-               user_led1: user_led1 {
+               user_led1_pin: user-led1-pin {
                        rockchip,pins =
                                <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               user_led2: user_led2 {
+               user_led2_pin: user-led2-pin {
                        rockchip,pins =
                                <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               user_led3: user_led3 {
+               user_led3_pin: user-led3-pin {
                        rockchip,pins =
                                <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               user_led4: user_led4 {
+               user_led4_pin: user-led4-pin {
                        rockchip,pins =
                                <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               wlan_led: wlan_led {
+               wlan_led_pin: wlan-led-pin {
                        rockchip,pins =
                                <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               bt_led: bt_led {
+               bt_led_pin: bt-led-pin {
                        rockchip,pins =
                                <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
index d63faf3..20b5599 100644 (file)
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>;
+               pinctrl-0 = <&work_led_pin>, <&diy_led_pin>;
 
-               work-led {
+               work_led: led-0 {
                        label = "work";
                        default-state = "on";
                        gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
                };
 
-               diy-led {
+               diy_led: led-1 {
                        label = "diy";
                        default-state = "off";
                        gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
        };
 
        leds {
-               work_led_gpio: work_led-gpio {
+               work_led_pin: work-led-pin {
                        rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               diy_led_gpio: diy_led-gpio {
+               diy_led_pin: diy-led-pin {
                        rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index 4b4a38e..bf87fa3 100644 (file)
@@ -39,9 +39,9 @@
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&power_led_gpio>;
+               pinctrl-0 = <&power_led_pin>;
 
-               led-0 {
+               power_led: led-0 {
                        label = "blue:power";
                        gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
        };
 
        leds {
-               power_led_gpio: power-led-gpio {
+               power_led_pin: power-led-pin {
                        rockchip,pins = <4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index b200628..a44c837 100644 (file)
@@ -90,9 +90,9 @@
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&pwrled_gpio &slpled_gpio>;
+               pinctrl-0 = <&pwr_led_pin &slp_led_pin>;
 
-               green-led {
+               green_led: led-0 {
                        color = <LED_COLOR_ID_GREEN>;
                        default-state = "on";
                        function = LED_FUNCTION_POWER;
                        label = "green:power";
                };
 
-               red-led {
+               red_led: led-1 {
                        color = <LED_COLOR_ID_RED>;
                        default-state = "off";
                        function = LED_FUNCTION_STANDBY;
        };
 
        leds {
-               pwrled_gpio: pwrled_gpio {
+               pwr_led_pin: pwr-led-pin {
                        rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               slpled_gpio: slpled_gpio {
+               slp_led_pin: slp-led-pin {
                        rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index 437a75f..c882957 100644 (file)
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&user_led1>, <&user_led2>, <&user_led3>,
-                           <&user_led4>, <&wlan_led>, <&bt_led>;
+               pinctrl-0 = <&user_led1_pin>, <&user_led2_pin>,
+                           <&user_led3_pin>, <&user_led4_pin>,
+                           <&wlan_led_pin>, <&bt_led_pin>;
 
-               user_led1 {
+               user_led1: led-1 {
                        label = "green:user1";
                        gpios = <&gpio4 RK_PC2 0>;
                        linux,default-trigger = "heartbeat";
                };
 
-               user_led2 {
+               user_led2: led-2 {
                        label = "green:user2";
                        gpios = <&gpio4 RK_PC6 0>;
                        linux,default-trigger = "mmc0";
                };
 
-               user_led3 {
+               user_led3: led-3 {
                        label = "green:user3";
                        gpios = <&gpio4 RK_PD0 0>;
                        linux,default-trigger = "mmc1";
                };
 
-               user_led4 {
+               user_led4: led-4 {
                        label = "green:user4";
                        gpios = <&gpio4 RK_PD4 0>;
                        panic-indicator;
                        linux,default-trigger = "none";
                };
 
-               wlan_active_led {
+               wlan_active_led: led-5 {
                        label = "yellow:wlan";
                        gpios = <&gpio4 RK_PD5 0>;
                        linux,default-trigger = "phy0tx";
                        default-state = "off";
                };
 
-               bt_active_led {
+               bt_active_led: led-6 {
                        label = "blue:bt";
                        gpios = <&gpio4 RK_PD6 0>;
                        linux,default-trigger = "hci0-power";
 
 &pinctrl {
        leds {
-               user_led1: user_led1 {
+               user_led1_pin: user-led1-pin {
                        rockchip,pins =
                                <4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               user_led2: user_led2 {
+               user_led2_pin: user-led2-pin {
                        rockchip,pins =
                                <4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               user_led3: user_led3 {
+               user_led3_pin: user-led3-pin {
                        rockchip,pins =
                                <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               user_led4: user_led4 {
+               user_led4_pin: user-led4-pin {
                        rockchip,pins =
                                <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               wlan_led: wlan_led {
+               wlan_led_pin: wlan-led-pin {
                        rockchip,pins =
                                <4 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               bt_led: bt_led {
+               bt_led_pin: bt-led-pin {
                        rockchip,pins =
                                <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
                };