drm/msm/dsi: move next bridge acquisition to dsi_bind
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sat, 9 Mar 2024 15:09:06 +0000 (17:09 +0200)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 22 Apr 2024 13:22:50 +0000 (16:22 +0300)
Currently the MSM DSI driver looks for the next bridge during
msm_dsi_modeset_init(). If the bridge is not registered at that point,
this might result in -EPROBE_DEFER, which can be problematic that late
during the device probe process. Move next bridge acquisition to the
dsi_bind state so that probe deferral is returned as early as possible.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/582210/
Link: https://lore.kernel.org/r/20240309-fd-dsi-cleanup-bridges-v1-2-962ebdba82ed@linaro.org
drivers/gpu/drm/msm/dsi/dsi.c
drivers/gpu/drm/msm/dsi/dsi.h
drivers/gpu/drm/msm/dsi/dsi_manager.c

index 37c4c07005feb0419788ad36cdac2654ba08cc2e..38f10f7a10d34a001536b268ebfec0c1a574b38c 100644 (file)
@@ -120,6 +120,22 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
        struct msm_drm_private *priv = dev_get_drvdata(master);
        struct msm_dsi *msm_dsi = dev_get_drvdata(dev);
 
+       /*
+        * Next bridge doesn't exist for the secondary DSI host in a bonded
+        * pair.
+        */
+       if (!msm_dsi_is_bonded_dsi(msm_dsi) ||
+           msm_dsi_is_master_dsi(msm_dsi)) {
+               struct drm_bridge *ext_bridge;
+
+               ext_bridge = devm_drm_of_get_bridge(&msm_dsi->pdev->dev,
+                                                   msm_dsi->pdev->dev.of_node, 1, 0);
+               if (IS_ERR(ext_bridge))
+                       return PTR_ERR(ext_bridge);
+
+               msm_dsi->next_bridge = ext_bridge;
+       }
+
        priv->dsi[msm_dsi->id] = msm_dsi;
 
        return 0;
index 2ad9a842c67820828525028c63681cc10402f980..0adef65be1ded718fd1171de3a65a2eb62b208a3 100644 (file)
@@ -38,6 +38,8 @@ struct msm_dsi {
        struct mipi_dsi_host *host;
        struct msm_dsi_phy *phy;
 
+       struct drm_bridge *next_bridge;
+
        struct device *phy_dev;
        bool phy_enabled;
 
index a7c7f85b73e4d272d9ff1bad9936a19d47fdf6f3..b7c52b14c7909849d19e7c45f600f0355626ca61 100644 (file)
@@ -464,18 +464,12 @@ int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge)
        struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
        struct drm_device *dev = msm_dsi->dev;
        struct drm_encoder *encoder;
-       struct drm_bridge *ext_bridge;
        struct drm_connector *connector;
        int ret;
 
-       ext_bridge = devm_drm_of_get_bridge(&msm_dsi->pdev->dev,
-                                           msm_dsi->pdev->dev.of_node, 1, 0);
-       if (IS_ERR(ext_bridge))
-               return PTR_ERR(ext_bridge);
-
        encoder = int_bridge->encoder;
 
-       ret = drm_bridge_attach(encoder, ext_bridge, int_bridge,
+       ret = drm_bridge_attach(encoder, msm_dsi->next_bridge, int_bridge,
                        DRM_BRIDGE_ATTACH_NO_CONNECTOR);
        if (ret)
                return ret;