public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Damon Ding <damon.ding@rock-chips.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Marek Vasut <marex@denx.de>, Stefan Agner <stefan@agner.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Liu Ying <victor.liu@nxp.com>, Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@kernel.org>
Cc: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>,
	"Hervé Codina" <herve.codina@bootlin.com>,
	"Hui Pu" <Hui.Pu@gehealthcare.com>,
	"Ian Ray" <ian.ray@gehealthcare.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	dri-devel@lists.freedesktop.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	"Adam Ford" <aford173@gmail.com>,
	"Alexander Stein" <alexander.stein@ew.tq-group.com>,
	"Christopher Obbard" <christopher.obbard@linaro.org>,
	"Daniel Scally" <dan.scally@ideasonboard.com>,
	"Emanuele Ghidoli" <emanuele.ghidoli@toradex.com>,
	"Fabio Estevam" <festevam@denx.de>,
	"Francesco Dolcini" <francesco.dolcini@toradex.com>,
	"Frieder Schrempf" <frieder.schrempf@kontron.de>,
	"Gilles Talis" <gilles.talis@gmail.com>,
	"Goran Rađenović" <goran.radni@gmail.com>,
	"Heiko Schocher" <hs@denx.de>,
	"Josua Mayer" <josua@solid-run.com>,
	"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Martyn Welch" <martyn.welch@collabora.com>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	"Peng Fan" <peng.fan@nxp.com>,
	"Richard Hu" <richard.hu@technexion.com>,
	"Shengjiu Wang" <shengjiu.wang@nxp.com>,
	"Stefan Eichenberger" <stefan.eichenberger@toradex.com>,
	"Vitor Soares" <vitor.soares@toradex.com>
Subject: Re: [PATCH v2 06/10] drm/bridge: dw-hdmi: warn on unsupported attach combination
Date: Thu, 2 Apr 2026 17:14:53 +0800	[thread overview]
Message-ID: <d9b5c826-e0eb-4c0a-989b-48aa12fdbaef@rock-chips.com> (raw)
In-Reply-To: <20260330-drm-lcdif-dbanc-v2-6-c7f2af536a24@bootlin.com>

[-- Attachment #1: Type: text/plain, Size: 2768 bytes --]

Hi Luca,

On 3/31/2026 3:25 AM, Luca Ceresoli wrote:
> dw-hdmi can operate in two different modes, depending on the platform data
> as set by the driver:
> 
>   A. hdmi->plat_data->output_port = 0:
>      the HDMI output (port@1) in device tree is not used
> 
>   B. hdmi->plat_data->output_port = 1:
>      the HDMI output (port@1) is parsed to find the next bridge
> 
> Only case B is supported when the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag is
> passed to the attach callback. Emit a warning when this is violated. Also
> return -EINVAL which would be returned by drm_bridge_attach() right after
> anyway.
> 
> Reviewed-by: Liu Ying <victor.liu@nxp.com>
> Tested-by: Martyn Welch <martyn.welch@collabora.com>
> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # TQMa8MPxL/MBa8MPxL
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
> Note: Returning when the warning triggers does not change the functional
> behaviour of this function. It is not strictly necessary in this patch but
> it will have to be done anyway in the following patch.
> ---
>   drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 0296e110ce65..ab1a6a8783cd 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -2910,6 +2910,10 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge,
>   {
>   	struct dw_hdmi *hdmi = bridge->driver_private;
>   
> +	/* DRM_BRIDGE_ATTACH_NO_CONNECTOR requires a remote-endpoint to the next bridge */
> +	if (WARN_ON((flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) && !hdmi->plat_data->output_port))
> +		return -EINVAL;
> +
>   	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
>   		return drm_bridge_attach(encoder, hdmi->bridge.next_bridge,
>   					 bridge, flags);
> 

Since many older Rockchip platforms (RK3288, RK3399, etc.) lack a 
hdmi-connector node linked to the HDMI DT node, which corresponds to 
case A. Could we relax this restriction and treat cases where 
DRM_BRIDGE_ATTACH_NO_CONNECTOR is set but hdmi->plat_data->output_port = 
0 as a new case C?

For Rockchip platforms, the HDMI driver invokes dw_hdmi_bind() to attach 
the Synopsys bridge. This sequence differs from that on the XNP 
platform, but is similar to the Allwinner implementation.

If we treat the case where DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and 
hdmi->plat_data->output_port = 0 as -EINVAL, I will have to modify the 
HDMI DT configuration for all Rockchip platforms when adapting to the 
bridge-connector framework.

The patch that adapts to the bridge-connector framework and has been 
verified OK on RK3399 is attached.

Best regards,
Damon

[-- Attachment #2: dw_hdmi-rockchip_test_env_20260402.patch --]
[-- Type: text/plain, Size: 3041 bytes --]

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-evb-ind.dts b/arch/arm64/boot/dts/rockchip/rk3399-evb-ind.dts
index 70aee1ab904c..5a78e741f113 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-evb-ind.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-evb-ind.dts
@@ -17,6 +17,7 @@ aliases {
 
 	chosen {
 		stdout-path = "serial2:1500000n8";
+		bootargs = "root=PARTUUID=614e0000-0000 rootwait";
 	};
 
 	vcc5v0_sys: regulator-vcc5v0-sys {
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index ada45e8b3e2c..0e97e183a8b3 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2914,7 +2914,7 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge,
 
 	/* DRM_BRIDGE_ATTACH_NO_CONNECTOR requires a remote-endpoint to the next bridge */
 	if (WARN_ON((flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) && !hdmi->plat_data->output_port))
-		return -EINVAL;
+		return 0;
 
 	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
 		struct device_node *remote __free(device_node) =
@@ -3628,7 +3628,7 @@ struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev,
 	if (IS_ERR(hdmi))
 		return hdmi;
 
-	ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, 0);
+	ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
 	if (ret) {
 		dw_hdmi_remove(hdmi);
 		return ERR_PTR(ret);
diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index e7f49fe845ea..69b832d0c8c4 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -76,6 +76,7 @@ config ROCKCHIP_DW_DP
 
 config ROCKCHIP_DW_HDMI
 	bool "Rockchip specific extensions for Synopsys DW HDMI"
+	select DRM_BRIDGE_CONNECTOR
 	help
 	  This selects support for Rockchip SoC specific extensions
 	  for the Synopsys DesignWare HDMI driver. If you want to
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 0dc1eb5d2ae3..174a10c1d7c2 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -13,6 +13,7 @@
 #include <linux/regulator/consumer.h>
 
 #include <drm/bridge/dw_hdmi.h>
+#include <drm/drm_bridge_connector.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -542,6 +543,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 	struct drm_device *drm = data;
 	struct drm_encoder *encoder;
 	struct rockchip_hdmi *hdmi;
+	struct drm_connector *connector;
 	int ret;
 
 	if (!pdev->dev.of_node)
@@ -619,7 +621,14 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		goto err_bind;
 	}
 
-	return 0;
+	connector = drm_bridge_connector_init(drm, encoder);
+	if (IS_ERR(connector)) {
+		ret = PTR_ERR(connector);
+		dev_err(hdmi->dev, "Failed to initialize bridge_connector\n");
+		goto err_bind;
+	}
+
+	return drm_connector_attach_encoder(connector, encoder);
 
 err_bind:
 	drm_encoder_cleanup(encoder);

  parent reply	other threads:[~2026-04-02  9:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 19:25 [PATCH v2 00/10] drm/mxsfb/lcdif: use DRM_BRIDGE_ATTACH_NO_CONNECTOR and the bridge-connector Luca Ceresoli
2026-03-30 19:25 ` [PATCH v2 01/10] drm/mxsfb/lcdif: simplify remote pointer management using __free Luca Ceresoli
2026-03-30 19:25 ` [PATCH v2 02/10] drm/mxsfb/lcdif: simplify ep " Luca Ceresoli
2026-04-02  3:50   ` Liu Ying
2026-03-30 19:25 ` [PATCH v2 03/10] drm/mxsfb/lcdif: use dev_err_probe() consistently in lcdif_attach_bridge Luca Ceresoli
2026-04-02  3:52   ` Liu Ying
2026-03-30 19:25 ` [PATCH v2 04/10] drm/mxsfb/lcdif: lcdif_attach_bridge: move iteration-specific variables declaration inside loop Luca Ceresoli
2026-04-02  3:57   ` Liu Ying
2026-03-30 19:25 ` [PATCH v2 05/10] drm/bridge: dw-hdmi: document the output_port field Luca Ceresoli
2026-03-31  7:21   ` Damon Ding
2026-04-02  7:46     ` Luca Ceresoli
2026-04-02  9:05       ` Damon Ding
2026-03-30 19:25 ` [PATCH v2 06/10] drm/bridge: dw-hdmi: warn on unsupported attach combination Luca Ceresoli
2026-03-31  7:25   ` Damon Ding
2026-04-02  9:14   ` Damon Ding [this message]
2026-04-02  9:57     ` Luca Ceresoli
2026-03-30 19:25 ` [PATCH v2 07/10] drm/bridge: dw-hdmi: move next_bridge lookup to attach time Luca Ceresoli
2026-03-31  7:24   ` Damon Ding
2026-04-02  3:59   ` Liu Ying
2026-03-30 19:25 ` [PATCH v2 08/10] drm/bridge: imx8mp-hdmi-tx: add an hdmi-connector when missing using a DT overlay at boot time Luca Ceresoli
2026-04-02  4:05   ` Liu Ying
2026-04-02  7:30     ` Luca Ceresoli
2026-03-30 19:25 ` [PATCH v2 09/10] drm/bridge: imx8mp-hdmi-tx: switch to DRM_BRIDGE_ATTACH_NO_CONNECTOR Luca Ceresoli
2026-04-02  4:08   ` Liu Ying
2026-03-30 19:25 ` [PATCH v2 10/10] drm/mxsfb/lcdif: use DRM_BRIDGE_ATTACH_NO_CONNECTOR and the bridge-connector Luca Ceresoli
2026-04-02  4:55   ` Liu Ying
2026-04-02  5:07     ` Liu Ying
2026-04-02  8:28     ` Luca Ceresoli
2026-04-03  9:48       ` Liu Ying

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9b5c826-e0eb-4c0a-989b-48aa12fdbaef@rock-chips.com \
    --to=damon.ding@rock-chips.com \
    --cc=Frank.Li@nxp.com \
    --cc=Hui.Pu@gehealthcare.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=aford173@gmail.com \
    --cc=airlied@gmail.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=andrzej.hajda@intel.com \
    --cc=christopher.obbard@linaro.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emanuele.ghidoli@toradex.com \
    --cc=festevam@denx.de \
    --cc=festevam@gmail.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=gilles.talis@gmail.com \
    --cc=goran.radni@gmail.com \
    --cc=herve.codina@bootlin.com \
    --cc=hs@denx.de \
    --cc=ian.ray@gehealthcare.com \
    --cc=imx@lists.linux.dev \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=josua@solid-run.com \
    --cc=kernel@pengutronix.de \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=kory.maincent@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=m.felsch@pengutronix.de \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marex@denx.de \
    --cc=martyn.welch@collabora.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=o.rempel@pengutronix.de \
    --cc=peng.fan@nxp.com \
    --cc=rfoss@kernel.org \
    --cc=richard.hu@technexion.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=saravanak@kernel.org \
    --cc=shengjiu.wang@nxp.com \
    --cc=simona@ffwll.ch \
    --cc=stefan.eichenberger@toradex.com \
    --cc=stefan@agner.ch \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tzimmermann@suse.de \
    --cc=victor.liu@nxp.com \
    --cc=vitor.soares@toradex.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox