vop2_enable() acquires the runtime PM reference before enabling the core
clocks, and its error path releases them in the reverse order.  However,
vop2_disable() drops the runtime PM reference first, potentially
powering off the VOP power domain while the core clocks are still
running.

Make the teardown mirror the bring-up sequence by disabling the core
clocks before calling pm_runtime_put_sync().

Reported-by: Sashiko <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Cristian Ciocaltea <[email protected]>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index e0caea93a896..bc14ca9d598d 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -955,11 +955,11 @@ static void vop2_disable(struct vop2 *vop2)
 {
        rockchip_drm_dma_detach_device(vop2->drm, vop2->dev);
 
-       pm_runtime_put_sync(vop2->dev);
-
        regcache_drop_region(vop2->map, 0, vop2_regmap_config.max_register);
 
        vop2_core_clks_disable_unprepare(vop2);
+
+       pm_runtime_put_sync(vop2->dev);
 }
 
 static bool vop2_vp_dsp_lut_is_enabled(struct vop2_video_port *vp)

-- 
2.55.0

Reply via email to