Re: [PATCH 2/3] drm/msm/dsi: move next bridge acquisition to dsi_bind
On 4/5/2024 11:15 AM, Dmitry Baryshkov wrote: On Fri, 5 Apr 2024 at 20:35, Abhinav Kumar wrote: On 3/9/2024 7:09 AM, Dmitry Baryshkov wrote: 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. But msm_dsi_modeset)init() is also called during msm_drm_bind() only. What issue are you suggesting will be fixed by moving this from msm_drm_bind() to dsi_bind()? The goal is to return as early as possible as not not cause probe-deferral loops. See commit fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER"). It discusses returning from probe() but the same logic applies to bind(). Understood. I was trying to make sure the purpose of the patch is that "deferral in component_bind() is better than component_master_bind()" But yes, overall that is better since the unbounding path will be more in the master case. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi.c | 16 drivers/gpu/drm/msm/dsi/dsi.h | 2 ++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 8 +--- 3 files changed, 19 insertions(+), 7 deletions(-) Reviewed-by: Abhinav Kumar
Re: [PATCH 2/3] drm/msm/dsi: move next bridge acquisition to dsi_bind
On Fri, 5 Apr 2024 at 20:35, Abhinav Kumar wrote: > > > > On 3/9/2024 7:09 AM, Dmitry Baryshkov wrote: > > 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. > > > > But msm_dsi_modeset)init() is also called during msm_drm_bind() only. > > What issue are you suggesting will be fixed by moving this from > msm_drm_bind() to dsi_bind()? The goal is to return as early as possible as not not cause probe-deferral loops. See commit fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER"). It discusses returning from probe() but the same logic applies to bind(). > > Signed-off-by: Dmitry Baryshkov > > --- > > drivers/gpu/drm/msm/dsi/dsi.c | 16 > > drivers/gpu/drm/msm/dsi/dsi.h | 2 ++ > > drivers/gpu/drm/msm/dsi/dsi_manager.c | 8 +--- > > 3 files changed, 19 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c > > index 37c4c07005fe..38f10f7a10d3 100644 > > --- a/drivers/gpu/drm/msm/dsi/dsi.c > > +++ b/drivers/gpu/drm/msm/dsi/dsi.c > > @@ -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(_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; > > diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h > > index 2ad9a842c678..0adef65be1de 100644 > > --- a/drivers/gpu/drm/msm/dsi/dsi.h > > +++ b/drivers/gpu/drm/msm/dsi/dsi.h > > @@ -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; > > > > diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c > > b/drivers/gpu/drm/msm/dsi/dsi_manager.c > > index a7c7f85b73e4..b7c52b14c790 100644 > > --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c > > +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c > > @@ -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(_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; > > -- With best wishes Dmitry
Re: [PATCH 2/3] drm/msm/dsi: move next bridge acquisition to dsi_bind
On 3/9/2024 7:09 AM, Dmitry Baryshkov wrote: 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. But msm_dsi_modeset)init() is also called during msm_drm_bind() only. What issue are you suggesting will be fixed by moving this from msm_drm_bind() to dsi_bind()? Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi.c | 16 drivers/gpu/drm/msm/dsi/dsi.h | 2 ++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 8 +--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 37c4c07005fe..38f10f7a10d3 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -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(_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; diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 2ad9a842c678..0adef65be1de 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -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; diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index a7c7f85b73e4..b7c52b14c790 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -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(_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;