From a5ee6dd0bd96acd1a9e25d3b214560f8bb394d11 Mon Sep 17 00:00:00 2001 From: Guochun Huang Date: Fri, 31 May 2024 14:45:37 +0800 Subject: [PATCH] drm/rockchip: dsi2: add slave to component in dual-channel mode Fixes: d420d65bec84 ("drm/rockchip: dsi2: optimize drive probe process") rockchip drm will Registers a new aggregate driver consisting of the components added to @match by calling one of the component_match_add() functions. Once all components in @match are available, it will be assembled by calling &component_master_ops.bind(rockchip_drm_ops.rockchip_drm_bind) from @ops. if the dsi->slave is not added into component, the binding status of the device under the display subsystem becomes abnormal as follows: cat /sys/kernel/debug/device_component/display-subsystem aggregate_device name status ------------------------------------------------------------- display-subsystem not bound device name status ------------------------------------------------------------- fdd90000.vop not bound fde20000.dsi not bound (unknown) not registered Change-Id: I5739f06b4ef65f0b8de8f3394f4e811abe31a22c Signed-off-by: Guochun Huang --- .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c index eef63ae34e43..434a6cf03969 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c @@ -1425,9 +1425,6 @@ static int dw_mipi_dsi2_bind(struct device *dev, struct device *master, int ret; dsi2->drm_dev = drm_dev; - ret = dw_mipi_dsi2_dual_channel_probe(dsi2); - if (ret) - return ret; if (dsi2->master) return 0; @@ -1573,6 +1570,7 @@ static int dw_mipi_dsi2_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct dw_mipi_dsi2 *dsi2 = host_to_dsi2(host); + int ret; if (dsi2->master) return 0; @@ -1586,7 +1584,25 @@ static int dw_mipi_dsi2_host_attach(struct mipi_dsi_host *host, dsi2->format = device->format; dsi2->mode_flags = device->mode_flags; - return component_add(dsi2->dev, &dw_mipi_dsi2_ops); + ret = dw_mipi_dsi2_dual_channel_probe(dsi2); + if (ret) + return ret; + + ret = component_add(dsi2->dev, &dw_mipi_dsi2_ops); + if (ret) + return ret; + + if (dsi2->slave) { + ret = component_add(dsi2->slave->dev, &dw_mipi_dsi2_ops); + if (ret) + goto err; + } + + return 0; + +err: + component_del(dsi2->dev, &dw_mipi_dsi2_ops); + return ret; } static int dw_mipi_dsi2_host_detach(struct mipi_dsi_host *host, @@ -1597,6 +1613,9 @@ static int dw_mipi_dsi2_host_detach(struct mipi_dsi_host *host, if (dsi2->master) return 0; + if (dsi2->slave) + component_del(dsi2->slave->dev, &dw_mipi_dsi2_ops); + component_del(dsi2->dev, &dw_mipi_dsi2_ops); return 0;