From patchwork Sun Jan 5 19:06:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13926746 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 75BBDE77197 for ; Sun, 5 Jan 2025 19:07:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9477010E51D; Sun, 5 Jan 2025 19:07:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.b="GHqctiTM"; dkim-atps=neutral Received: from mx.denx.de (mx.denx.de [89.58.32.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 650EB10E51D for ; Sun, 5 Jan 2025 19:07:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2B97A10408FB9; Sun, 5 Jan 2025 20:07:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1736104043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qbPaYdLjULZi5RoBrt7rDIF6XL0fx+U5ZuOgdKQUJ1E=; b=GHqctiTMczjRVgtsWG6Soz6dOGmoEeW8z37m9uwA+hZuvRarmIeegBvKgFYToYoVKINxVX rh6GLlAcd6VU4jZcvKpn4AqDJftLXiqcmx1RPoQ+yEWcDDC/kLFHlfRGfcmY9IhirnmPq/ W3xw7W4tQYBQEMG2cFeCH+f8jAWI1FGkAnYgit+O0EwVNHna3AekTg9cM6op4FBO6ZessL bDSzgMgJ95TC3ggcD5Ky2+Ql1mbpH5f+txiIWrwsl8zBpvzJ/y4Fsm4hyavU9ntFDWcK/A i/Ln2IVfyuD5ZlEFJcv76cInMmt6Xdm5xK+X5pTk2ZXdd6wAcTEoqsf4iv0nEw== From: Marek Vasut To: dri-devel@lists.freedesktop.org Cc: Marek Vasut , Andrzej Hajda , David Airlie , Fabio Estevam , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Liu Ying , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Pengutronix Kernel Team , Robert Foss , Sascha Hauer , Shawn Guo , Simona Vetter , Stefan Agner , Thomas Zimmermann , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/4] drm: bridge: dw_hdmi: Add flag to indicate output port is optional Date: Sun, 5 Jan 2025 20:06:03 +0100 Message-ID: <20250105190659.99941-1-marex@denx.de> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 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" Add a flag meant purely to work around broken i.MX8MP DTs which enable HDMI but do not contain the HDMI connector node. This flag allows such DTs to work by creating the connector in the HDMI bridge driver. Do not use this flag, do not proliferate this flag, please fix your DTs and add the connector node this way: ``` / { hdmi-connector { compatible = "hdmi-connector"; label = "FIXME-Board-Specific-Connector-Label"; // Modify this type = "a"; port { hdmi_connector_in: endpoint { remote-endpoint = <&hdmi_tx_out>; }; }; }; }; &hdmi_tx { ... ports { port@1 { hdmi_tx_out: endpoint { remote-endpoint = <&hdmi_connector_in>; }; }; }; }; ``` Signed-off-by: Marek Vasut --- Cc: Andrzej Hajda Cc: David Airlie Cc: Fabio Estevam Cc: Jernej Skrabec Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Liu Ying Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Neil Armstrong Cc: Pengutronix Kernel Team Cc: Robert Foss Cc: Sascha Hauer Cc: Shawn Guo Cc: Simona Vetter Cc: Stefan Agner Cc: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org Cc: imx@lists.linux.dev Cc: linux-arm-kernel@lists.infradead.org --- V3: New patch V4: - Add HDMI connector node addition example into commit message - Bail from dw_hdmi_bridge_attach() if DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and there is no hdmi->next_bridge , so the connector can be created in scanout driver. --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 ++++++-- include/drm/bridge/dw_hdmi.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 996733ed2c004..e84693faf46dc 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2893,9 +2893,13 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge, { struct dw_hdmi *hdmi = bridge->driver_private; - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { + if (!hdmi->next_bridge) + return 0; + return drm_bridge_attach(bridge->encoder, hdmi->next_bridge, bridge, flags); + } return dw_hdmi_connector_create(hdmi); } @@ -3298,7 +3302,7 @@ static int dw_hdmi_parse_dt(struct dw_hdmi *hdmi) hdmi->plat_data->output_port, -1); if (!remote) - return -ENODEV; + return hdmi->plat_data->output_port_optional ? 0 : -ENODEV; hdmi->next_bridge = of_drm_find_bridge(remote); of_node_put(remote); diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 6a46baa0737cd..3bb6e633424a8 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -127,6 +127,8 @@ struct dw_hdmi_plat_data { struct regmap *regm; unsigned int output_port; + /* Used purely by MX8MP HDMI to work around broken DTs without HDMI connector node. */ + bool output_port_optional; unsigned long input_bus_encoding; bool use_drm_infoframe;