[v1,4/4] drm/rockchip: dw_hdmi: Support to find the next bridge

Message ID 20260403070032.447102-5-damon.ding@rock-chips.com (mailing list archive)
State New
Headers
Series Apply bridge-connector for the Rockchip DW-HDMI driver |

Commit Message

Damon Ding April 3, 2026, 7 a.m. UTC
If there is a remote node connected to the HDMI output (port@1), the
&dw_hdmi_plat_data.output_port should be set to 1. This patch allows
Rockchip dw-hdmi to support the hdmi-connector and the next bridge.

Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Patch

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index b5cfcb936078..014ac09fd733 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -544,6 +544,8 @@  static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 	struct drm_encoder *encoder;
 	struct rockchip_hdmi *hdmi;
 	struct drm_connector *connector;
+	struct device_node *remote;
+	struct drm_bridge *next_bridge;
 	int ret;
 
 	if (!pdev->dev.of_node)
@@ -610,6 +612,18 @@  static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 
 	platform_set_drvdata(pdev, hdmi);
 
+	remote = of_graph_get_remote_node(hdmi->dev->of_node, 1, -1);
+	if (remote) {
+		of_node_put(remote);
+
+		ret = drm_of_find_panel_or_bridge(hdmi->dev->of_node, 1, 0,
+						  NULL, &next_bridge);
+		if (ret && ret != -ENODEV)
+			goto err_cleanup_encoder;
+
+		plat_data->output_port = 1;
+	}
+
 	hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
 
 	/*