Hi Nikita,

On 11/25/2026 11:39 PM, Nikita Zhandarovich wrote:
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: 73f613908eb1 ("drm/bridge: analogix_dp: move platform and PHY power handling 
into runtime PM")
Fixes: 2c0883459ed6 ("drm/bridge: analogix_dp: Add support for phy 
configuration.")
Signed-off-by: Nikita Zhandarovich <[email protected]>
---
v1 -> v2: Improve on chosen Fixes: tag to mitigate Sashiko's concerns.

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. Neither [1] or [2] is a part of this series on
purpose - therefore, these 3 patches must only be applied after
improvement [1] or [2] is committed.

This is an updated version of the patch suggested by "Pengpeng Hou"
<[email protected]> 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-3a45c3cf5...@a-marquet.fr/
[2] 
https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/

  .../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);

I think we would rather not see power_off fail, as that makes the
error handling more complicated. Now that Marek has removed the
power_off callback from the Exynos DP driver in [2], I think it is
time to make power_off return void. I am quite sure the Rockchip
side can accept that as well.

Note that your err_power_off path already ignores the return value
of power_off, which also suggests it is not expected to fail.

Could you add this as a separate patch in your series too?

Best regards,
Damon

Reply via email to