Skip to contentSkip to conversation

ARM: dts: rockchip: rename and label gpio-led subnodes part 3

PATCH In review Johan Jonker 2 participants 3 messages Aug 13, 2020 – Aug 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: dts: rockchip: rename and label gpio-led subnodes part 3

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 3 rename and label gpio-led subnodes with pinctrl. To make things equal to other dts files move pinctrl below the compatible property.

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=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/leds/ leds-gpio.yaml

---
 arch/arm/boot/dts/rk3036-kylin.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3036-kylin.dts +3 -3
index 7154b827e..bf808cda6 100644
@@ -15,12 +15,12 @@
 
 	leds: gpio-leds {
 		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&work_led_pin>;
 
 		work_led: led-0 {
 			gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
 			label = "kylin:red:led";
-			pinctrl-names = "default";
-			pinctrl-0 = <&led_ctl>;
 		};
 	};
 
@@ -367,7 +367,7 @@
 
 &pinctrl {
 	leds {
-		led_ctl: led-ctl {
+		work_led_pin: work-led-pin {
 			rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/2 arm64: dts: rockchip: rename and label gpio-led subnodes part 3

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 3 rename and label gpio-led subnodes with pinctrl. To make things equal to other dts files move pinctrl below the compatible property.

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

---
 arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts | 10 ++++------
 arch/arm64/boot/dts/rockchip/rk3368-r88.dts            |  6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts +4 -6
index b058ce999..dd6be31f1 100644
@@ -49,20 +49,18 @@
 
 	leds: gpio-leds {
 		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&red_led_pin>, <&blue_led_pin>;
 
 		red_led: led-0 {
 			gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
 			label = "orion:red:led";
-			pinctrl-names = "default";
-			pinctrl-0 = <&led_ctl>;
 			default-state = "on";
 		};
 
 		blue_led: led-1 {
 			gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
 			label = "orion:blue:led";
-			pinctrl-names = "default";
-			pinctrl-0 = <&stby_pwren>;
 			default-state = "off";
 		};
 	};
@@ -256,11 +254,11 @@
 	};
 
 	leds {
-		stby_pwren: stby-pwren {
+		blue_led_pin: blue-led-pin {
 			rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 
-		led_ctl: led-ctl {
+		red_led_pin: red-led-pin {
 			rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
arch/arm64/boot/dts/rockchip/rk3368-r88.dts +3 -3
index 236ab0f1b..e29c8d172 100644
@@ -42,12 +42,12 @@
 
 	leds: gpio-leds {
 		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&work_led_pin>;
 
 		work_led: led-0 {
 			gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
 			label = "r88:green:led";
-			pinctrl-names = "default";
-			pinctrl-0 = <&led_ctl>;
 		};
 	};
 
@@ -275,7 +275,7 @@
 			rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 
-		led_ctl: led-ctl {
+		work_led_pin: work-led-pin {
 			rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
Signature · 1 line
2.11.0
maintainer
#2 lore raw
In reply to Johan Jonker

Hi Johan,

Am Donnerstag, 13. August 2020, 21:34:54 CEST schrieb Johan Jonker:

Quoted 9 lines

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 3 rename and label gpio-led subnodes with pinctrl. To make things equal to other dts files move pinctrl below the compatible property.

Fix with help of the following rules:

Quoted 7 lines

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.

I'm undecided about this ... and while thinking about this, realized that we already have some changes doing that in the tree.

To explain, in general the pinctrl names should come from the names used in the actual device schematics, as this makes it easier to find and compare them between devicetree and schematics files.

So creating an arbitrary foo_led_pin pinctrl instead breaks this searchability which I'd really like to keep.

Heiko

Quoted 44 lines

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

---
 arch/arm/boot/dts/rk3036-kylin.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3036-kylin.dts +3 -3
index 7154b827e..bf808cda6 100644
@@ -15,12 +15,12 @@
 
 	leds: gpio-leds {
 		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&work_led_pin>;
 
 		work_led: led-0 {
 			gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
 			label = "kylin:red:led";
-			pinctrl-names = "default";
-			pinctrl-0 = <&led_ctl>;
 		};
 	};
 
@@ -367,7 +367,7 @@
 
 &pinctrl {
 	leds {
-		led_ctl: led-ctl {
+		work_led_pin: work-led-pin {
 			rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};