* [PATCH 1/2] drm/sun4i: frontend: handle runtime resume failures
@ 2026-11-29 12:58 Jiawen Liu
0 siblings, 0 replies; only message in thread
From: Jiawen Liu @ 2026-11-29 12:58 UTC (permalink / raw)
To: Chen-Yu Tsai, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Jernej Skrabec,
Samuel Holland
Cc: dri-devel, linux-arm-kernel, linux-sunxi, linux-kernel
sun4i_frontend_runtime_resume() ignores failures from all three clock
enables. It can then touch the frontend registers and report a successful
resume without establishing the clocks required by the hardware. A reset
failure also returns without releasing clocks enabled during that resume.
Check each clock enable in order, unwind only the clocks already enabled,
and use the same unwind path for reset failure.
Fixes: dd0421f47505 ("drm/sun4i: Add a driver for the display frontend")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
drivers/gpu/drm/sun4i/sun4i_frontend.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c
index 7dc0a09bb3c54..13cad3a498b36 100644
--- a/drivers/gpu/drm/sun4i/sun4i_frontend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c
@@ -647,14 +647,22 @@ static int sun4i_frontend_runtime_resume(struct device *dev)
clk_set_rate(frontend->mod_clk, 300000000);
- clk_prepare_enable(frontend->bus_clk);
- clk_prepare_enable(frontend->mod_clk);
- clk_prepare_enable(frontend->ram_clk);
+ ret = clk_prepare_enable(frontend->bus_clk);
+ if (ret)
+ return ret;
+
+ ret = clk_prepare_enable(frontend->mod_clk);
+ if (ret)
+ goto err_bus;
+
+ ret = clk_prepare_enable(frontend->ram_clk);
+ if (ret)
+ goto err_mod;
ret = reset_control_reset(frontend->reset);
if (ret) {
dev_err(dev, "Couldn't reset our device\n");
- return ret;
+ goto err_ram;
}
regmap_update_bits(frontend->regs, SUN4I_FRONTEND_EN_REG,
@@ -664,6 +672,14 @@ static int sun4i_frontend_runtime_resume(struct device *dev)
sun4i_frontend_scaler_init(frontend);
return 0;
+
+err_ram:
+ clk_disable_unprepare(frontend->ram_clk);
+err_mod:
+ clk_disable_unprepare(frontend->mod_clk);
+err_bus:
+ clk_disable_unprepare(frontend->bus_clk);
+ return ret;
}
static int sun4i_frontend_runtime_suspend(struct device *dev)
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-29 14:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 12:58 [PATCH 1/2] drm/sun4i: frontend: handle runtime resume failures Jiawen Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®