aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <[email protected]>2024-06-19 20:21:49 +0200
committerRobert Foss <[email protected]>2024-06-27 11:52:00 +0200
commit2d192f4a3acc1c6fe47456e13327701e62074c95 (patch)
treef7e7381c82fa058f78543921633fe7dc1a13ade8
parentc91b5bd7b1f40c46f3aaba460169457db1a78e5e (diff)
drm/bridge: analogix_dp: register AUX bus after enabling runtime PM
AUX transactions require the controller to be in working state and take a runtime PM reference. To avoid potential races beween the first transactions on the bus and runtime PM being set up, move the AUX registration behind the runtime PM setup. Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Robert Foss <[email protected]> Tested-by: Heiko Stuebner <[email protected]> Signed-off-by: Robert Foss <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/bridge/analogix/analogix_dp_core.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 31fa67d966c7..ae79802b62bb 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1721,31 +1721,34 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
dp->drm_dev = drm_dev;
dp->encoder = dp->plat_data->encoder;
+ pm_runtime_use_autosuspend(dp->dev);
+ pm_runtime_set_autosuspend_delay(dp->dev, 100);
+ pm_runtime_enable(dp->dev);
+
dp->aux.name = "DP-AUX";
dp->aux.transfer = analogix_dpaux_transfer;
dp->aux.dev = dp->dev;
dp->aux.drm_dev = drm_dev;
ret = drm_dp_aux_register(&dp->aux);
- if (ret)
- return ret;
-
- pm_runtime_use_autosuspend(dp->dev);
- pm_runtime_set_autosuspend_delay(dp->dev, 100);
- pm_runtime_enable(dp->dev);
+ if (ret) {
+ DRM_ERROR("failed to register AUX (%d)\n", ret);
+ goto err_disable_pm_runtime;
+ }
ret = analogix_dp_create_bridge(drm_dev, dp);
if (ret) {
DRM_ERROR("failed to create bridge (%d)\n", ret);
- goto err_disable_pm_runtime;
+ goto err_unregister_aux;
}
return 0;
+err_unregister_aux:
+ drm_dp_aux_unregister(&dp->aux);
err_disable_pm_runtime:
pm_runtime_dont_use_autosuspend(dp->dev);
pm_runtime_disable(dp->dev);
- drm_dp_aux_unregister(&dp->aux);
return ret;
}