From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FB9BCD4851 for ; Fri, 15 May 2026 07:56:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1D1710F45E; Fri, 15 May 2026 07:56:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="I3ZCtmS2"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id BD32510F45C for ; Fri, 15 May 2026 07:56:48 +0000 (UTC) Received: from [127.0.1.1] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B10C81337; Fri, 15 May 2026 09:56:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1778831798; bh=gBQFB78X4KGzpd0DZyLsXnhD9qIE3f4obIum+k+GS5o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I3ZCtmS2M9jvVB9tUwR3xDgYz12AJs28JQDrulU0fckk7wuPsa4BcFPjJKZoP6H+d qL/+eoRThiSYPKaAggi+dBxQfu/hvzGFh6vXQyCFsUqUkXJ8lfP7hP8DSztvJR8niz 3/26+2rVSWWMLE2C5OaN/2MCDbF0E/hxxzTbjTlw= From: Tomi Valkeinen Date: Fri, 15 May 2026 10:56:17 +0300 Subject: [PATCH v2 4/5] drm/rcar-du: dsi: Support DSC in the pipeline MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260515-rcar-du-dsc-v2-4-f6b9240a1240@ideasonboard.com> References: <20260515-rcar-du-dsc-v2-0-f6b9240a1240@ideasonboard.com> In-Reply-To: <20260515-rcar-du-dsc-v2-0-f6b9240a1240@ideasonboard.com> To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , Marek Vasut , Laurent Pinchart , Kieran Bingham , Philipp Zabel Cc: linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2997; i=tomi.valkeinen+renesas@ideasonboard.com; h=from:subject:message-id; bh=gBQFB78X4KGzpd0DZyLsXnhD9qIE3f4obIum+k+GS5o=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBqBtG3q6ozBUgeLeR+VJ30nREHyXEMve1sOkZTR xbyjxGiDQuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCagbRtwAKCRD6PaqMvJYe 9RjID/9WAMplmXopUUNqWD2y44x/JVmYqyvm4ZbiME70tsNXFMLDNZnLeswVpp1JZ5IMBIanikP qpF8iIziHv39jNvGkKYJWgSO5hsCNICcwQQVU+N3tIQK9MxRz3EBAFrdMxCmhMqmuAgekOuhvIR AE4+5urWeIba7HUYnNpaoC1IsQUc/1dYBHFrG9s9j2usgOhRy0rDM96Jrpo+f8lw8EIRixDuAoZ ocYss95m6kQhsHiqF9TQtnfCys9PpRx/SbZkRhMFwVFqEnK99JjRqOoD5M1HrnZ/zj9VlUur/Jk ih50kVwFanGpKy5cajMj8yJOcuxHBiECJ1L4Ln/MC+gJrmKGP2tE8gpqMLgUuSkOgvnbNFfM3Ou om1+65soeyYWy5gTAaM37XY69FmD61+/J+fOtTxANnVQc9GQF4zJsZ9YW6p+85KOapQBnPRUXMX L+rJffH6IENfQjjSoJ5eKNbJDoqVFdxKWc4DAKWZRwSFBXipHraHGalH+WmMZ1u0pM2zMS6FsoB DubX1RoSZBWkR6NynHxk/jt4JxgJ9A1HDGgRMwShXgNwnzEKifvzJHDgbbJmtHKHuiaesE830Ap gi8pAdcHS2TnMoy/nSRTRzSki7OlKdGJ58VvruZmvtCdU4tQhisYXFVnmVSXfVinrj3z8STSwY5 U9K+0us038+8XHA== X-Developer-Key: i=tomi.valkeinen+renesas@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. Adjust the rcar_mipi_dsi_pclk_enable() so that it detects the DSC, and in that case gets the next bridge from the DSC, which is the DSI. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 36 +++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) 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 4ef2e3c129ed..085e229bcb0b 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c @@ -88,6 +88,8 @@ struct dsi_setup_info { const struct dsi_clk_config *clkset; }; +static const struct drm_bridge_funcs rcar_mipi_dsi_bridge_ops; + static inline struct rcar_mipi_dsi * bridge_to_rcar_mipi_dsi(struct drm_bridge *bridge) { @@ -844,15 +846,39 @@ static void rcar_mipi_dsi_atomic_disable(struct drm_bridge *bridge, rcar_mipi_dsi_stop_video(dsi); } +/* + * We need to skip the DSC bridge when we have DSC in between the DU and + * the DSI. We detect the DSI bridge via bridge->funcs, and assume the + * next_bridge is the DSI bridge. If this is not the case, the DT data + * is wrong (so it shouldn't really happen). + */ +static struct drm_bridge * +rcar_mipi_dsi_resolve_bridge(struct drm_bridge *bridge) +{ + if (bridge->funcs != &rcar_mipi_dsi_bridge_ops) + bridge = bridge->next_bridge; + + if (!bridge || bridge->funcs != &rcar_mipi_dsi_bridge_ops) + return NULL; + + return bridge; +} + void rcar_mipi_dsi_pclk_enable(struct drm_bridge *bridge, struct drm_atomic_state *state) { - struct rcar_mipi_dsi *dsi = bridge_to_rcar_mipi_dsi(bridge); const struct drm_display_mode *mode; struct drm_connector *connector; + struct rcar_mipi_dsi *dsi; struct drm_crtc *crtc; int ret; + bridge = rcar_mipi_dsi_resolve_bridge(bridge); + if (WARN_ON(!bridge)) + return; + + dsi = bridge_to_rcar_mipi_dsi(bridge); + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); crtc = drm_atomic_get_new_connector_state(state, connector)->crtc; @@ -885,7 +911,13 @@ EXPORT_SYMBOL_GPL(rcar_mipi_dsi_pclk_enable); void rcar_mipi_dsi_pclk_disable(struct drm_bridge *bridge) { - struct rcar_mipi_dsi *dsi = bridge_to_rcar_mipi_dsi(bridge); + struct rcar_mipi_dsi *dsi; + + bridge = rcar_mipi_dsi_resolve_bridge(bridge); + if (WARN_ON(!bridge)) + return; + + dsi = bridge_to_rcar_mipi_dsi(bridge); rcar_mipi_dsi_shutdown(dsi); rcar_mipi_dsi_clk_disable(dsi); -- 2.43.0