drm/rockchip: dsi2: add slave to component in dual-channel mode

Fixes: d420d65bec ("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 <hero.huang@rock-chips.com>
This commit is contained in:
Guochun Huang
2024-05-31 14:45:37 +08:00
committed by Tao Huang
parent 355dd7a64f
commit a5ee6dd0bd

View File

@@ -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;