The pipe (FIMD -> DP video) clock on Exynos is switched from the
analogix_dp runtime PM callbacks via plat_data->power_on()/power_off(),
which require the encoder to be still attached to a CRTC. The driver
relies on pm_runtime_put_sync() in analogix_dp_bridge_disable() to run
the runtime suspend callback immediately, while the encoder->crtc link
is still valid.

The device uses autosuspend, so whether put_sync() suspends the device
right away depends on the last_busy timestamp. Since commit f2b556e3dad6
("PM: runtime: Update last_busy before calling rpm_suspend() in
rpm_idle()") last_busy is refreshed in rpm_idle(), so
pm_runtime_put_sync() now only schedules an autosuspend 100ms later.
During system suspend this means that the device is runtime suspended
only by pm_runtime_force_suspend(), when encoder->crtc is already NULL,
so the FIMD DP clock is never disabled and its cached state gets out of
sync with the hardware after FIMD loses power. On resume the clock is
not re-enabled and enabling the bridge fails on Exynos5250 Snow:

  exynos-dp 145b0000.dp-controller: Timeout of slave video streamclk ok
  exynos-dp 145b0000.dp-controller: unable to config video
  [drm:analogix_dp_bridge_atomic_enable [analogix_dp]] *ERROR* dp commit error, 
ret = -110
  exynos-dp 145b0000.dp-controller: failed to set bridge, retry: 0
  ...
  exynos-dp 145b0000.dp-controller: too many times retry set bridge, give it up

Use pm_runtime_put_sync_suspend() in the bridge disable path and in the
analogix_dp_set_bridge() error path, so the hardware is powered down
immediately when the display is turned off, regardless of the
autosuspend delay used for the AUX channel transfers.

Fixes: f28dd5075675 ("drm/bridge: analogix_dp: Enable autosuspend")
Signed-off-by: Marek Szyprowski <[email protected]>
---
This patch has been developed with LLM assistance and have been tested
on the real Exynos5250-based Snow Chromebook device.

Best regards
Marek Szyprowski, PhD
Samsung R&D Institute Poland
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 8bb4c48aa3b4..022acb962b7c 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1021,7 +1021,7 @@ static int analogix_dp_set_bridge(struct 
analogix_dp_device *dp)
        return 0;
 
 out_dp_init:
-       pm_runtime_put_sync(dp->dev);
+       pm_runtime_put_sync_suspend(dp->dev);
 
        return ret;
 }
@@ -1163,7 +1163,7 @@ static void analogix_dp_bridge_disable(struct drm_bridge 
*bridge)
 
        analogix_dp_set_analog_power_down(dp, POWER_ALL, 1);
 
-       pm_runtime_put_sync(dp->dev);
+       pm_runtime_put_sync_suspend(dp->dev);
 
        dp->fast_train_enable = false;
        dp->psr_supported = false;
-- 
2.43.0

Reply via email to