public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Xilin Wu <sophon@radxa.com>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Nikita Travkin" <nikita@trvn.ru>,
	linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: pwm: clk-pwm: add optional GPIO and pinctrl properties
Date: Thu, 9 Apr 2026 16:51:17 +0100	[thread overview]
Message-ID: <20260409-delicate-simile-aeb987caa126@spud> (raw)
In-Reply-To: <20260406-clk-pwm-gpio-v1-1-40d2f3a20aff@radxa.com>

[-- Attachment #1: Type: text/plain, Size: 2939 bytes --]

On Mon, Apr 06, 2026 at 11:50:01PM +0800, Xilin Wu wrote:
> The clk-pwm driver cannot produce constant output levels (0% or 100%
> duty cycle, or disabled state) through the clock hardware alone - the
> actual pin level when the clock is off is undefined and
> hardware-dependent.
> 
> Document optional gpios, pinctrl-names, pinctrl-0, and pinctrl-1
> properties that allow the driver to switch the pin between clock
> function mux (for normal PWM output) and GPIO mode (to drive a
> deterministic constant level).
> 
> Signed-off-by: Xilin Wu <sophon@radxa.com>

This seems reasonable enough to me, but the PWM maintainers should
defintely make sure this fits the ideology of the device.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

> ---
>  Documentation/devicetree/bindings/pwm/clk-pwm.yaml | 36 +++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/clk-pwm.yaml b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
> index ec1768291503..2a0e3e02d27b 100644
> --- a/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
> +++ b/Documentation/devicetree/bindings/pwm/clk-pwm.yaml
> @@ -15,6 +15,11 @@ description: |
>    It's often possible to control duty-cycle of such clocks which makes them
>    suitable for generating PWM signal.
>  
> +  Optionally, a GPIO and pinctrl states can be provided. When a constant
> +  output level is needed (0%, 100%, or disabled), the pin is switched to
> +  GPIO mode to drive the level directly. For normal PWM output the pin is
> +  switched back to its clock function mux.
> +
>  allOf:
>    - $ref: pwm.yaml#
>  
> @@ -29,6 +34,26 @@ properties:
>    "#pwm-cells":
>      const: 2
>  
> +  gpios:
> +    description:
> +      Optional GPIO used to drive a constant level when the PWM output is
> +      disabled or set to 0% / 100% duty cycle. When provided, pinctrl states
> +      "default" (clock mux) and "gpio" must also be defined.
> +    maxItems: 1
> +
> +  pinctrl-names: true
> +
> +  pinctrl-0:
> +    description: Pin configuration for clock function mux (normal PWM).
> +    maxItems: 1
> +
> +  pinctrl-1:
> +    description: Pin configuration for GPIO mode (constant level output).
> +    maxItems: 1
> +
> +dependencies:
> +  gpios: [ pinctrl-0, pinctrl-1 ]
> +
>  unevaluatedProperties: false
>  
>  required:
> @@ -41,6 +66,15 @@ examples:
>        compatible = "clk-pwm";
>        #pwm-cells = <2>;
>        clocks = <&gcc 0>;
> -      pinctrl-names = "default";
> +    };
> +
> +  - |
> +    pwm {
> +      compatible = "clk-pwm";
> +      #pwm-cells = <2>;
> +      clocks = <&gcc 0>;
> +      pinctrl-names = "default", "gpio";
>        pinctrl-0 = <&pwm_clk_flash_default>;
> +      pinctrl-1 = <&pwm_clk_flash_gpio>;
> +      gpios = <&tlmm 32 0>;
>      };
> 
> -- 
> 2.53.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-04-09 15:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-06 15:50 [PATCH 0/2] pwm: clk-pwm: Add GPIO support for constant output levels Xilin Wu
2026-04-06 15:50 ` [PATCH 1/2] dt-bindings: pwm: clk-pwm: add optional GPIO and pinctrl properties Xilin Wu
2026-04-09 15:51   ` Conor Dooley [this message]
2026-04-06 15:50 ` [PATCH 2/2] pwm: clk-pwm: add GPIO and pinctrl support for constant output levels Xilin Wu
2026-04-06 16:20   ` Nikita Travkin
2026-04-08  9:59     ` Xilin Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260409-delicate-simile-aeb987caa126@spud \
    --to=conor@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=nikita@trvn.ru \
    --cc=robh@kernel.org \
    --cc=sophon@radxa.com \
    --cc=ukleinek@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox