diff mbox series

[V4,1/2] dt-bindings: pwm: Add pwm-gpio

Message ID 20240204220851.4783-2-wahrenst@gmx.net
State Deferred
Headers show
Series [V4,1/2] dt-bindings: pwm: Add pwm-gpio | expand

Commit Message

Stefan Wahren Feb. 4, 2024, 10:08 p.m. UTC
From: Nicola Di Lieto <nicola.dilieto@gmail.com>

Add bindings for PWM modulated by GPIO.

Signed-off-by: Nicola Di Lieto <nicola.dilieto@gmail.com>
Co-developed-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../devicetree/bindings/pwm/pwm-gpio.yaml     | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-gpio.yaml

--
2.34.1

Comments

Linus Walleij Feb. 4, 2024, 10:47 p.m. UTC | #1
On Sun, Feb 4, 2024 at 11:09 PM Stefan Wahren <wahrenst@gmx.net> wrote:

> From: Nicola Di Lieto <nicola.dilieto@gmail.com>
>
> Add bindings for PWM modulated by GPIO.
>
> Signed-off-by: Nicola Di Lieto <nicola.dilieto@gmail.com>
> Co-developed-by: Stefan Wahren <wahrenst@gmx.net>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Dhruva Gole Feb. 5, 2024, 5:58 a.m. UTC | #2
On Feb 04, 2024 at 23:08:50 +0100, Stefan Wahren wrote:
> From: Nicola Di Lieto <nicola.dilieto@gmail.com>
> 
> Add bindings for PWM modulated by GPIO.
> 
> Signed-off-by: Nicola Di Lieto <nicola.dilieto@gmail.com>
> Co-developed-by: Stefan Wahren <wahrenst@gmx.net>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  .../devicetree/bindings/pwm/pwm-gpio.yaml     | 42 +++++++++++++++++++
>  1 file changed, 42 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pwm-gpio.yaml
> 

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Krzysztof Kozlowski Feb. 5, 2024, 7:44 a.m. UTC | #3
On 04/02/2024 23:08, Stefan Wahren wrote:
> From: Nicola Di Lieto <nicola.dilieto@gmail.com>
> 
> Add bindings for PWM modulated by GPIO.
> 
> Signed-off-by: Nicola Di Lieto <nicola.dilieto@gmail.com>
> Co-developed-by: Stefan Wahren <wahrenst@gmx.net>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---

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

Best regards,
Krzysztof
Uwe Kleine-König Feb. 5, 2024, 9:15 a.m. UTC | #4
Hello,

On Sun, Feb 04, 2024 at 11:08:50PM +0100, Stefan Wahren wrote:
> +  "#pwm-cells":
> +    const: 3
> +
> +  gpios:
> +    description:
> +      GPIO to be modulated
> +    maxItems: 1

Given that we have 3 PWM cells (so there is an u32 that specifies the
pwm_chip's line number) it would be obvious to allow several GPIOs. But
I guess we can extend this easily if and when the need arises.

Otherwise I'm happy with this patch.

Best regards
Uwe
Stefan Wahren Feb. 5, 2024, 11:58 a.m. UTC | #5
Hi Uwe,

Am 05.02.24 um 10:15 schrieb Uwe Kleine-König:
> Hello,
>
> On Sun, Feb 04, 2024 at 11:08:50PM +0100, Stefan Wahren wrote:
>> +  "#pwm-cells":
>> +    const: 3
>> +
>> +  gpios:
>> +    description:
>> +      GPIO to be modulated
>> +    maxItems: 1
> Given that we have 3 PWM cells (so there is an u32 that specifies the
> pwm_chip's line number) it would be obvious to allow several GPIOs. But
> I guess we can extend this easily if and when the need arises.
yes this is a limitation in order to keep it simple.

Regards
>
> Otherwise I'm happy with this patch.
>
> Best regards
> Uwe
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pwm/pwm-gpio.yaml b/Documentation/devicetree/bindings/pwm/pwm-gpio.yaml
new file mode 100644
index 000000000000..1a1281e0fbd7
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pwm-gpio.yaml
@@ -0,0 +1,42 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/pwm-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic software PWM for modulating GPIOs
+
+maintainers:
+  - Stefan Wahren <wahrenst@gmx.net>
+
+allOf:
+  - $ref: pwm.yaml#
+
+properties:
+  compatible:
+    const: pwm-gpio
+
+  "#pwm-cells":
+    const: 3
+
+  gpios:
+    description:
+      GPIO to be modulated
+    maxItems: 1
+
+required:
+  - compatible
+  - "#pwm-cells"
+  - gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    pwm {
+        #pwm-cells = <3>;
+        compatible = "pwm-gpio";
+        gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+    };