[PATCH 3/3] drm/bridge: analogix_dp: Propagate errors from runtime resume

From: Nikita Zhandarovich

Date: Wed Nov 25 2026 - 06:44:05 EST


Stop controller initialization when platform or PHY power-on fails and
return the original error to the resume caller. Unwind the platform
power callback only after it has completed successfully, then release
the controller clock. Do not call phy_power_off() after a failed
phy_power_on(), since no successful PHY power reference was acquired.

Also stop and unwind platform power if setting the PHY mode fails.

Fixes: 3424e3a4f844 ("drm: bridge: analogix/dp: split exynos dp driver to bridge directory")
Fixes: 2c0883459ed6 ("drm/bridge: analogix_dp: Add support for phy configuration.")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@xxxxxxxxxx>
---
Depends on patches 1 and 2 of this series, also on Alexandre Marquet's
Exynos pipe-clock conversion [1], or Marek Szyprowski's equivalent [2].
Without [1] or [2], propagating errors from old Exynos power_on() step
may break AUX access.

This is an updated version of the patch suggested by "Pengpeng Hou"
<pengpeng@xxxxxxxxxxx> in [3]. It takes into account issues brought
up by Sashiko, specifically, an issue of possible unbalanced clock
disables. This patch was prepared using dependency [1].

[1] https://lore.kernel.org/all/20261027-drm-misc-next-manta-auxbus-v1-2-3a45c3cf531d@xxxxxxxxxxxx/
[2] https://lore.kernel.org/all/20261119223843.3694307-1-m.szyprowski@xxxxxxxxxxx/
[3] https://lore.kernel.org/all/20260828091334.5793-1-pengpeng@xxxxxxxxxxx/

.../drm/bridge/analogix/analogix_dp_core.c | 23 +++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 9d77c1d54a6d..3326b51aaeb5 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1538,15 +1538,30 @@ int analogix_dp_resume(struct analogix_dp_device *dp)
return ret;
}

- if (dp->plat_data->power_on)
- dp->plat_data->power_on(dp->plat_data);
+ if (dp->plat_data->power_on) {
+ ret = dp->plat_data->power_on(dp->plat_data);
+ if (ret)
+ goto err_disable_clk;
+ }

- phy_set_mode(dp->phy, PHY_MODE_DP);
- phy_power_on(dp->phy);
+ ret = phy_set_mode(dp->phy, PHY_MODE_DP);
+ if (ret)
+ goto err_power_off;
+
+ ret = phy_power_on(dp->phy);
+ if (ret)
+ goto err_power_off;

analogix_dp_init_dp(dp);

return 0;
+
+err_power_off:
+ if (dp->plat_data->power_on && dp->plat_data->power_off)
+ dp->plat_data->power_off(dp->plat_data);
+err_disable_clk:
+ clk_disable_unprepare(dp->clock);
+ return ret;
}
EXPORT_SYMBOL_GPL(analogix_dp_resume);

--
2.43.0