From 6cafbb6cf014eba5c0613645c0869096a770464a Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 7 Sep 2026 12:29:42 +0300 Subject: [PATCH] drm/rcar-du: dsi: Support DSC in the pipeline 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 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 DSC), by checking the bridge's bridge->type. Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen Link: https://patch.msgid.link/20260907-rcar-du-dsc-v6-3-f8ef711a7494@ideasonboard.com Signed-off-by: Tomi Valkeinen --- .../gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 17 +++++++++++++++-- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 1 + 2 files changed, 16 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 d8e7e9877ba8..3f98eae9b6ac 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c @@ -90,9 +90,22 @@ 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 6e46d6d99f3c..af4edb207486 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;