drm/bridge: Add missing clk_disable_unprepare() in analogix_dp_resume()
Subsystems (3)
PATCH 1/1 drm/bridge: Add missing clk_disable_unprepare() in analogix_dp_resume()
Add the missing clk_disable_unprepare() before return from analogix_dp_resume() in the error handling case.
--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +1 -0
@@ -1887,6 +1887,7 @@ int analogix_dp_resume(struct analogix_dp_device *dp)if (dp->plat_data->panel) {if (drm_panel_prepare (dp->plat_data->panel)) {DRM_ERROR ("failed to setup the panel\n" ); +clk_disable_unprepare (dp->clock);return -EBUSY ; } }
Signature · 1 line
2.17.1
Quoted 6 lines · Zhang Zekun
Add the missing
clk_disable_unprepare()before return fromanalogix_dp_resume()in the error handling case.Fixes 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time")Signed-off-by Zhang Zekun <[email protected]>
Quoted 9 lines · Brian Norris
Quoted 6 lines · Zhang Zekun
Add the missing
clk_disable_unprepare()before return fromanalogix_dp_resume()in the error handling case.Fixes 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time")Signed-off-by Zhang Zekun <[email protected]>Reviewed-by Brian Norris <[email protected]>
Hmm, actually I'm going to have to retract that now that I've given it some more testing locally. I happen to have a system where I commonly hit this error case, and I'm thinking commit 211f276ed3d9 is actually wrong, and so we shouldn't be "fixing" its error handling -- we should be reverting it.
In particular, drm_panel_prepare()/drm_panel_unprepare() are *not* reference-counted APIs, and this is already managed by analogix_dp_bridge_disable(), which is called by the core DRM helpers during suspend. Thus, analogix_dp_suspend()/analogix_dp_resume() is serving to be an unwanted *second* client trying to {un,}prepare the panel.
The panel drivers tend to handle this OK to some extent, as they (e.g., panel-edp.c) guard against redundant operations, but *we* don't -- notice that analogix_dp_suspend() ignores drm_panel_unprepare() errors for one.
Also, I don't believe device management really handles resume() failures quite right; in the end, this patch ends up un-balancing the clk count on the RK3399 Gru-Bob systems I'm testing.
(Side note: every other bridge driver seems to ignore drm_panel_prepare() failures.)
It's possible this was correct (or at least, not terribly broken) back when it was written, but then, the DRM core frameworks have evolved since then. Today, I think we do not need to manage the panel state directly in suspend()/resume().
All in all:
Now separately, I have to figure out why I'm hitting this error case in the first place...
Hi,
Quoted 5 lines · Brian Norris
Hmm, actually I'm going to have to retract that now that I've given it some more testing locally. I happen to have a system where I commonly hit this error case, and I'm thinking commit
211f276ed3d9is actually wrong, and so we shouldn't be "fixing" its error handling -- we should be reverting it.
I've submitted that for review here:
https://lore.kernel.org/all/20220822180729.1.I8ac5abe3a4c1c6fd5c061686c6e883c22f69022c@changeid/
[PATCH] Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time"
I'd appreciate your review/testing.
(NB: I failed to honor the .mailmap for Andrzej Hajda.)
Quoted 2 lines
Now separately, I have to figure out why I'm hitting this error case in the first place...
FWIW, I captured the reason in point 3 on the above Revert. The pm_runtime_*() handling in the panel driver fails (-EACCES) because the bridge driver is resuming before the panel. (The DRM suspend/resume helpers handle things in the correct order.)
This problem is also resolved by simply reverting.
Brian
Hi,
Quoted 9 lines · Zhang Zekun
Add the missing
clk_disable_unprepare()before return fromanalogix_dp_resume()in the error handling case.Fixes 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time")Signed-off-by Zhang Zekun <[email protected]>--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 1 + 1 file changed, 1 insertion(+)
I'll snooze this and check back in approx 1 week. If someone else hasn't already applied it I'll plan to apply it to drm-misc-fixes.
-Doug