From aec25fa538d5dd3a14f02c0e908fcf6d4132aec8 Mon Sep 17 00:00:00 2001 From: Wyon Bi Date: Wed, 20 Sep 2017 10:39:53 +0800 Subject: [PATCH] drm/rockchip: dsi: fix logic error in rockchip_dsi_host_attach() At this point in time, dsi->slave is always NULL, so fix it. Change-Id: I4f5a75d2547b1083751fcbbb0c7e0c568dc19028 Signed-off-by: Wyon Bi --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 27 +++++++++----------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 7adba4822d57..ade80debd9eb 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -673,36 +673,21 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct dw_mipi_dsi *dsi = host_to_dsi(host); - int lanes; if (dsi->master) return 0; - lanes = dsi->slave ? device->lanes / 2 : device->lanes; - - if (lanes > dsi->pdata->max_data_lanes) { + if (device->lanes < 0 || device->lanes > 8) { dev_err(dsi->dev, "the number of data lanes(%u) is too many\n", - lanes); + device->lanes); return -EINVAL; } - if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)) { - dev_err(dsi->dev, "device mode is unsupported\n"); - return -EINVAL; - } - - dsi->lanes = lanes; + dsi->lanes = device->lanes; dsi->channel = device->channel; dsi->format = device->format; dsi->mode_flags = device->mode_flags; - if (dsi->slave) { - dsi->slave->lanes = lanes; - dsi->slave->channel = device->channel; - dsi->slave->format = device->format; - dsi->slave->mode_flags = device->mode_flags; - } - dsi->panel = of_drm_find_panel(device->dev.of_node); if (!dsi->panel) { DRM_ERROR("failed to find panel\n"); @@ -1328,6 +1313,12 @@ static int rockchip_dsi_dual_channel_probe(struct dw_mipi_dsi *dsi) return -EPROBE_DEFER; dsi->slave->master = dsi; + dsi->lanes /= 2; + + dsi->slave->lanes = dsi->lanes; + dsi->slave->channel = dsi->channel; + dsi->slave->format = dsi->format; + dsi->slave->mode_flags = dsi->mode_flags; } return 0;