* [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM
@ 2025-10-09 16:24 Martyn Welch
2025-10-21 10:19 ` Uwe Kleine-König
2025-12-24 6:33 ` Uwe Kleine-König
0 siblings, 2 replies; 5+ messages in thread
From: Martyn Welch @ 2025-10-09 16:24 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: kernel, Martyn Welch, Sebastian Reichel, linux-pwm, linux-kernel
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@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.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;
+
chip->ops = &rz_mtu3_pwm_ops;
ret = devm_pwmchip_add(&pdev->dev, chip);
if (ret)
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM
2025-10-09 16:24 [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM Martyn Welch
@ 2025-10-21 10:19 ` Uwe Kleine-König
2025-10-21 10:47 ` Krzysztof Kozlowski
2025-12-24 6:33 ` Uwe Kleine-König
1 sibling, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2025-10-21 10:19 UTC (permalink / raw)
To: Martyn Welch
Cc: kernel, Sebastian Reichel, linux-pwm, linux-kernel, Rob Herring,
Saravana Kannan, devicetree, Krzysztof Kozlowski
[-- Attachment #1: Type: text/plain, Size: 1922 bytes --]
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@collabora.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM
2025-10-21 10:19 ` Uwe Kleine-König
@ 2025-10-21 10:47 ` Krzysztof Kozlowski
2025-11-04 11:23 ` Uwe Kleine-König
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2025-10-21 10:47 UTC (permalink / raw)
To: Uwe Kleine-König, Martyn Welch
Cc: kernel, Sebastian Reichel, linux-pwm, linux-kernel, Rob Herring,
Saravana Kannan, devicetree
On 21/10/2025 12:19, Uwe Kleine-König wrote:
>> 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).
I am not so sure about device_add_of_node(). You do not need to
get_device(), because reference is already hold. Although setting
dev->fwnode might make sense... But, not that important I think, works
with me.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM
2025-10-21 10:47 ` Krzysztof Kozlowski
@ 2025-11-04 11:23 ` Uwe Kleine-König
0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2025-11-04 11:23 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Martyn Welch, kernel, Sebastian Reichel, linux-pwm, linux-kernel,
Rob Herring, Saravana Kannan, devicetree
[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]
Hello,
On Tue, Oct 21, 2025 at 12:47:52PM +0200, Krzysztof Kozlowski wrote:
> On 21/10/2025 12:19, Uwe Kleine-König wrote:
> >> 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).
>
>
> I am not so sure about device_add_of_node(). You do not need to
> get_device(), because reference is already hold. Although setting
> dev->fwnode might make sense... But, not that important I think, works
> with me.
Note that device_add_of_node() only holds the get_device() reference
temporarily as it calls put_device() before returning. So that's only to
assert that the device doesn't disappear in-flight. That "locking" might
not be needed here, but it also doesn't do any harm (apart from a minor
runtime overhead).
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM
2025-10-09 16:24 [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM Martyn Welch
2025-10-21 10:19 ` Uwe Kleine-König
@ 2025-12-24 6:33 ` Uwe Kleine-König
1 sibling, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2025-12-24 6:33 UTC (permalink / raw)
To: Martyn Welch; +Cc: kernel, Sebastian Reichel, linux-pwm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]
Hello,
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@collabora.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
This thread didn't see action for a time and the patch isn't suitable to
go in as is. So I'm discarding this patch from patchwork and my inbox.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-12-24 6:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 16:24 [PATCH] pwm: rz-mtu3: Share parent device node to MTU3 PWM Martyn Welch
2025-10-21 10:19 ` Uwe Kleine-König
2025-10-21 10:47 ` Krzysztof Kozlowski
2025-11-04 11:23 ` Uwe Kleine-König
2025-12-24 6:33 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox