pwm: rockchip: Enable APB clock during register access while probing
authorSimon South <simon@simonsouth.net>
Tue, 19 Jan 2021 16:12:05 +0000 (11:12 -0500)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 20 Jan 2021 17:12:31 +0000 (18:12 +0100)
commitd9b657a5cdbd960de35dee7e06473caf44a9016f
tree3e8e97ad8fd3d97f102f239320496a7b74566a91
parenta2bc9b21fd3f89b1f9a5df46427855dcf344e6e7
pwm: rockchip: Enable APB clock during register access while probing

Commit 457f74abbed0 ("pwm: rockchip: Keep enabled PWMs running while
probing") modified rockchip_pwm_probe() to access a PWM device's registers
directly to check whether or not the device is enabled, but did not also
change the function so it first enables the device's APB clock to be
certain the device can respond. This risks hanging the kernel on systems
with PWM devices that use more than a single clock.

Avoid this by enabling the device's APB clock before accessing its
registers (and disabling the clock when register access is complete).

Fixes: 457f74abbed0 ("pwm: rockchip: Keep enabled PWMs running while probing")
Reported-by: Thierry Reding <thierry.reding@gmail.com>
Suggested-by: Trent Piepho <tpiepho@gmail.com>
Signed-off-by: Simon South <simon@simonsouth.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-rockchip.c