From d420d65bec8435e3e1198fbb7aaf3af04d10111b Mon Sep 17 00:00:00 2001 From: Zhibin Huang Date: Mon, 29 Apr 2024 09:28:16 +0800 Subject: [PATCH] drm/rockchip: dsi2: optimize drive probe process Put "component_add" in the attach call so that dsi host and dsi device (panel or bridge) can be regarded as a component as a whole. dsi calls "mipi_dsi_host_register" so that the panel executes the probe process or the bridge successfully executes "mipi_dsi_device_register_full" during the probe process. The panel or bridge triggers "component_add" by calling mipi_dsi_attach after the probe is successful. Through the above modifications, you can avoid dsi defer probe infinitely due to panel configuration errors. Type: Fix Redmine ID: N/A Associated modifications: N/A Test: N/A Signed-off-by: Zhibin Huang Change-Id: Ic8782e9902a6133990fca728ab12e530e50b6d68 --- drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c index afdcd5ad6fd4..f14c47ddcdff 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c @@ -1582,12 +1582,19 @@ static int dw_mipi_dsi2_host_attach(struct mipi_dsi_host *host, dsi2->format = device->format; dsi2->mode_flags = device->mode_flags; - return 0; + return component_add(dsi2->dev, &dw_mipi_dsi2_ops); } static int dw_mipi_dsi2_host_detach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { + struct dw_mipi_dsi2 *dsi2 = host_to_dsi2(host); + + if (dsi2->master) + return 0; + + component_del(dsi2->dev, &dw_mipi_dsi2_ops); + return 0; } @@ -1828,7 +1835,7 @@ static int dw_mipi_dsi2_probe(struct platform_device *pdev) return ret; } - return component_add(&pdev->dev, &dw_mipi_dsi2_ops); + return 0; } static int dw_mipi_dsi2_remove(struct platform_device *pdev)