[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7uuuqhmkmmucmeeo5fybzld62rybyq6fjxwqqnxqr6eufis2ze@xfc2owdzfcs5>
Date: Tue, 21 Oct 2025 12:19:39 +0200
From: Uwe Kleine-König <ukleinek@...nel.org>
To: Martyn Welch <martyn.welch@...labora.com>
Cc: kernel@...labora.com,
Sebastian Reichel <sebastian.reichel@...labora.com>, linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
devicetree@...r.kernel.org, Krzysztof Kozlowski <krzk@...nel.org>
Subject: Re: [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM
Hello,
[adding maintainers of drivers/of and Krzysztof to Cc:]
On Thu, Oct 09, 2025 at 05:24:44PM +0100, Martyn Welch wrote:
> The PWM currently functions, however if we try to utilise the pwn in a
> device tree, for example as a pwm-backlight:
>
> lcd_bl: backlight {
> compatible = "pwm-backlight";
> pwms = <&mtu3 3 833333>;
> ...
>
> This fails:
>
> [ 15.603948] platform backlight: deferred probe pending: pwm-backlight: unable to request PWM
>
> The PWM driver forms part of the Renesas Multi-Function Timer Pulse Unit
> 3. The PWM does not have a DT node of it's own. Share the DT node of the
> parent MFD device, so that the PWM channels can be referenced via phandles.
>
> Co-developed-by: Sebastian Reichel <sebastian.reichel@...labora.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@...labora.com>
> Signed-off-by: Martyn Welch <martyn.welch@...labora.com>
> ---
> drivers/pwm/pwm-rz-mtu3.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/pwm/pwm-rz-mtu3.c b/drivers/pwm/pwm-rz-mtu3.c
> index ab39bd37edafc..5825875fa0128 100644
> --- a/drivers/pwm/pwm-rz-mtu3.c
> +++ b/drivers/pwm/pwm-rz-mtu3.c
> @@ -523,6 +523,12 @@ static int rz_mtu3_pwm_probe(struct platform_device *pdev)
> if (ret < 0)
> return ret;
>
> + /*
> + * There is only one DT node, get it from the parent MFD device, so
> + * that the PWM channels can be referenced via phandles
> + */
> + dev->of_node = dev->parent->of_node;
> +
I (very quickly) talked to Krzysztof about this. He said that
of_node_get() should probably be used here. I wonder if
device_add_of_node() is the right function to use (which uses
of_node_get(), also handles fwnode and implements some safeguards).
> chip->ops = &rz_mtu3_pwm_ops;
> ret = devm_pwmchip_add(&pdev->dev, chip);
> if (ret)
Best regards
Uwe
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists