Skip to contentSkip to conversation

dt-bindings: arm: hwmon: gpio-fan: Convert txt bindings to yaml

PATCH Applied David Heidelberg 6 participants 10 messages Dec 2, 2023 – Dec 8, 2023

Subsystems (6)

v3 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/5 dt-bindings: arm: hwmon: gpio-fan: Convert txt bindings to yaml

Convert fan devices connected to GPIOs to the YAML syntax.

---
 .../devicetree/bindings/hwmon/gpio-fan.txt    | 41 -----------
 .../devicetree/bindings/hwmon/gpio-fan.yaml   | 70 +++++++++++++++++++
 2 files changed, 70 insertions(+), 41 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwmon/gpio-fan.txt
 create mode 100644 Documentation/devicetree/bindings/hwmon/gpio-fan.yaml
Documentation/devicetree/bindings/hwmon/gpio-fan.txt deleted +0 -41
deleted file mode 100644
index f4cfa350f6a1..000000000000
@@ -1,41 +0,0 @@
-Bindings for fan connected to GPIO lines
-
-Required properties:
-- compatible : "gpio-fan"
-
-Optional properties:
-- gpios: Specifies the pins that map to bits in the control value,
-  ordered MSB-->LSB.
-- gpio-fan,speed-map: A mapping of possible fan RPM speeds and the
-  control value that should be set to achieve them. This array
-  must have the RPM values in ascending order.
-- alarm-gpios: This pin going active indicates something is wrong with
-  the fan, and a udev event will be fired.
-- #cooling-cells: If used as a cooling device, must be <2>
-  Also see:
-  Documentation/devicetree/bindings/thermal/thermal-cooling-devices.yaml
-  min and max states are derived from the speed-map of the fan.
-
-Note: At least one the "gpios" or "alarm-gpios" properties must be set.
-
-Examples:
-
-	gpio_fan {
-		compatible = "gpio-fan";
-		gpios = <&gpio1 14 1
-			 &gpio1 13 1>;
-		gpio-fan,speed-map = <0    0
-				      3000 1
-				      6000 2>;
-		alarm-gpios = <&gpio1 15 1>;
-	};
-	gpio_fan_cool: gpio_fan {
-		compatible = "gpio-fan";
-		gpios = <&gpio2 14 1
-			 &gpio2 13 1>;
-		gpio-fan,speed-map =	<0    0>,
-					<3000 1>,
-					<6000 2>;
-		alarm-gpios = <&gpio2 15 1>;
-		#cooling-cells = <2>; /* min followed by max */
-	};
Documentation/devicetree/bindings/hwmon/gpio-fan.yaml new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
2.42.0
#1 lore raw

PATCH v3 2/5 arm64: dts: imx8mq-phanbell: make dts use gpio-fan matrix instead of array

No functional changes.

Adjust to comply with dt-schema requirements
and make possible to validate values.

---
 arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +1 -1
index a3b9d615a3b4..e34045d10a12 100644
@@ -39,7 +39,7 @@ reg_usdhc2_vmmc: regulator-usdhc2-vmmc {
 
 	fan: gpio-fan {
 		compatible = "gpio-fan";
-		gpio-fan,speed-map = <0 0 8600 1>;
+		gpio-fan,speed-map = <0 0>, <8600 1>;
 		gpios = <&gpio3 5 GPIO_ACTIVE_HIGH>;
 		#cooling-cells = <2>;
 		pinctrl-names = "default";
Signature · 7 lines
2.42.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Applied
#2 lore raw

Re: [PATCH v3 2/5] arm64: dts: imx8mq-phanbell: make dts use gpio-fan matrix instead of array

Quoted 6 lines · David Heidelberg

No functional changes.

Adjust to comply with dt-schema requirements
and make possible to validate values.

Applied, thanks!

#3 lore raw

PATCH v3 3/5 arm64: dts: rockchip: make dts use gpio-fan matrix instead of array

In reply to David Heidelberg

No functional changes.

Adjust to comply with dt-schema requirements
and make possible to validate values.

---
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi  | 2 +-
 arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +1 -1
index e6ac292ce645..69dd3568b84e 100644
@@ -44,7 +44,7 @@ dc_12v: dc-12v {
 	fan0: gpio-fan {
 		#cooling-cells = <2>;
 		compatible = "gpio-fan";
-		gpio-fan,speed-map = <0 0 3000 1>;
+		gpio-fan,speed-map = <0 0>, <3000 1>;
 		gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
 		status = "okay";
 	};
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +3 -2
index 854d02b46e6f..59843a7a199c 100644
@@ -31,8 +31,9 @@ gmac1_clkin: external-gmac1-clock {
 	fan: gpio_fan {
 		compatible = "gpio-fan";
 		gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
-		gpio-fan,speed-map = <0    0
-				      4500 1>;
+		gpio-fan,speed-map =
+				<   0 0>,
+				<4500 1>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&fan_en_h>;
 		#cooling-cells = <2>;
Signature · 7 lines
2.42.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#4 lore raw

PATCH v3 4/5 ARM: dts: tegra30-ouya: make dts use gpio-fan matrix instead of array

In reply to David Heidelberg

No functional changes.

Adjust to comply with dt-schema requirements
and make possible to validate values.

---
 arch/arm/boot/dts/nvidia/tegra30-ouya.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/nvidia/tegra30-ouya.dts +2 -2
index 7e3de26ca960..c284dd0a55ab 100644
@@ -4611,8 +4611,8 @@ cpu3: cpu@3 {
 	fan: fan {
 		compatible = "gpio-fan";
 		gpios = <&gpio TEGRA_GPIO(J, 2) GPIO_ACTIVE_HIGH>;
-		gpio-fan,speed-map = <0    0
-				      4500 1>;
+		gpio-fan,speed-map = <0    0>,
+				     <4500 1>;
 		#cooling-cells = <2>;
 	};
 
Signature · 1 line
2.42.0
#6 lore raw

PATCH v3 5/5 ARM: dts: marvell: make dts use gpio-fan matrix instead of array

In reply to David Heidelberg

No functional changes.

Adjust to comply with dt-schema requirements
and make possible to validate values.

---
 arch/arm/boot/dts/marvell/armada-370-rd.dts   |   2 +-
 .../marvell/armada-370-seagate-nas-2bay.dts   |   8 +-
 .../marvell/armada-370-seagate-nas-4bay.dts   |   8 +-
 .../marvell/armada-370-synology-ds213j.dts    |  16 +--
 .../dts/marvell/armada-385-synology-ds116.dts |  16 +--
 arch/arm/boot/dts/marvell/armada-388-gp.dts   |   4 +-
 arch/arm/boot/dts/marvell/kirkwood-dnskw.dtsi |   6 +-
 .../marvell/kirkwood-linkstation-6282.dtsi    |   9 +-
 .../marvell/kirkwood-linkstation-lswxl.dts    |   9 +-
 arch/arm/boot/dts/marvell/kirkwood-lsxl.dtsi  |   9 +-
 arch/arm/boot/dts/marvell/kirkwood-ns2max.dts |  18 ++--
 .../arm/boot/dts/marvell/kirkwood-ns2mini.dts |  18 ++--
 .../boot/dts/marvell/kirkwood-synology.dtsi   | 102 +++++++++---------
 .../dts/marvell/mvebu-linkstation-fan.dtsi    |   8 +-
 14 files changed, 121 insertions(+), 112 deletions(-)
arch/arm/boot/dts/marvell/armada-370-rd.dts +1 -1
index b459a670f615..4b5789b73dac 100644
@@ -95,7 +95,7 @@ button {
 			gpio-fan {
 				compatible = "gpio-fan";
 				gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
-				gpio-fan,speed-map = <0 0 3000 1>;
+				gpio-fan,speed-map = <0 0>, <3000 1>;
 				pinctrl-0 = <&fan_pins>;
 				pinctrl-names = "default";
 			};
arch/arm/boot/dts/marvell/armada-370-seagate-nas-2bay.dts +4 -4
index 8dd242e668e6..6ec3dd3337f4 100644
@@ -25,9 +25,9 @@ / {
 
 	gpio-fan {
 		gpio-fan,speed-map =
-			<   0 3
-			  950 2
-			 1400 1
-			 1800 0>;
+			<   0 3>,
+			< 950 2>,
+			<1400 1>,
+			<1800 0>;
 	};
 };
arch/arm/boot/dts/marvell/armada-370-seagate-nas-4bay.dts +4 -4
index 370ca9c43247..3011578a3124 100644
@@ -106,10 +106,10 @@ NS_V2_LED_ON   1 0
 
 	gpio-fan {
 		gpio-fan,speed-map =
-			<   0 3
-			  800 2
-			  1050 1
-			  1300 0>;
+			<   0 3>,
+			< 800 2>,
+			<1050 1>,
+			<1300 0>;
 	};
 };
 
arch/arm/boot/dts/marvell/armada-370-synology-ds213j.dts +8 -8
index b07d11d1f124..02599a3e9816 100644
@@ -113,14 +113,14 @@ gpio-fan-32-38 {
 			 &gpio2  0 GPIO_ACTIVE_HIGH
 			 &gpio2  1 GPIO_ACTIVE_HIGH>;
 		alarm-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
-		gpio-fan,speed-map = <    0 0
-				       1000 1
-				       1150 2
-				       1350 4
-				       1500 3
-				       1650 5
-				       1750 6
-				       1900 7 >;
+		gpio-fan,speed-map = <   0 0>,
+				     <1000 1>,
+				     <1150 2>,
+				     <1350 4>,
+				     <1500 3>,
+				     <1650 5>,
+				     <1750 6>,
+				     <1900 7>;
 	};
 
 	gpio-leds {
arch/arm/boot/dts/marvell/armada-385-synology-ds116.dts +8 -8
index ea91ff964d94..6caa5c50175a 100644
@@ -131,14 +131,14 @@ gpio-fan {
 			gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>,
 				<&gpio1 17 GPIO_ACTIVE_HIGH>,
 				<&gpio1 16 GPIO_ACTIVE_HIGH>;
-			gpio-fan,speed-map = <   0 0
-					      1500 1
-					      2500 2
-					      3000 3
-					      3400 4
-					      3700 5
-					      3900 6
-					      4000 7>;
+			gpio-fan,speed-map = <   0 0>,
+					     <1500 1>,
+					     <2500 2>,
+					     <3000 3>,
+					     <3400 4>,
+					     <3700 5>,
+					     <3900 6>,
+					     <4000 7>;
 			#cooling-cells = <2>;
 		};
 
arch/arm/boot/dts/marvell/armada-388-gp.dts +2 -2
index e2ba50520b6b..1de0a172aa5f 100644
@@ -237,8 +237,8 @@ pcie@3,0 {
 		gpio-fan {
 			compatible = "gpio-fan";
 			gpios = <&expander1 3 GPIO_ACTIVE_HIGH>;
-			gpio-fan,speed-map = <	 0 0
-					      3000 1>;
+			gpio-fan,speed-map = <	 0 0>,
+					     <3000 1>;
 		};
 	};
 
arch/arm/boot/dts/marvell/kirkwood-dnskw.dtsi +3 -3
index eb917462b219..0738eb679fcd 100644
@@ -38,9 +38,9 @@ gpio_fan {
 		pinctrl-names = "default";
 		gpios = <&gpio1 14 GPIO_ACTIVE_HIGH
 			 &gpio1 13 GPIO_ACTIVE_HIGH>;
-		gpio-fan,speed-map = <0    0
-				      3000 1
-				      6000 2>;
+		gpio-fan,speed-map = <0    0>,
+				     <3000 1>,
+				     <6000 2>;
 	};
 
 	gpio_poweroff {
arch/arm/boot/dts/marvell/kirkwood-linkstation-6282.dtsi +5 -4
index 377b6e970259..dfac2045a1eb 100644
@@ -118,10 +118,11 @@ gpio_fan {
 		gpios = <&gpio0 17 GPIO_ACTIVE_LOW
 			 &gpio0 16 GPIO_ACTIVE_LOW>;
 
-		gpio-fan,speed-map = <0 3
-				1500 2
-				3250 1
-				5000 0>;
+		gpio-fan,speed-map =
+				<   0 3>,
+				<1500 2>,
+				<3250 1>,
+				<5000 0>;
 
 		alarm-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
 	};
arch/arm/boot/dts/marvell/kirkwood-linkstation-lswxl.dts +5 -4
index c6024b569423..0425df8cb91c 100644
@@ -69,10 +69,11 @@ gpio_fan {
 		gpios = <&gpio1 16 GPIO_ACTIVE_LOW
 			 &gpio1 15 GPIO_ACTIVE_LOW>;
 
-		gpio-fan,speed-map = <0 3
-				1500 2
-				3250 1
-				5000 0>;
+		gpio-fan,speed-map =
+				<   0 3>,
+				<1500 2>,
+				<3250 1>,
+				<5000 0>;
 
 		alarm-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
 	};
arch/arm/boot/dts/marvell/kirkwood-lsxl.dtsi +5 -4
index 88b70ba1c8fe..f80af24b9e90 100644
@@ -172,10 +172,11 @@ gpio_fan {
 		pinctrl-names = "default";
 		gpios = <&gpio0 19 GPIO_ACTIVE_LOW
 		         &gpio0 18 GPIO_ACTIVE_LOW>;
-		gpio-fan,speed-map = <0    3
-		                      1500 2
-		                      3250 1
-		                      5000 0>;
+		gpio-fan,speed-map =
+				<0    3>,
+				<1500 2>,
+				<3250 1>,
+				<5000 0>;
 		alarm-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
 	};
 
arch/arm/boot/dts/marvell/kirkwood-ns2max.dts +9 -9
index c0a087e77408..044958bc55da 100644
@@ -29,15 +29,15 @@ &gpio0  7 GPIO_ACTIVE_LOW
 			 &gpio1  1 GPIO_ACTIVE_LOW
 			 &gpio0 23 GPIO_ACTIVE_LOW>;
 		gpio-fan,speed-map =
-			<   0  0
-			 1500 15
-			 1700 14
-			 1800 13
-			 2100 12
-			 3100 11
-			 3300 10
-			 4300  9
-			 5500  8>;
+			<   0  0>,
+			<1500 15>,
+			<1700 14>,
+			<1800 13>,
+			<2100 12>,
+			<3100 11>,
+			<3300 10>,
+			<4300  9>,
+			<5500  8>;
 		alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
 	};
 
arch/arm/boot/dts/marvell/kirkwood-ns2mini.dts +9 -9
index 5b9fa14b6428..3fbe008f9141 100644
@@ -30,15 +30,15 @@ &gpio0  7 GPIO_ACTIVE_LOW
 			 &gpio1  1 GPIO_ACTIVE_LOW
 			 &gpio0 23 GPIO_ACTIVE_LOW>;
 		gpio-fan,speed-map =
-			<   0  0
-			 3000 15
-			 3180 14
-			 4140 13
-			 4570 12
-			 6760 11
-			 7140 10
-			 7980  9
-			 9200  8>;
+			<   0  0>,
+			<3000 15>,
+			<3180 14>,
+			<4140 13>,
+			<4570 12>,
+			<6760 11>,
+			<7140 10>,
+			<7980  9>,
+			<9200  8>;
 		alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
 	};
 
arch/arm/boot/dts/marvell/kirkwood-synology.dtsi +54 -48

138 lines not on this page · raw message

arch/arm/boot/dts/marvell/mvebu-linkstation-fan.dtsi +4 -4
index e172029a0c4d..a260c42dbda3 100644
@@ -50,10 +50,10 @@ gpio_fan {
 		pinctrl-names = "default";
 
 		gpio-fan,speed-map =
-			<0		3
-			1500	2
-			3250	1
-			5000	0>;
+			<   0 3>,
+			<1500 2>,
+			<3250 1>,
+			<5000 0>;
 	};
 };
 
Signature · 7 lines
2.42.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#8 lore raw

Re: [PATCH v3 5/5] ARM: dts: marvell: make dts use gpio-fan matrix instead of array

In reply to David Heidelberg
Quoted 7 lines · David Heidelberg

No functional changes.

Adjust to comply with dt-schema requirements
and make possible to validate values.

Applied on mvebu/dt

Thanks,

Gregory

Quoted 16 lines
---
 arch/arm/boot/dts/marvell/armada-370-rd.dts   |   2 +-
 .../marvell/armada-370-seagate-nas-2bay.dts   |   8 +-
 .../marvell/armada-370-seagate-nas-4bay.dts   |   8 +-
 .../marvell/armada-370-synology-ds213j.dts    |  16 +--
 .../dts/marvell/armada-385-synology-ds116.dts |  16 +--
 arch/arm/boot/dts/marvell/armada-388-gp.dts   |   4 +-
 arch/arm/boot/dts/marvell/kirkwood-dnskw.dtsi |   6 +-
 .../marvell/kirkwood-linkstation-6282.dtsi    |   9 +-
 .../marvell/kirkwood-linkstation-lswxl.dts    |   9 +-
 arch/arm/boot/dts/marvell/kirkwood-lsxl.dtsi  |   9 +-
 arch/arm/boot/dts/marvell/kirkwood-ns2max.dts |  18 ++--
 .../arm/boot/dts/marvell/kirkwood-ns2mini.dts |  18 ++--
 .../boot/dts/marvell/kirkwood-synology.dtsi   | 102 +++++++++---------
 .../dts/marvell/mvebu-linkstation-fan.dtsi    |   8 +-
 14 files changed, 121 insertions(+), 112 deletions(-)
Signature · 3 lines
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
maintainer
#9 lore raw
In reply to David Heidelberg
Quoted 114 lines · David Heidelberg

Convert fan devices connected to GPIOs to the YAML syntax.

---
 .../devicetree/bindings/hwmon/gpio-fan.txt    | 41 -----------
 .../devicetree/bindings/hwmon/gpio-fan.yaml   | 70 +++++++++++++++++++
 2 files changed, 70 insertions(+), 41 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwmon/gpio-fan.txt
 create mode 100644 Documentation/devicetree/bindings/hwmon/gpio-fan.yaml
Documentation/devicetree/bindings/hwmon/gpio-fan.txt deleted +0 -41
deleted file mode 100644
index f4cfa350f6a1..000000000000
@@ -1,41 +0,0 @@
-Bindings for fan connected to GPIO lines
-
-Required properties:
-- compatible : "gpio-fan"
-
-Optional properties:
-- gpios: Specifies the pins that map to bits in the control value,
-  ordered MSB-->LSB.
-- gpio-fan,speed-map: A mapping of possible fan RPM speeds and the
-  control value that should be set to achieve them. This array
-  must have the RPM values in ascending order.
-- alarm-gpios: This pin going active indicates something is wrong with
-  the fan, and a udev event will be fired.
-- #cooling-cells: If used as a cooling device, must be <2>
-  Also see:
-  Documentation/devicetree/bindings/thermal/thermal-cooling-devices.yaml
-  min and max states are derived from the speed-map of the fan.
-
-Note: At least one the "gpios" or "alarm-gpios" properties must be set.
-
-Examples:
-
-	gpio_fan {
-		compatible = "gpio-fan";
-		gpios = <&gpio1 14 1
-			 &gpio1 13 1>;
-		gpio-fan,speed-map = <0    0
-				      3000 1
-				      6000 2>;
-		alarm-gpios = <&gpio1 15 1>;
-	};
-	gpio_fan_cool: gpio_fan {
-		compatible = "gpio-fan";
-		gpios = <&gpio2 14 1
-			 &gpio2 13 1>;
-		gpio-fan,speed-map =	<0    0>,
-					<3000 1>,
-					<6000 2>;
-		alarm-gpios = <&gpio2 15 1>;
-		#cooling-cells = <2>; /* min followed by max */
-	};
Documentation/devicetree/bindings/hwmon/gpio-fan.yaml new file +51 -0
new file mode 100644
index 000000000000..0e220874bee6
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/gpio-fan.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Fan connected to GPIO lines
+
+maintainers:
+  - Rob Herring <[email protected]>
+
+properties:
+  compatible:
+    const: gpio-fan
+
+  gpios:
+    description: |
+      Specifies the pins that map to bits in the control value,
+      ordered MSB-->LSB.
+    minItems: 1
+    maxItems: 7
+
+  alarm-gpios:
+    maxItems: 1
+
+  gpio-fan,speed-map:
+    $ref: /schemas/types.yaml#/definitions/uint32-matrix
+    minItems: 2
+    maxItems: 127
+    items:
+      items:
+        - description: fan speed in RPMs
+        - description: control value
+    description: |
+      A mapping of possible fan RPM speeds and the
+      control value that should be set to achieve them. This array
+      must have the RPM values in ascending order.
+
+  '#cooling-cells':
+    const: 2
+
+required:
+  - compatible
+  - gpios
+  - gpio-fan,speed-map
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio_fan {

Documentation/devicetree/bindings/hwmon/gpio-fan.yaml line 61

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/gpio-fan.yaml new file +10 -0
+      compatible = "gpio-fan";
+      gpios = <&gpio1 14 1
+               &gpio1 13 1>;
+      gpio-fan,speed-map = <    0 0>,
+                           < 3000 1>,
+                           <36000 2>;
+      alarm-gpios = <&gpio1 15 1>;
+    };
+  - |
+    gpio_fan_cool: gpio_fan {

Drop unused labels.

Documentation/devicetree/bindings/hwmon/gpio-fan.yaml line 70

Quoted 9 lines
Documentation/devicetree/bindings/hwmon/gpio-fan.yaml new file +9 -0
+      compatible = "gpio-fan";
+      gpios = <&gpio2 14 1
+               &gpio2 13 1>;
+      gpio-fan,speed-map = <   0 0>,
+                           <3000 1>,
+                           <6000 2>;
+      alarm-gpios = <&gpio2 15 1>;
+      #cooling-cells = <2>; /* min followed by max */
+    };

Not really much difference in the 2 examples. Drop the first one (having fewer properties).

Rob