drm/bridge: anx7625: Register and attach our DSI device at probe
authorMaxime Ripard <maxime@cerno.tech>
Mon, 25 Oct 2021 15:15:19 +0000 (17:15 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 27 Oct 2021 20:07:56 +0000 (22:07 +0200)
In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-5-maxime@cerno.tech
drivers/gpu/drm/bridge/analogix/anx7625.c

index 4adeb2b..d031765 100644 (file)
@@ -1367,12 +1367,6 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge,
                return -ENODEV;
        }
 
-       err = anx7625_attach_dsi(ctx);
-       if (err) {
-               DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", err);
-               return err;
-       }
-
        if (ctx->pdata.panel_bridge) {
                err = drm_bridge_attach(bridge->encoder,
                                        ctx->pdata.panel_bridge,
@@ -1845,10 +1839,24 @@ static int anx7625_i2c_probe(struct i2c_client *client,
        platform->bridge.type = DRM_MODE_CONNECTOR_eDP;
        drm_bridge_add(&platform->bridge);
 
+       ret = anx7625_attach_dsi(platform);
+       if (ret) {
+               DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", ret);
+               goto unregister_bridge;
+       }
+
        DRM_DEV_DEBUG_DRIVER(dev, "probe done\n");
 
        return 0;
 
+unregister_bridge:
+       drm_bridge_remove(&platform->bridge);
+
+       if (!platform->pdata.low_power_mode)
+               pm_runtime_put_sync_suspend(&client->dev);
+
+       anx7625_unregister_i2c_dummy_clients(platform);
+
 free_wq:
        if (platform->workqueue)
                destroy_workqueue(platform->workqueue);