arm64: dts: rockchip: rename and label gpio-led subnodes part 2
authorJohan Jonker <jbx6244@gmail.com>
Fri, 22 May 2020 15:46:57 +0000 (17:46 +0200)
committerHeiko Stuebner <heiko@sntech.de>
Wed, 17 Jun 2020 08:32:43 +0000 (10:32 +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. In part 2 rename and label
gpio-led subnodes that passed the regex, but still don't have
the preferred form. Any pin subnode that ends with '-gpio'
in the pinctrl node generates a warning.

Fix 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

make ARCH=arm64 dtbs_check
DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/dtschema/
schemas/gpio/gpio.yaml

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Link: https://lore.kernel.org/r/20200522154657.9472-1-jbx6244@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts
arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi

index dbd2cab..7fcb1ea 100644 (file)
@@ -25,9 +25,9 @@
        };
 
        leds {
-               pinctrl-0 = <&led_pins_module>, <&led_sd_haikou>;
+               pinctrl-0 = <&module_led_pins>, <&sd_card_led_pin>;
 
-               sd-card-led {
+               sd_card_led: led-3 {
                        label = "sd_card_led";
                        gpios = <&gpio0 RK_PD2 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "mmc0";
        };
 
        leds {
-               led_sd_haikou: led-sd-gpio {
+               sd_card_led_pin: sd-card-led-pin {
                        rockchip,pins =
                                <0 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
index 216aafd..24d28be 100644 (file)
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&led_pins_module>;
+               pinctrl-0 = <&module_led_pins>;
 
-               module_led1 {
+               module_led1: led-1 {
                        label = "module_led1";
                        gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                        panic-indicator;
                };
 
-               module_led2 {
+               module_led2: led-2 {
                        label = "module_led2";
                        gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
 
 &pinctrl {
        leds {
-               led_pins_module: led-module-gpio {
+               module_led_pins: module-led-pins {
                        rockchip,pins =
                                <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>,
                                <3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
index e87a044..e36837c 100644 (file)
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&sys_led_gpio>, <&user_led_gpio>;
+               pinctrl-0 = <&sys_led_pin>, <&user_led_pin>;
 
-               sys-led {
+               sys_led: led-0 {
                        label = "sys_led";
                        linux,default-trigger = "heartbeat";
                        gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
                };
 
-               user-led {
+               user_led: led-1 {
                        label = "user_led";
                        default-state = "off";
                        gpios = <&gpio4 RK_PD0 GPIO_ACTIVE_HIGH>;
        };
 
        leds {
-               sys_led_gpio: sys_led-gpio {
+               sys_led_pin: sys-led-pin {
                        rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               user_led_gpio: user_led-gpio {
+               user_led_pin: user-led-pin {
                        rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index 1d246c2..76a8b40 100644 (file)
        leds: gpio-leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&leds_gpio>;
+               pinctrl-0 = <&status_led_pin>;
 
-               status {
+               status_led: led-0 {
                        gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
                        label = "status_led";
                        linux,default-trigger = "heartbeat";
        };
 
        gpio-leds {
-               leds_gpio: leds-gpio {
+               status_led_pin: status-led-pin {
                        rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index d80d6b7..a8d3635 100644 (file)
@@ -15,9 +15,9 @@
        };
 
        leds {
-               pinctrl-0 = <&led_pin_module>, <&led_sd_haikou>;
+               pinctrl-0 = <&module_led_pin>, <&sd_card_led_pin>;
 
-               sd-card-led {
+               sd_card_led: led-1 {
                        label = "sd_card_led";
                        gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "mmc0";
        };
 
        leds {
-               led_sd_haikou: led-sd-gpio {
+               sd_card_led_pin: sd-card-led-pin {
                        rockchip,pins =
                          <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
index 72c06ab..4660416 100644 (file)
@@ -11,9 +11,9 @@
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&led_pin_module>;
+               pinctrl-0 = <&module_led_pin>;
 
-               module-led {
+               module_led: led-0 {
                        label = "module_led";
                        gpios = <&gpio2 RK_PD1 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
        };
 
        leds {
-               led_pin_module: led-module-gpio {
+               module_led_pin: module-led-pin {
                        rockchip,pins =
                          <2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
index 59b89d6..b85ec31 100644 (file)
        leds {
                compatible = "gpio-leds";
                pinctrl-names = "default";
-               pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>, <&yellow_led_gpio>;
+               pinctrl-0 = <&work_led_pin>, <&diy_led_pin>, <&yellow_led_pin>;
 
-               work-led {
+               work_led: led-0 {
                        label = "green:work";
                        gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                        linux,default-trigger = "heartbeat";
                };
 
-               diy-led {
+               diy_led: led-1 {
                        label = "red:diy";
                        gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                        linux,default-trigger = "mmc1";
                };
 
-               yellow-led {
+               yellow_led: led-2 {
                        label = "yellow:yellow-led";
                        gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
        };
 
        leds {
-               diy_led_gpio: diy_led-gpio {
+               diy_led_pin: diy-led-pin {
                        rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               work_led_gpio: work_led-gpio {
+               work_led_pin: work-led-pin {
                        rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               yellow_led_gpio: yellow_led-gpio {
+               yellow_led_pin: yellow-led-pin {
                        rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
index c84cad1..6e553ff 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 = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
                };
 
-               diy-led {
+               diy_led: led-1 {
                        label = "diy";
                        default-state = "off";
                        gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
        };
 
        leds {
-               work_led_gpio: work_led-gpio {
+               work_led_pin: work-led-pin {
                        rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
-               diy_led_gpio: diy_led-gpio {
+               diy_led_pin: diy-led-pin {
                        rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };