Enabling DSI clocks on rcar-du needs some tricks as the DU dot clock is provided by the DSI. Thus, we call rcar_mipi_dsi_pclk_enable() from the crtc, when enabling the crtc.
With DSC (added in upcoming patch) in the pipeline, between the DU and the DSI, the above call path is broken as the crtc tries to call rcar_mipi_dsi_pclk_enable() on the DSC. To solve this problem, make sure we store the DSI bridge to the rcdu->dsi[] array, instead of the first bridge in the DSI pipeline (which can be DCS), by checking the bridge's bridge->type. Signed-off-by: Tomi Valkeinen <[email protected]> --- drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 18 ++++++++++++++++-- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c index db2088529b48..ac85838ab3b8 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c @@ -89,9 +89,23 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, drm_bridge_get(bridge); if (output == RCAR_DU_OUTPUT_DSI0 || - output == RCAR_DU_OUTPUT_DSI1) + output == RCAR_DU_OUTPUT_DSI1) { + struct drm_bridge *dsi_bridge; + + /* + * When we have a DSC block between the DU and the DSI, + * the "bridge" points to the DSC. Detect the DSC by looking + * at the bridge type, and skip the DSC if the bridge is not + * the DSI bridge. + */ + + dsi_bridge = bridge->type == DRM_MODE_CONNECTOR_DSI ? + bridge : + bridge->next_bridge; + rcdu->dsi[output - RCAR_DU_OUTPUT_DSI0] = - drm_bridge_get(bridge); + drm_bridge_get(dsi_bridge); + } } /* diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c index aaafee1c060b..f429f03a380c 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c @@ -957,6 +957,7 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host, /* Initialize the DRM bridge. */ dsi->bridge.of_node = dsi->dev->of_node; + dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; drm_bridge_add(&dsi->bridge); return 0; -- 2.43.0
