Skip to contentSkip to conversation

dt-bindings: pwm: st: convert sti-pwm to DT schema

PATCH In review Raphael Gallais-Pou 4 participants 7 messages Aug 1, 2023 – Aug 11, 2023

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

PATCH 1/1 dt-bindings: pwm: st: convert sti-pwm to DT schema

Converts st,sti-pwm binding to DT schema format

---
 .../devicetree/bindings/pwm/pwm-st.txt        | 43 -----------
 .../devicetree/bindings/pwm/st,sti-pwm.yaml   | 74 +++++++++++++++++++
 2 files changed, 74 insertions(+), 43 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pwm/pwm-st.txt
 create mode 100644 Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml
Documentation/devicetree/bindings/pwm/pwm-st.txt deleted +0 -43
deleted file mode 100644
index 19fce774cafa..000000000000
@@ -1,43 +0,0 @@
-STMicroelectronics PWM driver bindings
---------------------------------------
-
-Required parameters:
-- compatible :		"st,pwm"
-- #pwm-cells : 		Number of cells used to specify a PWM. First cell
-			specifies the per-chip index of the PWM to use and the
-			second cell is the period in nanoseconds - fixed to 2
-			for STiH41x.
-- reg :			Physical base address and length of the controller's
-			registers.
-- pinctrl-names: 	Set to "default".
-- pinctrl-0: 		List of phandles pointing to pin configuration nodes
-			for PWM module.
-			For Pinctrl properties, please refer to [1].
-- clock-names: 		Valid entries are "pwm" and/or "capture".
-- clocks: 		phandle of the clock used by the PWM module.
-			For Clk properties, please refer to [2].
-- interrupts:		IRQ for the Capture device
-
-Optional properties:
-- st,pwm-num-chan:	Number of available PWM channels.  Default is 0.
-- st,capture-num-chan:	Number of available Capture channels.  Default is 0.
-
-[1] Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
-[2] Documentation/devicetree/bindings/clock/clock-bindings.txt
-
-Example:
-
-pwm1: pwm@fe510000 {
-	compatible = "st,pwm";
-	reg = <0xfe510000 0x68>;
-	#pwm-cells = <2>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_pwm1_chan0_default
-		     &pinctrl_pwm1_chan1_default
-		     &pinctrl_pwm1_chan2_default
-		     &pinctrl_pwm1_chan3_default>;
-	clocks = <&clk_sysin>;
-	clock-names = "pwm";
-	st,pwm-num-chan = <4>;
-	st,capture-num-chan = <2>;
-};
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
2.41.0
#1 lore raw

Hello,

Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml line 43

Quoted 3 lines · Raphael Gallais-Pou
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +3 -0
+  st,capture-num-chan:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Number of available Capture channels.

I have the theory that nobody actually uses the capture feature and I'd like to get rid of it. People who do use it, should better switch to the counter driver.

I wonder if this is the opportunity to drop st,capture-num-chan. There is no mainline user.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#2 lore raw

Hi

Le 02/08/2023 à 10:02, Uwe Kleine-König a écrit :

Quoted 10 lines

Hello,

Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml line 43

Quoted 3 lines · Raphael Gallais-Pou
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +3 -0
+  st,capture-num-chan:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Number of available Capture channels.

I have the theory that nobody actually uses the capture feature and I'd like to get rid of it. People who do use it, should better switch to the counter driver.

TBH I only found two drivers using it, including this one.

$ grep -rinI "\.capture" drivers/pwm/ | wc -l
2

While I agree that there is not much drivers using capture feature, I have mixed feelings about removing it.

Quoted 3 lines

I wonder if this is the opportunity to drop st,capture-num-chan. There is no mainline user.

If there is no opposition about removing this feature I suggest to do it in a second time, in a serie.

Regards,
Raphaël

Quoted 4 lines

Best regards
Uwe

#3 lore raw
Quoted 10 lines · Raphaël Gallais-Pou

Hi

Le 02/08/2023 à 10:02, Uwe Kleine-König a écrit :

Quoted 7 lines

Hello,

Quoted 3 lines · Raphael Gallais-Pou
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +3 -0
+  st,capture-num-chan:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Number of available Capture channels.
Quoted 8 lines
Quoted 3 lines

I have the theory that nobody actually uses the capture feature and I'd like to get rid of it. People who do use it, should better switch to the counter driver.

TBH I only found two drivers using it, including this one.

$ grep -rinI "\.capture" drivers/pwm/ | wc -l
2

Right, there is pwm-stm32 and pwm-sti that support capture.

There are a few machines that have a st,sti-pwm device:

	$ grep -rl st,sti-pwm arch/arm/boot/dts/*.dtb
	arch/arm/boot/dts/stih407-b2120.dtb
	arch/arm/boot/dts/stih410-b2120.dtb
	arch/arm/boot/dts/stih410-b2260.dtb
	arch/arm/boot/dts/stih418-b2199.dtb
	arch/arm/boot/dts/stih418-b2264.dtb

but to actually use capture the device tree must have a property st,capture-num-chan. "st,capture-num-chan" isn't set by any of the devices.

I think for stm32 it's not that trivial to show that it's unused. While the capture code isn't a big maintenance burden, I still would prefer to get rid of it if nobody uses it. Still more given that there are better alternatives available.

Quoted 2 lines

If there is no opposition about removing this feature I suggest to do it in a second time, in a serie.

Does that mean you will do that? I guess not, but at least this means you're not using capture support.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#4 lore raw
Quoted 40 lines · Uwe Kleine-König
Quoted 10 lines · Raphaël Gallais-Pou

Hi

Le 02/08/2023 à 10:02, Uwe Kleine-König a écrit :

Quoted 7 lines

Hello,

Quoted 3 lines · Raphael Gallais-Pou
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +3 -0
+  st,capture-num-chan:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Number of available Capture channels.
Quoted 8 lines
Quoted 3 lines

I have the theory that nobody actually uses the capture feature and I'd like to get rid of it. People who do use it, should better switch to the counter driver.

TBH I only found two drivers using it, including this one.

$ grep -rinI "\.capture" drivers/pwm/ | wc -l
2

Right, there is pwm-stm32 and pwm-sti that support capture.

There are a few machines that have a st,sti-pwm device:

	$ grep -rl st,sti-pwm arch/arm/boot/dts/*.dtb
	arch/arm/boot/dts/stih407-b2120.dtb
	arch/arm/boot/dts/stih410-b2120.dtb
	arch/arm/boot/dts/stih410-b2260.dtb
	arch/arm/boot/dts/stih418-b2199.dtb
	arch/arm/boot/dts/stih418-b2264.dtb

but to actually use capture the device tree must have a property st,capture-num-chan. "st,capture-num-chan" isn't set by any of the devices.

I think for stm32 it's not that trivial to show that it's unused. While the capture code isn't a big maintenance burden, I still would prefer to get rid of it if nobody uses it. Still more given that there are better alternatives available.

Quoted 5 lines
Quoted 2 lines

If there is no opposition about removing this feature I suggest to do it in a second time, in a serie.

Does that mean you will do that? I guess not, but at least this means you're not using capture support.

It seems like it should either be done as part of the conversion or as a second patch in the series doing the conversion /shrug

#5 lore raw

Hi,

Le 03/08/2023 à 18:09, Conor Dooley a écrit :

Quoted 32 lines · Uwe Kleine-König
Quoted 31 lines · Raphaël Gallais-Pou
Quoted 10 lines

Hi

Le 02/08/2023 à 10:02, Uwe Kleine-König a écrit :

Quoted 7 lines

Hello,

Quoted 3 lines · Raphael Gallais-Pou
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +3 -0
+  st,capture-num-chan:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Number of available Capture channels.
Quoted 8 lines
Quoted 3 lines

I have the theory that nobody actually uses the capture feature and I'd like to get rid of it. People who do use it, should better switch to the counter driver.

TBH I only found two drivers using it, including this one.

$ grep -rinI "\.capture" drivers/pwm/ | wc -l
2

Right, there is pwm-stm32 and pwm-sti that support capture.

There are a few machines that have a st,sti-pwm device:

	$ grep -rl st,sti-pwm arch/arm/boot/dts/*.dtb
	arch/arm/boot/dts/stih407-b2120.dtb
	arch/arm/boot/dts/stih410-b2120.dtb
	arch/arm/boot/dts/stih410-b2260.dtb
	arch/arm/boot/dts/stih418-b2199.dtb
	arch/arm/boot/dts/stih418-b2264.dtb
Quoted 3 lines
Quoted 3 lines

but to actually use capture the device tree must have a property st,capture-num-chan. "st,capture-num-chan" isn't set by any of the devices.

This is also what I came across, this is the reason why I'm not reluctant to remove it.

Quoted 5 lines
Quoted 5 lines

I think for stm32 it's not that trivial to show that it's unused. While the capture code isn't a big maintenance burden, I still would prefer to get rid of it if nobody uses it. Still more given that there are better alternatives available.

Regarding stm32, I think the owner of the driver would prefer to handle it.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

If there is no opposition about removing this feature I suggest to do it in a second time, in a serie.

Does that mean you will do that? I guess not, but at least this means you're not using capture support.

It seems like it should either be done as part of the conversion or as a second patch in the series doing the conversion /shrug

Splitting the conversion and the capture removal is clearer IMO. Mixing both could lead to confusion. I'll send another serie to do this.

Regards,
Raphaël

maintainer
#6 lore raw
In reply to Raphael Gallais-Pou
Quoted 90 lines · Raphael Gallais-Pou

Converts st,sti-pwm binding to DT schema format

---
 .../devicetree/bindings/pwm/pwm-st.txt        | 43 -----------
 .../devicetree/bindings/pwm/st,sti-pwm.yaml   | 74 +++++++++++++++++++
 2 files changed, 74 insertions(+), 43 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pwm/pwm-st.txt
 create mode 100644 Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml
Documentation/devicetree/bindings/pwm/pwm-st.txt deleted +0 -43
deleted file mode 100644
index 19fce774cafa..000000000000
@@ -1,43 +0,0 @@
-STMicroelectronics PWM driver bindings
---------------------------------------
-
-Required parameters:
-- compatible :		"st,pwm"
-- #pwm-cells : 		Number of cells used to specify a PWM. First cell
-			specifies the per-chip index of the PWM to use and the
-			second cell is the period in nanoseconds - fixed to 2
-			for STiH41x.
-- reg :			Physical base address and length of the controller's
-			registers.
-- pinctrl-names: 	Set to "default".
-- pinctrl-0: 		List of phandles pointing to pin configuration nodes
-			for PWM module.
-			For Pinctrl properties, please refer to [1].
-- clock-names: 		Valid entries are "pwm" and/or "capture".
-- clocks: 		phandle of the clock used by the PWM module.
-			For Clk properties, please refer to [2].
-- interrupts:		IRQ for the Capture device
-
-Optional properties:
-- st,pwm-num-chan:	Number of available PWM channels.  Default is 0.
-- st,capture-num-chan:	Number of available Capture channels.  Default is 0.
-
-[1] Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
-[2] Documentation/devicetree/bindings/clock/clock-bindings.txt
-
-Example:
-
-pwm1: pwm@fe510000 {
-	compatible = "st,pwm";
-	reg = <0xfe510000 0x68>;
-	#pwm-cells = <2>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&pinctrl_pwm1_chan0_default
-		     &pinctrl_pwm1_chan1_default
-		     &pinctrl_pwm1_chan2_default
-		     &pinctrl_pwm1_chan3_default>;
-	clocks = <&clk_sysin>;
-	clock-names = "pwm";
-	st,pwm-num-chan = <4>;
-	st,capture-num-chan = <2>;
-};
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +25 -0
new file mode 100644
index 000000000000..8a7833e9c10c
@@ -0,0 +1,74 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/st,sti-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STi PWM controller
+
+maintainers:
+  - Patrice Chotard <[email protected]>
+
+allOf:
+  - $ref: pwm.yaml#
+
+properties:
+  compatible:
+    const: st,sti-pwm
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  pinctrl-names:

Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml line 35

Quoted 10 lines
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +10 -0
+    const: default
+
+  pinctrl-0:
+    description: Configuration for the default state.
+
+  clock-names:
+    const: pwm
+
+  clocks:
+    $ref: "/schemas/types.yaml#/definitions/phandle"

Drop quotes

Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml line 39

Quoted 4 lines
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +4 -0
+
+  st,pwm-num-chan:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Number of available PWM channels.

Constraints?

Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml line 43

Quoted 4 lines
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +4 -0
+
+  st,capture-num-chan:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Number of available Capture channels.

Constraints?

Quoted 34 lines
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +31 -0
+
+  "#pwm-cells":
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clock-names
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    pwm1: pwm@9510000 {
+        compatible = "st,sti-pwm";
+        #pwm-cells = <2>;
+        reg = <0x9510000 0x68>;
+        interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_pwm1_chan0_default
+                 &pinctrl_pwm1_chan1_default
+                 &pinctrl_pwm1_chan2_default
+                 &pinctrl_pwm1_chan3_default>;
+        clock-names = "pwm";
+        clocks = <&clk_sysin>;
+        st,pwm-num-chan = <4>;
+    };
+...
Signature · 1 line
2.41.0