pwm: rockchip: Keep enabled PWMs running while probing
Subsystems (2)
PATCH 1/1 pwm: rockchip: Keep enabled PWMs running while probing
Following commit cfc4c189bc70 ("pwm: Read initial hardware state at request time") the Rockchip PWM driver can no longer assume a device's pwm_state structure has been populated after a call to pwmchip_add(). Consequently, the test in rockchip_pwm_probe() intended to prevent the driver from stopping PWM devices already enabled by the bootloader no longer functions reliably and this can lead to the kernel hanging during startup, particularly on devices like the Pinebook Pro that use a PWM-controlled backlight for their display.
Avoid this by querying the device directly at probe time to determine whether or not it is enabled.
--- drivers/pwm/pwm-rockchip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pwm/pwm-rockchip.c +4 -1
@@ -288,6 +288,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)const struct of_device_id *id;struct rockchip_pwm_chip *pc;struct resource *r; +u32 enable_conf, ctrl;int ret, count; id =of_match_device (rockchip_pwm_dt_ids, &pdev->dev);
@@ -362,7 +363,9 @@ static int rockchip_pwm_probe(struct platform_device *pdev) }/* Keep the PWM clk enabled if the PWM appears to be up and running. */ -if (!pwm_is_enabled (pc->chip.pwms)) + enable_conf = pc->data->enable_conf; + ctrl =readl_relaxed (pc->base + pc->data->regs.ctrl); +if ((ctrl & enable_conf) != enable_conf)clk_disable (pc->clk);return 0 ;
Signature · 7 lines
2.28.0 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Heiko Stübner
maintainerHi Simon,
Am Freitag, 18. September 2020, 22:48:25 CEST schrieb Simon South:
Quoted 9 lines
Following commit
cfc4c189bc70("pwm: Read initial hardware state at request time") the Rockchip PWM driver can no longer assume a device'spwm_statestructure has been populated after a call topwmchip_add(). Consequently, the test inrockchip_pwm_probe()intended to prevent the driver from stopping PWM devices already enabled by the bootloader no longer functions reliably and this can lead to the kernel hanging during startup, particularly on devices like the Pinebook Pro that use a PWM-controlled backlight for their display.
Quoted 4 lines
Avoid this by querying the device directly at probe time to determine whether or not it is enabled.
Signed-off-by Simon South <[email protected]>
On first glance this looks like a good catch but there is a bit of housekeeping missing.
The patch should get a fixes tag like
Can you resend the patch and include relevant other parties like you get from 'scripts/get_maintainer.pl -f drivers/pwm/pwm-rockchip.c' like
Thierry Reding <[email protected]> (maintainer:PWM SUBSYSTEM) "Uwe Kleine-König" <[email protected]> (reviewer:PWM SUBSYSTEM) Lee Jones <[email protected]> (maintainer:PWM SUBSYSTEM) [email protected] (open list:PWM SUBSYSTEM)
Thanks
Heiko
Quoted 18 lines
--- drivers/pwm/pwm-rockchip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pwm/pwm-rockchip.c +1
-0@@ -288,6 +288,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)const struct of_device_id *id;struct rockchip_pwm_chip *pc;struct resource *r; +u32 enable_conf, ctrl;int ret, count; id =of_match_device (rockchip_pwm_dt_ids, &pdev->dev);
drivers/pwm/pwm-rockchip.c static int rockchip_pwm_probe(struct platform_device *pdev) · line 371
Quoted 10 lines
drivers/pwm/pwm-rockchip.c +3
-1@@ -362,7 +363,9 @@ static int rockchip_pwm_probe(struct platform_device *pdev) }/* Keep the PWM clk enabled if the PWM appears to be up and running. */ -if (!pwm_is_enabled (pc->chip.pwms)) + enable_conf = pc->data->enable_conf; + ctrl =readl_relaxed (pc->base + pc->data->regs.ctrl); +if ((ctrl & enable_conf) != enable_conf)clk_disable (pc->clk);return 0 ;
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip