Hi
On Sun, Jul 04, 2021 at 07:33:09PM +0530, Jagan Teki wrote:
Finding panel_or_bridge might vary based on associated DSI devices like DSI panel, bridge, and I2C based DSI bridge.
DSI panels and bridges will invoke the host attach from probe in order to find the panel_or_bridge.
chipone_probe() dw_mipi_dsi_host_attach().start dw_mipi_dsi_panel_or_bridge() ...found the panel_or_bridge...
ltdc_encoder_init().start dw_mipi_dsi_bridge_attach().start dw_mipi_dsi_host_attach().start chipone_attach(). start
chipone_attach(). done dw_mipi_dsi_host_attach().done dw_mipi_dsi_bridge_attach(). done
ltdc_encoder_init().done
I2C based DSI bridge will invoke the drm_bridge_attach from bridge attach in order to find the panel_or_bridge.
ltdc_encoder_init().start dw_mipi_dsi_bridge_attach().start dw_mipi_dsi_panel_or_bridge() ...found the panel_or_bridge... dw_mipi_dsi_host_attach().start sn65dsi83_attach(). start
sn65dsi83_attach(). done dw_mipi_dsi_host_attach().done dw_mipi_dsi_bridge_attach(). done
ltdc_encoder_init().done
So, invoke the panel_or_bridge from host attach and bridge attach in order to find all possible DSI devices.
Working on linux-next-5.14-rc4 on px30-evb rockchip board. On top of this patch for px30 dsi I need to add:
From a0e0344b4cb4df3d97fac0e27e0aa76a2a191b0e Mon Sep 17 00:00:00 2001
From: Michael Trimarchi michael@amarulasolutions.com Date: Sun, 10 Oct 2021 23:56:20 +0200 Subject: [PATCH] drm: dw-mipi-dsi-rockchip: Avoid the attach before probe is completed
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 +++++++- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 12 ++++++++---- include/drm/bridge/dw_mipi_dsi.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 45f4515dda00..a5535f183af3 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -362,8 +362,14 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->device_found = true; }
+ /* + * NOTE: the dsi registration is implemented in + * platform driver, that to say dsi would be exist after + * probe is terminated. The call is done before the end of probe + * so we need to pass the dsi to the platform driver. + */ if (pdata->host_ops && pdata->host_ops->attach) { - ret = pdata->host_ops->attach(pdata->priv_data, device); + ret = pdata->host_ops->attach(pdata->priv_data, device, dsi); if (ret < 0) return ret; } diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index ec7729d18cb8..cf7c9cf11c9e 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -972,12 +972,15 @@ static const struct component_ops dw_mipi_dsi_rockchip_ops = { };
static int dw_mipi_dsi_rockchip_host_attach(void *priv_data, - struct mipi_dsi_device *device) + struct mipi_dsi_device *device, + struct dw_mipi_dsi *dmd) { struct dw_mipi_dsi_rockchip *dsi = priv_data; struct device *second; int ret;
+ dsi->dmd = dmd; + ret = component_add(dsi->dev, &dw_mipi_dsi_rockchip_ops); if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n", @@ -1027,6 +1030,7 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct dw_mipi_dsi_rockchip *dsi; struct resource *res; + struct dw_mipi_dsi *dmd; const struct rockchip_dw_dsi_chip_data *cdata = of_device_get_match_data(dev); int ret, i; @@ -1115,9 +1119,9 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) dsi->pdata.priv_data = dsi; platform_set_drvdata(pdev, dsi);
- dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata); - if (IS_ERR(dsi->dmd)) { - ret = PTR_ERR(dsi->dmd); + dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata); + if (IS_ERR(dmd)) { + ret = PTR_ERR(dmd); if (ret != -EPROBE_DEFER) DRM_DEV_ERROR(dev, "Failed to probe dw_mipi_dsi: %d\n", ret); diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index bda8aa7c2280..cf81f19806ad 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -41,7 +41,7 @@ struct dw_mipi_dsi_phy_ops {
struct dw_mipi_dsi_host_ops { int (*attach)(void *priv_data, - struct mipi_dsi_device *dsi); + struct mipi_dsi_device *dsi, struct dw_mipi_dsi *dmd); int (*detach)(void *priv_data, struct mipi_dsi_device *dsi); };
During the probing the sequence let arrive to attach before the rockchip driver terminate to be registered. Anyway the panel is not working at the moment for some timing issue
Michael