diff mbox series

[v3,2/3] dt-bindings: pwm: Document clk based PWM controller

Message ID 20220120161442.140800-3-nikita@trvn.ru
State Superseded
Headers show
Series [v3,1/3] dt-bindings: pwm: Fix node name pattern | expand

Commit Message

Nikita Travkin Jan. 20, 2022, 4:14 p.m. UTC
Add YAML devicetree binding for clk based PWM controller

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
--
Changes in v2:
 - fix the file name.
---
 .../devicetree/bindings/pwm/clk-pwm.yaml      | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/clk-pwm.yaml

Comments

Krzysztof Kozlowski Jan. 21, 2022, 7:34 a.m. UTC | #1
On Thu, 20 Jan 2022 at 17:15, Nikita Travkin <nikita@trvn.ru> wrote:
>
> Add YAML devicetree binding for clk based PWM controller
>
> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> --
> Changes in v2:
>  - fix the file name.
> ---
>  .../devicetree/bindings/pwm/clk-pwm.yaml      | 45 +++++++++++++++++++
>  1 file changed, 45 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pwm/clk-pwm.yaml
>
> diff --git a/Documentation/devicetree/bindings/pwm/clk-pwm.yaml b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
> new file mode 100644
> index 000000000000..4fb2c1baaad4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/pwm/clk-pwm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Clock based PWM controller
> +
> +maintainers:
> +  - Nikita Travkin <nikita@trvn.ru>
> +
> +description: |
> +  Some systems have clocks that can be exposed to external devices.
> +  (e.g. by muxing them to GPIO pins)
> +  It's often possible to control duty-cycle of such clocks which makes them
> +  suitable for generating PWM signal.
> +
> +allOf:
> +  - $ref: pwm.yaml#
> +
> +properties:
> +  compatible:
> +    const: clk-pwm
> +
> +  clocks:
> +    description: Clock used to generate the signal.
> +    maxItems: 1
> +
> +  "#pwm-cells":
> +    const: 2
> +
> +unevaluatedProperties: false
> +
> +required:
> +  - clocks
> +
> +examples:
> +  - |
> +    pwm-flash {

Node names should be generic (see devicetree specification), so just "pwm".

Best regards,
Krzysztof
Sean Anderson Jan. 21, 2022, 9:34 p.m. UTC | #2
On 1/21/22 2:34 AM, Krzysztof Kozlowski wrote:
> On Thu, 20 Jan 2022 at 17:15, Nikita Travkin <nikita@trvn.ru> wrote:
>>
>> Add YAML devicetree binding for clk based PWM controller
>>
>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>> --
>> Changes in v2:
>>  - fix the file name.
>> ---
>>  .../devicetree/bindings/pwm/clk-pwm.yaml      | 45 +++++++++++++++++++
>>  1 file changed, 45 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/clk-pwm.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/clk-pwm.yaml b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
>> new file mode 100644
>> index 000000000000..4fb2c1baaad4
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
>> @@ -0,0 +1,45 @@
>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/pwm/clk-pwm.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Clock based PWM controller
>> +
>> +maintainers:
>> +  - Nikita Travkin <nikita@trvn.ru>
>> +
>> +description: |
>> +  Some systems have clocks that can be exposed to external devices.
>> +  (e.g. by muxing them to GPIO pins)
>> +  It's often possible to control duty-cycle of such clocks which makes them
>> +  suitable for generating PWM signal.
>> +
>> +allOf:
>> +  - $ref: pwm.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    const: clk-pwm
>> +
>> +  clocks:
>> +    description: Clock used to generate the signal.
>> +    maxItems: 1
>> +
>> +  "#pwm-cells":
>> +    const: 2
>> +
>> +unevaluatedProperties: false
>> +
>> +required:
>> +  - clocks
>> +
>> +examples:
>> +  - |
>> +    pwm-flash {
> 
> Node names should be generic (see devicetree specification), so just "pwm".

And then what will you do if you have two clock-based pwms?

--Sean
Krzysztof Kozlowski Jan. 22, 2022, 10:13 a.m. UTC | #3
On 21/01/2022 22:34, Sean Anderson wrote:
> 
> 
> On 1/21/22 2:34 AM, Krzysztof Kozlowski wrote:
>> On Thu, 20 Jan 2022 at 17:15, Nikita Travkin <nikita@trvn.ru> wrote:
>>>
>>> Add YAML devicetree binding for clk based PWM controller
>>>
>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>> --
>>> Changes in v2:
>>>  - fix the file name.
>>> ---
>>>  .../devicetree/bindings/pwm/clk-pwm.yaml      | 45 +++++++++++++++++++
>>>  1 file changed, 45 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/pwm/clk-pwm.yaml
>>>
>>> diff --git a/Documentation/devicetree/bindings/pwm/clk-pwm.yaml b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
>>> new file mode 100644
>>> index 000000000000..4fb2c1baaad4
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
>>> @@ -0,0 +1,45 @@
>>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/pwm/clk-pwm.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Clock based PWM controller
>>> +
>>> +maintainers:
>>> +  - Nikita Travkin <nikita@trvn.ru>
>>> +
>>> +description: |
>>> +  Some systems have clocks that can be exposed to external devices.
>>> +  (e.g. by muxing them to GPIO pins)
>>> +  It's often possible to control duty-cycle of such clocks which makes them
>>> +  suitable for generating PWM signal.
>>> +
>>> +allOf:
>>> +  - $ref: pwm.yaml#
>>> +
>>> +properties:
>>> +  compatible:
>>> +    const: clk-pwm
>>> +
>>> +  clocks:
>>> +    description: Clock used to generate the signal.
>>> +    maxItems: 1
>>> +
>>> +  "#pwm-cells":
>>> +    const: 2
>>> +
>>> +unevaluatedProperties: false
>>> +
>>> +required:
>>> +  - clocks
>>> +
>>> +examples:
>>> +  - |
>>> +    pwm-flash {
>>
>> Node names should be generic (see devicetree specification), so just "pwm".
> 
> And then what will you do if you have two clock-based pwms?

The same as we do with fixed clocks, keys and so on:
pwm-0
pwm-1
pwm-2

A descriptive suffix also appears, but there is no justification to use
it here. There is only one node in the example.


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pwm/clk-pwm.yaml b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
new file mode 100644
index 000000000000..4fb2c1baaad4
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
@@ -0,0 +1,45 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/clk-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Clock based PWM controller
+
+maintainers:
+  - Nikita Travkin <nikita@trvn.ru>
+
+description: |
+  Some systems have clocks that can be exposed to external devices.
+  (e.g. by muxing them to GPIO pins)
+  It's often possible to control duty-cycle of such clocks which makes them
+  suitable for generating PWM signal.
+
+allOf:
+  - $ref: pwm.yaml#
+
+properties:
+  compatible:
+    const: clk-pwm
+
+  clocks:
+    description: Clock used to generate the signal.
+    maxItems: 1
+
+  "#pwm-cells":
+    const: 2
+
+unevaluatedProperties: false
+
+required:
+  - clocks
+
+examples:
+  - |
+    pwm-flash {
+      compatible = "clk-pwm";
+      #pwm-cells = <2>;
+      clocks = <&gcc 0>;
+      pinctrl-names = "default";
+      pinctrl-0 = <&pwm_clk_flash_default>;
+    };