diff mbox series

[v2] dt-bindings: pwm: Convert lpc32xx-pwm.txt to YAML

Message ID 20250312122750.6391-1-purvayeshi550@gmail.com (mailing list archive)
State New
Headers show
Series [v2] dt-bindings: pwm: Convert lpc32xx-pwm.txt to YAML | expand

Commit Message

Purva Yeshi March 12, 2025, 12:27 p.m. UTC
Convert the existing `lpc32xx-pwm.txt` bindings documentation into a
YAML schema (`nxp,lpc3220-pwm.yaml`).

Set `"#pwm-cells"` to `const: 3` for expected PWM cell properties.

Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
---
V1 - https://lore.kernel.org/all/20250311125756.24064-1-purvayeshi550@gmail.com/
V2 - Correct filename to match the compatible string, remove unnecessary
quotes in maintainers, and refine commit message.

 .../devicetree/bindings/pwm/lpc32xx-pwm.txt   | 17 ---------
 .../bindings/pwm/nxp,lpc3220-pwm.yaml         | 38 +++++++++++++++++++
 2 files changed, 38 insertions(+), 17 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
 create mode 100644 Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml

Comments

Vladimir Zapolskiy March 12, 2025, 5:59 p.m. UTC | #1
Hello Purva.

Thank you for your contribution.

On 3/12/25 14:27, Purva Yeshi wrote:
> Convert the existing `lpc32xx-pwm.txt` bindings documentation into a
> YAML schema (`nxp,lpc3220-pwm.yaml`).
> 
> Set `"#pwm-cells"` to `const: 3` for expected PWM cell properties.

Actually it shall be set to 1.

> 
> Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
> ---
> V1 - https://lore.kernel.org/all/20250311125756.24064-1-purvayeshi550@gmail.com/
> V2 - Correct filename to match the compatible string, remove unnecessary
> quotes in maintainers, and refine commit message.
> 
>   .../devicetree/bindings/pwm/lpc32xx-pwm.txt   | 17 ---------
>   .../bindings/pwm/nxp,lpc3220-pwm.yaml         | 38 +++++++++++++++++++
>   2 files changed, 38 insertions(+), 17 deletions(-)
>   delete mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
>   create mode 100644 Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml
> 
> diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
> deleted file mode 100644
> index 74b5bc5dd..000000000
> --- a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -LPC32XX PWM controller
> -
> -Required properties:
> -- compatible: should be "nxp,lpc3220-pwm"
> -- reg: physical base address and length of the controller's registers
> -
> -Examples:
> -
> -pwm@4005c000 {
> -	compatible = "nxp,lpc3220-pwm";
> -	reg = <0x4005c000 0x4>;
> -};
> -
> -pwm@4005c004 {
> -	compatible = "nxp,lpc3220-pwm";
> -	reg = <0x4005c004 0x4>;
> -};
> diff --git a/Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml b/Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml
> new file mode 100644
> index 000000000..432a5e9d4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml
> @@ -0,0 +1,38 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/pwm/nxp,lpc3220-pwm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: LPC32XX PWM controller
> +
> +maintainers:
> +  - Vladimir Zapolskiy <vz@mleia.com>
> +  - Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
> +
> +allOf:
> +  - $ref: pwm.yaml#
> +
> +properties:
> +  compatible:
> +    const: nxp,lpc3220-pwm
> +
> +  reg:
> +    maxItems: 1
> +
> +  "#pwm-cells":
> +    const: 3

It shall be 1.

> +
> +required:
> +  - compatible
> +  - reg
> +

There is an error in the original lpc32xx-pwm.txt file, one more property
"clocks" is strictly required, please add it along with the conversion.

Thank you!

> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    pwm@4005c000 {
> +        compatible = "nxp,lpc3220-pwm";
> +        reg = <0x4005c000 0x4>;
> +        #pwm-cells = <3>;
> +    };

--
Best wishes,
Vladimir
Uwe Kleine-König March 12, 2025, 10:56 p.m. UTC | #2
Hello,

On Wed, Mar 12, 2025 at 07:59:21PM +0200, Vladimir Zapolskiy wrote:
> > +  "#pwm-cells":
> > +    const: 3
> 
> It shall be 1.

No, 3 is the right choice.

Best regards
Uwe
Vladimir Zapolskiy March 13, 2025, 3:37 a.m. UTC | #3
Hi Uwe,

On 3/13/25 00:56, Uwe Kleine-König wrote:
> Hello,
> 
> On Wed, Mar 12, 2025 at 07:59:21PM +0200, Vladimir Zapolskiy wrote:
>>> +  "#pwm-cells":
>>> +    const: 3
>>
>> It shall be 1.
> 
> No, 3 is the right choice.
> 

could you please elaborate?

I find that here the only configurable parameter is PWM period, so it
should be sufficient to have one cell only like in marvell,pxa-pwm.yaml
or google,cros-ec-pwm.yaml.

--
Best wishes,
Vladimir
Uwe Kleine-König March 13, 2025, 7:22 a.m. UTC | #4
Hello Vladimir,

On Thu, Mar 13, 2025 at 05:37:44AM +0200, Vladimir Zapolskiy wrote:
> On 3/13/25 00:56, Uwe Kleine-König wrote:
> > Hello,
> > 
> > On Wed, Mar 12, 2025 at 07:59:21PM +0200, Vladimir Zapolskiy wrote:
> > > > +  "#pwm-cells":
> > > > +    const: 3
> > > 
> > > It shall be 1.
> > 
> > No, 3 is the right choice.
> > 
> 
> could you please elaborate?
> 
> I find that here the only configurable parameter is PWM period, so it
> should be sufficient to have one cell only like in marvell,pxa-pwm.yaml
> or google,cros-ec-pwm.yaml.

These two bindings are special snow-flakes and the only drivers that
have #pwm-cells = <1>. Most other bindings use 3 and since commit
895fe4537cc8 ("pwm: Add upgrade path to #pwm-cells = <3> for users of
of_pwm_single_xlate()") (which was created for the pxa driver) the pxa
driver also supports 3 cells. The cros-ec driver even has comment about
that being ugly. 

I intend to convert all bindings to use 3 soon.

While that isn't necessary for each individual piece of hardware to
provide 3 values, having a uniform binding for PWMs provides a nice user
experience and also simplifies matters with nexus nodes (see
e71e46a6f19c ("pwm: Add support for pwm nexus dt bindings")).

Best regards
Uwe
Krzysztof Kozlowski March 13, 2025, 11:04 a.m. UTC | #5
On 12/03/2025 13:27, Purva Yeshi wrote:
> Convert the existing `lpc32xx-pwm.txt` bindings documentation into a
> YAML schema (`nxp,lpc3220-pwm.yaml`).
> 
> Set `"#pwm-cells"` to `const: 3` for expected PWM cell properties.
> 
> Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


---

<form letter>
This is an automated instruction, just in case, because many review tags
are being ignored. If you know the process, you can skip it (please do
not feel offended by me posting it here - no bad intentions intended).
If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions
of patchset, under or above your Signed-off-by tag, unless patch changed
significantly (e.g. new properties added to the DT bindings). Tag is
"received", when provided in a message replied to you on the mailing
list. Tools like b4 can help here. However, there's no need to repost
patches *only* to add the tags. The upstream maintainer will do that for
tags received on the version they apply.

Full context and explanation:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577
</form letter>

Best regards,
Krzysztof
Purva Yeshi March 13, 2025, 2:25 p.m. UTC | #6
On 13/03/25 16:34, Krzysztof Kozlowski wrote:
> On 12/03/2025 13:27, Purva Yeshi wrote:
>> Convert the existing `lpc32xx-pwm.txt` bindings documentation into a
>> YAML schema (`nxp,lpc3220-pwm.yaml`).
>>
>> Set `"#pwm-cells"` to `const: 3` for expected PWM cell properties.
>>
>> Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
>> ---
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> 
> ---
> 
> <form letter>
> This is an automated instruction, just in case, because many review tags
> are being ignored. If you know the process, you can skip it (please do
> not feel offended by me posting it here - no bad intentions intended).
> If you do not know the process, here is a short explanation:
> 
> Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions
> of patchset, under or above your Signed-off-by tag, unless patch changed
> significantly (e.g. new properties added to the DT bindings). Tag is
> "received", when provided in a message replied to you on the mailing
> list. Tools like b4 can help here. However, there's no need to repost
> patches *only* to add the tags. The upstream maintainer will do that for
> tags received on the version they apply.
> 
> Full context and explanation:
> https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577
> </form letter>
> 
> Best regards,
> Krzysztof

Hi Krzysztof,

Thank you for your review! I will include your Reviewed-by tag in the 
next version if no significant changes are made.

Best regards,
Purva Yeshi
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
deleted file mode 100644
index 74b5bc5dd..000000000
--- a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
+++ /dev/null
@@ -1,17 +0,0 @@ 
-LPC32XX PWM controller
-
-Required properties:
-- compatible: should be "nxp,lpc3220-pwm"
-- reg: physical base address and length of the controller's registers
-
-Examples:
-
-pwm@4005c000 {
-	compatible = "nxp,lpc3220-pwm";
-	reg = <0x4005c000 0x4>;
-};
-
-pwm@4005c004 {
-	compatible = "nxp,lpc3220-pwm";
-	reg = <0x4005c004 0x4>;
-};
diff --git a/Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml b/Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml
new file mode 100644
index 000000000..432a5e9d4
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/nxp,lpc3220-pwm.yaml
@@ -0,0 +1,38 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/nxp,lpc3220-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LPC32XX PWM controller
+
+maintainers:
+  - Vladimir Zapolskiy <vz@mleia.com>
+  - Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
+
+allOf:
+  - $ref: pwm.yaml#
+
+properties:
+  compatible:
+    const: nxp,lpc3220-pwm
+
+  reg:
+    maxItems: 1
+
+  "#pwm-cells":
+    const: 3
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    pwm@4005c000 {
+        compatible = "nxp,lpc3220-pwm";
+        reg = <0x4005c000 0x4>;
+        #pwm-cells = <3>;
+    };