pwm: rockchip: Keep enabled PWMs running while probing
authorSimon South <simon@simonsouth.net>
Sat, 19 Sep 2020 19:33:06 +0000 (15:33 -0400)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 24 Sep 2020 07:18:08 +0000 (09:18 +0200)
commit457f74abbed060a0395f75ab5297f2d76cada516
tree2767782126d5919e6f24b90f7041e7fa11608f6b
parent0142ee3f2e88ef894427e926b3c8ad7c95964b01
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.

Fixes: cfc4c189bc70 ("pwm: Read initial hardware state at request time")
Signed-off-by: Simon South <simon@simonsouth.net>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-rockchip.c