ARM: dts: rockchip: rename and label gpio-led subnodes
authorJohan Jonker <jbx6244@gmail.com>
Tue, 28 Apr 2020 14:49:32 +0000 (16:49 +0200)
committerHeiko Stuebner <heiko@sntech.de>
Mon, 18 May 2020 22:26:03 +0000 (00:26 +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/arm/boot/dts/rk3188-radxarock.dt.yaml: gpio-leds:
'blue', 'green', 'sleep'
do 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=arm 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-1-jbx6244@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
arch/arm/boot/dts/rk3036-kylin.dts
arch/arm/boot/dts/rk3066a-mk808.dts
arch/arm/boot/dts/rk3188-radxarock.dts
arch/arm/boot/dts/rk3229-xms6.dts
arch/arm/boot/dts/rk3288-firefly-reload.dts
arch/arm/boot/dts/rk3288-firefly.dtsi
arch/arm/boot/dts/rk3288-miqi.dts
arch/arm/boot/dts/rk3288-phycore-som.dtsi
arch/arm/boot/dts/rk3288-rock2-square.dts
arch/arm/boot/dts/rk3288-tinker.dtsi

index 2ff9f15..7154b82 100644 (file)
@@ -16,7 +16,7 @@
        leds: gpio-leds {
                compatible = "gpio-leds";
 
-               work {
+               work_led: led-0 {
                        gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
                        label = "kylin:red:led";
                        pinctrl-names = "default";
index 365eff6..eed9e60 100644 (file)
@@ -22,7 +22,7 @@
        gpio-leds {
                compatible = "gpio-leds";
 
-               blue {
+               blue_led: led-0 {
                        label = "mk808:blue:power";
                        gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
index c9a7f54..b0fef82 100644 (file)
        gpio-leds {
                compatible = "gpio-leds";
 
-               green {
+               green_led: led-0 {
                        label = "rock:green:user1";
                        gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_LOW>;
                        default-state = "off";
                };
 
-               blue {
+               blue_led: led-1 {
                        label = "rock:blue:user2";
                        gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
                        default-state = "off";
                };
 
-               sleep {
+               sleep_led: led-2 {
                        label = "rock:red:power";
                        gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
index 679fc2b..9252a73 100644 (file)
@@ -33,7 +33,7 @@
        power-led {
                compatible = "gpio-leds";
 
-               blue {
+               blue_led: led-0 {
                        gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                };
index 8c38bda..9a4a974 100644 (file)
        leds {
                compatible = "gpio-leds";
 
-               power {
+               power_led: led-0 {
                        gpios = <&gpio8 RK_PA2 GPIO_ACTIVE_LOW>;
                        label = "firefly:blue:power";
                        pinctrl-names = "default";
-                       pinctrl-0 = <&power_led>;
+                       pinctrl-0 = <&power_led_pin>;
                        panic-indicator;
                };
 
-               work {
+               work_led: led-1 {
                        gpios = <&gpio8 RK_PA1 GPIO_ACTIVE_LOW>;
                        label = "firefly:blue:user";
                        linux,default-trigger = "rc-feedback";
                        pinctrl-names = "default";
-                       pinctrl-0 = <&work_led>;
+                       pinctrl-0 = <&work_led_pin>;
                };
        };
 
        };
 
        leds {
-               power_led: power-led {
+               power_led_pin: power-led-pin {
                        rockchip,pins = <8 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               work_led: work-led {
+               work_led_pin: work-led-pin {
                        rockchip,pins = <8 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index 5e0a190..e5c4fd4 100644 (file)
        leds {
                compatible = "gpio-leds";
 
-               work {
+               work_led: led-0 {
                        gpios = <&gpio8 RK_PA1 GPIO_ACTIVE_LOW>;
                        label = "firefly:blue:user";
                        linux,default-trigger = "rc-feedback";
                        pinctrl-names = "default";
-                       pinctrl-0 = <&work_led>;
+                       pinctrl-0 = <&work_led_pin>;
                };
 
-               power {
+               power_led: led-1 {
                        gpios = <&gpio8 RK_PA2 GPIO_ACTIVE_LOW>;
                        label = "firefly:green:power";
                        linux,default-trigger = "default-on";
                        pinctrl-names = "default";
-                       pinctrl-0 = <&power_led>;
+                       pinctrl-0 = <&power_led_pin>;
                };
        };
 
        };
 
        leds {
-               power_led: power-led {
+               power_led_pin: power-led-pin {
                        rockchip,pins = <8 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               work_led: work-led {
+               work_led_pin: work-led-pin {
                        rockchip,pins = <8 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index c41d012..213c9eb 100644 (file)
@@ -30,7 +30,7 @@
        leds {
                compatible = "gpio-leds";
 
-               work {
+               work_led: led-0 {
                        gpios = <&gpio7 RK_PA2 GPIO_ACTIVE_HIGH>;
                        label = "miqi:green:user";
                        linux,default-trigger = "timer";
index 77a47b9..e43887c 100644 (file)
@@ -36,9 +36,9 @@
        leds: user-leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&user_led>;
+               pinctrl-0 = <&user_led_pin>;
 
-               user {
+               user_led: led-0 {
                        label = "green_led";
                        gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
        };
 
        leds {
-               user_led: user-led {
+               user_led_pin: user-led-pin {
                        rockchip,pins = <7 RK_PA2 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
index cdcdc92..3cca4d0 100644 (file)
        gpio-leds {
                compatible = "gpio-leds";
 
-               heartbeat {
+               heartbeat_led: led-0 {
                        gpios = <&gpio7 RK_PB7 GPIO_ACTIVE_LOW>;
                        label = "rock2:green:state1";
                        linux,default-trigger = "heartbeat";
                };
 
-               mmc {
+               mmc_led: led-1 {
                        gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_LOW>;
                        label = "rock2:blue:state2";
                        linux,default-trigger = "mmc0";
index acfaa12..90e9be4 100644 (file)
        gpio-leds {
                compatible = "gpio-leds";
 
-               act-led {
+               act_led: led-0 {
                        gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "mmc0";
                };
 
-               heartbeat-led {
+               heartbeat_led: led-1 {
                        gpios = <&gpio1 RK_PD1 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                };
 
-               pwr-led {
+               pwr_led: led-2 {
                        gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "default-on";
                };