Skip to contentSkip to conversation

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

PATCH In review Charan Pedumuru 5 participants 6 messages Jun 29 – Aug 10

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

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

Convert STMicroelectronics STiH41x PWM/Capture controller binding to DT schema.
Changes during conversion:
- Fix compatible string from "st,pwm" to "st,sti-pwm" to match the actual hardware variant naming convention used across STi bindings.
- Drop pinctrl-names from the required list as pinctrl properties are inherited and validated by the pinctrl schema.

---
Changes in v5:
- Enforce stricter validation of the clock-names property.
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- Fix compatible to "st,sti-pwm" in examples.
- Modify subject line to point to the correct YAML file.
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Fix compatible to "st,sti-pwm".
- Drop pinctrl-names from required.
- Modify the commit message to explain the changes made.
- Change maintainer to "Lee Jones <[email protected]>".
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Add the missing interrupts to the required following the old binding.
- Modify the commit message to explain the changes made.
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/devicetree/bindings/pwm/pwm-st.txt   | 43 ----------
 .../devicetree/bindings/pwm/st,sti-pwm.yaml        | 92 ++++++++++++++++++++++
 2 files changed, 92 insertions(+), 43 deletions(-)
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 +92 -0

92 lines not on this page · raw message

---
base-commit: c425609d6ac4012c8bbf01ec2e10e801b1923a7b
change-id: 20260613-st-pwm-1feade6cfea3

Best regards,

Signature · 1 line
Charan Pedumuru <[email protected]>
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `clock-names` YAML schema strictly enforces an ordered list starting with `"pwm"`, which…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The clock-names YAML schema strictly enforces an ordered list starting with "pwm", which improperly rejects valid capture-only configurations. --

commit c9b4fd6ce8e4e0ebe419750b4c65554ab14080bc
Author: Charan Pedumuru <[email protected]>

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

This commit converts the STMicroelectronics STiH41x PWM/Capture controller binding from a text file to DT schema. It updates the compatible string to match hardware conventions and drops inherited pinctrl properties from the required list.

Quoted 5 lines
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +0 -0
new file mode 100644
index 0000000000000..39f96596c1ef8

[ ... ]

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

Quoted 8 lines
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +8 -0
+  pinctrl-names:
+    const: default
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: pwm
+      - const: capture

[Severity: Medium]
Can this rigid sequence for clock-names improperly reject valid capture-only configurations during schema validation?

The driver selectively fetches clocks based on whether st,pwm-num-chan and st,capture-num-chan are non-zero. If a hardware variant is configured solely for input capture, it only needs the "capture" clock.

By defining an items array that starts with a constant of "pwm", the schema mandates that the first or only clock name must be "pwm". Consequently, a valid single-clock configuration providing just "capture" will be rejected by the validation tools.

Would it make sense to use a more flexible schema construct like enum, anyOf, or oneOf to allow either clock to be specified independently?

Quoted 4 lines
Documentation/devicetree/bindings/pwm/st,sti-pwm.yaml new file +4 -0
+
+  clocks:
+    minItems: 1
+    maxItems: 2
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v5 1/1
#2 lore raw
In reply to Charan Pedumuru
Quoted 7 lines · Charan Pedumuru

Convert STMicroelectronics STiH41x PWM/Capture controller binding to DT schema.
Changes during conversion:
- Fix compatible string from "st,pwm" to "st,sti-pwm" to match the actual hardware variant naming convention used across STi bindings.
- Drop pinctrl-names from the required list as pinctrl properties are inherited and validated by the pinctrl schema.

Best regards,
Krzysztof

#3 lore raw
In reply to Charan Pedumuru
Quoted 19 lines · Charan Pedumuru

Convert STMicroelectronics STiH41x PWM/Capture controller binding to DT schema.
Changes during conversion:
- Fix compatible string from "st,pwm" to "st,sti-pwm" to match the actual hardware variant naming convention used across STi bindings.
- Drop pinctrl-names from the required list as pinctrl properties are inherited and validated by the pinctrl schema.

---
Changes in v5:
- Enforce stricter validation of the clock-names property.
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- Fix compatible to "st,sti-pwm" in examples.
- Modify subject line to point to the correct YAML file.
- Link to v3: https://patch.msgid.link/[email protected]

Quoted 5 lines

Changes in v3:
- Fix compatible to "st,sti-pwm".
- Drop pinctrl-names from required.
- Modify the commit message to explain the changes made.
- Change maintainer to "Lee Jones <[email protected]>".

I wonder if Lee has a comment about that. In v2 the maintainer was

Ajit Pal Singh <[email protected]>

and I don't see Lee agree to be named maintainer. The only rationale I can find was

Also the maintainer email doesn't exist now. I will change that too with other maintainer.

in
https://lore.kernel.org/all/[email protected]/
. At some point in the past [email protected] didn't exist either. I added that address to the list of recipents to test.

Otherwise looks fine.

Best regards
Uwe

#4 lore raw

Hello,

Quoted 11 lines · Uwe Kleine-König
Quoted 3 lines

Changes in v3:
[...]
- Change maintainer to "Lee Jones <[email protected]>".

I wonder if Lee has a comment about that. In v2 the maintainer was

Ajit Pal Singh <[email protected]>

and I don't see Lee agree to be named maintainer. The only rationale I can find was

Quoted 7 lines

Also the maintainer email doesn't exist now. I will change that too with other maintainer.

in
https://lore.kernel.org/all/[email protected]/
. At some point in the past [email protected] didn't exist either. I added that address to the list of recipents to test.

FTR: I got a Delivery Status Notification:

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.1.3
Diagnostic-Code: smtp; The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. For more information, go to https://support.google.com/mail/?p=NoSuchUser

I marked the patch as "Changes requested" in patchwork accordingly.

Best regards
Uwe

#5 lore raw
Quoted 22 lines · Uwe Kleine-König

Hello,

Quoted 11 lines · Uwe Kleine-König
Quoted 3 lines

Changes in v3:
[...]
- Change maintainer to "Lee Jones <[email protected]>".

I wonder if Lee has a comment about that. In v2 the maintainer was

Ajit Pal Singh <[email protected]>

and I don't see Lee agree to be named maintainer. The only rationale I can find was

Quoted 7 lines

Also the maintainer email doesn't exist now. I will change that too with other maintainer.

in
https://lore.kernel.org/all/[email protected]/
. At some point in the past [email protected] didn't exist either. I added that address to the list of recipents to test.

Quoted 8 lines

FTR: I got a Delivery Status Notification:

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.1.3
Diagnostic-Code: smtp; The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. For more information, go to https://support.google.com/mail/?p=NoSuchUser

I marked the patch as "Changes requested" in patchwork accordingly.

Right, and I don't have much to do with this driver anymore.

If you have to put one, put the PWM maintainer(s).

Signature · 1 line
Lee Jones