[PATCH v2 03/14] drm/bridge: analogix_dp: register AUX bus after enabling runtime PM
Lucas Stach
l.stach at pengutronix.de
Wed Jun 19 11:21:49 PDT 2024
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 <l.stach at pengutronix.de>
Reviewed-by: Robert Foss <rfoss at kernel.org>
Tested-by: Heiko Stuebner <heiko at sntech.de> (rk3288-veyron and rk3399-gru)
---
.../drm/bridge/analogix/analogix_dp_core.c | 19 +++++++++++--------
1 file 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;
}
--
2.39.2
More information about the linux-arm-kernel
mailing list