From nobody Wed Apr 1 11:07:02 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C60FE398916 for ; Mon, 30 Mar 2026 19:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774898882; cv=none; b=ltyQgZ9q+djYDGegJ8AGNot2/Er0KUmYhliudxGizK1mxYs3Gvg8BkrCR2MYt7Lh9ZOu3ix+Br/FlTzWi7poAYY+61BnxaRkJ22dASRlxYybvoS8X7RVpWsStd+3HcIT9VaU70nkGVReTrYPcUHrvADOH0Y4Cn94CjAb13b1gV8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774898882; c=relaxed/simple; bh=8lLuCQ4CcN6NsOTpntXIKDy+qzK5OmGbDZxW3Sg0Avo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HEoTd7vGZf43ii44CJRuh7tfSo9DwOe+a2O17i25x3EnjZ+9fLiMP2HfPBBSvmaIZHc5YUuAYlKBIAJIVRz8qmquwpOWzW8mLfzVjjY4LTD4Zcny0VmSVk4NF7KJ4Z+TF0cdrCvk/AzPqt3CCW7juyBYAtfOsEoQoaiTa6J5JPI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=dzggqOYk; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="dzggqOYk" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 9635A1A3090; Mon, 30 Mar 2026 19:27:59 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 5DF545FFA8; Mon, 30 Mar 2026 19:27:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BE87210450C85; Mon, 30 Mar 2026 21:27:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774898875; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=O8T964MxGFYFbkUiXwr8dehorUZYeF8EMTUnPBp/DzI=; b=dzggqOYkArba03xn7HMlX41G0CsMlq57WKi7evpTIho+Zpxbx+cP20xQuE4mHMFl0Iymub LdrTntpNjVAyJAWBjT3RobLoTUv9jVRuzKL8HUNFQeWQ1TQwSF++t9TIPGnmMg3Ts7yQHP 5hRMbHPocvYOvX228m2rBBZU2Mkgt3b6zR3GBV/90NFP4BrbOoU5T3J9QWPDncKQcN4lfJ RIhPZNHu8JRjDfixW5IOD+OaHkDNGFpm//GMuB/loVua0QToqQ3w992k1jJoykCOlDw3HS 4D8qCLNVhtJlx4OXkAk+X0QNdXaWTV6xbALpoK9PxrnUJ9vPptRbu05lHcoh3w== From: Luca Ceresoli Date: Mon, 30 Mar 2026 21:25:49 +0200 Subject: [PATCH v2 08/10] drm/bridge: imx8mp-hdmi-tx: add an hdmi-connector when missing using a DT overlay at boot time Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260330-drm-lcdif-dbanc-v2-8-c7f2af536a24@bootlin.com> References: <20260330-drm-lcdif-dbanc-v2-0-c7f2af536a24@bootlin.com> In-Reply-To: <20260330-drm-lcdif-dbanc-v2-0-c7f2af536a24@bootlin.com> To: Marek Vasut , Stefan Agner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Liu Ying , Rob Herring , Saravana Kannan Cc: Damon Ding , "Kory Maincent (TI.com)" , =?utf-8?q?Herv=C3=A9_Codina?= , Hui Pu , Ian Ray , Thomas Petazzoni , 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 , Alexander Stein , Christopher Obbard , Daniel Scally , Emanuele Ghidoli , Fabio Estevam , Francesco Dolcini , Frieder Schrempf , Gilles Talis , =?utf-8?q?Goran_Ra=C4=91enovi=C4=87?= , Heiko Schocher , Josua Mayer , Kieran Bingham , Marco Felsch , Martyn Welch , Oleksij Rempel , Peng Fan , Richard Hu , Shengjiu Wang , Stefan Eichenberger , Vitor Soares , Luca Ceresoli X-Mailer: b4 0.15.1 X-Last-TLS-Session-Version: TLSv1.3 The imx8mp-hdmi-tx is one of many drivers based on dw-hdmi. dw-hdmi in turn can operate in two different modes, depending on the platform data as set by the driver: A. hdmi->plat_data->output_port =3D 0: the HDMI output (port@1) in device tree is not used [0] B. hdmi->plat_data->output_port =3D 1: the HDMI output (port@1) is parsed to find the next bridge The imx8mp-hdmi-tx driver falls in case A. This implies next_bridge will always be NULL, and so dw_hdmi_bridge_attach() [1] will always fail if called with the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag. In fact case A assumes that DRM_BRIDGE_ATTACH_NO_CONNECTOR is not set and in that case it adds an HDMI Type A connector programmatically at bridge attach time. Support for DRM_BRIDGE_ATTACH_NO_CONNECTOR is implemented by dw-hdmi.c in case B. However switching to base B requires that port@1 is connected to a "next bridge" DT node, typically the HDMI connector, because dw-hdmi won't add the connector when using DRM_BRIDGE_ATTACH_NO_CONNECTOR. Many dts files for imx8mp-based boards in the kernel have such a connector described and linked to port@1, so the pipeline will be fully attached up to a display-connector and a drm_connector added by the bridge-connector. Sadly some of those dts files don't have the connector described. Adding it would solve the problem easily, but this would break existing devices which do not update the dtb when upgrading to a newer kernel. In preparation for switching to case B while preserving backward compatibility for such devices, introduce a module adding the hdmi-connector node to the live device tree at init time. This will allow the dw-hdmi code to find the next bridge (the one wrapping the hdmi-connector) and let the pipeline work as before. The module is inserted only if there is no endpoint in port@1. So boards whose device tree describe the connector will not have the device tre modified, and will start isntantiating the correct HDMI connector type as described in the device tree. For boards lacking a connector description in DT the overlay will be added, abd the HDMI connector will be Type A, which is a reasonable fallback and is what the driver is currently doing. [0] https://elixir.bootlin.com/linux/v7.0-rc1/source/drivers/gpu/drm/bridge= /synopsys/dw-hdmi.c#L3310 [1] https://elixir.bootlin.com/linux/v7.0-rc1/source/drivers/gpu/drm/bridge= /synopsys/dw-hdmi.c#L2907 Signed-off-by: Luca Ceresoli --- Changes in v2: - don't apply the overlay if the SoC is not i.MX8MP - build unconditionally, but depend on DRM_IMX_LCDIF - remove useless error check - add missing cleanup.h and init.h includes, remove unneeded includes - avoid dtc warnings on overlay - fix typo in Kconfig help text - not added the Tested-bys because the code has changed - split the 'plat_data->output_port =3D 1' line to a separate patch This patch is inspired by commit 0ff223d99147 ("drm/tilcdc: Convert legacy panel binding via DT overlay at boot time") --- drivers/gpu/drm/bridge/imx/Kconfig | 18 +++++++ drivers/gpu/drm/bridge/imx/Makefile | 2 + .../bridge/imx/imx8mp-hdmi-tx-connector-fixup.c | 53 ++++++++++++++++++= ++ .../bridge/imx/imx8mp-hdmi-tx-connector-fixup.dtso | 56 ++++++++++++++++++= ++++ 4 files changed, 129 insertions(+) diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/im= x/Kconfig index b9028a5e5a06..49f074559b00 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -18,6 +18,8 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE depends on OF depends on COMMON_CLK select DRM_DW_HDMI + select OF_OVERLAY + select DRM_DISPLAY_CONNECTOR imply DRM_IMX8MP_HDMI_PAI imply DRM_IMX8MP_HDMI_PVI imply PHY_FSL_SAMSUNG_HDMI_PHY @@ -25,6 +27,22 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE Choose this to enable support for the internal HDMI encoder found on the i.MX8MP SoC. =20 +config DRM_IMX8MP_DW_HDMI_BRIDGE_CONNECTOR_FIXUP + bool + default y + depends on DRM_IMX_LCDIF + depends on DRM_IMX8MP_DW_HDMI_BRIDGE + depends on OF + help + Modifies at early boot the live device tree of boards using the + i.MX8MP fsl,imx8mp-hdmi-tx adding a hdmi-connector node linked to + the hdmi-tx. This is needed to support bridge-connector usage in + the i.MX8MP LCDIF driver. + + You need this if you use the i.MX8MP HDMI output and your board + device tree file does not have an hdmi-connector node connected + to it. + config DRM_IMX8MP_HDMI_PAI tristate "Freescale i.MX8MP HDMI PAI bridge support" depends on OF diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/i= mx/Makefile index 8d01fda25451..84499fe2e444 100644 --- a/drivers/gpu/drm/bridge/imx/Makefile +++ b/drivers/gpu/drm/bridge/imx/Makefile @@ -1,6 +1,8 @@ obj-$(CONFIG_DRM_IMX_LDB_HELPER) +=3D imx-ldb-helper.o obj-$(CONFIG_DRM_IMX_LEGACY_BRIDGE) +=3D imx-legacy-bridge.o obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) +=3D imx8mp-hdmi-tx.o +obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE_CONNECTOR_FIXUP) +=3D imx8mp-hdmi-t= x-connector-fixup.o \ + imx8mp-hdmi-tx-connector-fixup.dtbo.o obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) +=3D imx8mp-hdmi-pai.o obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) +=3D imx8mp-hdmi-pvi.o obj-$(CONFIG_DRM_IMX8QM_LDB) +=3D imx8qm-ldb.o diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx-connector-fixup.c b/= drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx-connector-fixup.c new file mode 100644 index 000000000000..4c0a22bf416b --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx-connector-fixup.c @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Add an hdmi-connector node to boards using the imx8mp hdmi_tx which + * don't have one. This is needed for the i.MX LCDIF to work with + * DRM_BRIDGE_ATTACH_NO_CONNECTOR. + * + * Copyright (C) 2026 GE HealthCare + * Author: Luca Ceresoli + */ + +#include +#include +#include + +/* Embedded dtbo symbols created by cmd_wrap_S_dtb in scripts/Makefile.dtb= s */ +extern char __dtbo_imx8mp_hdmi_tx_connector_fixup_begin[]; +extern char __dtbo_imx8mp_hdmi_tx_connector_fixup_end[]; + +static int __init imx8mp_hdmi_tx_connector_fixup_init(void) +{ + struct device_node *soc __free(device_node) =3D NULL; + struct device_node *hdmi_tx __free(device_node) =3D NULL; + struct device_node *endpoint __free(device_node) =3D NULL; + struct device_node *hdmi_conn __free(device_node) =3D NULL; + void *dtbo_start; + u32 dtbo_size; + int ovcs_id; + + soc =3D of_find_node_by_path("/soc@0"); + if (!soc) + return 0; + + /* This applies to i.MX8MP only, do nothing on other systems */ + if (!of_device_is_compatible(soc, "fsl,imx8mp-soc")) + return 0; + + hdmi_tx =3D of_find_node_by_path("/soc@0/bus@32c00000/hdmi@32fd8000"); + if (!of_device_is_available(hdmi_tx)) + return 0; + + /* If endpoint exists, assume an hdmi-connector exists already */ + endpoint =3D of_find_node_by_path("/soc@0/bus@32c00000/hdmi@32fd8000/port= s/port@1/endpoint"); + if (endpoint) + return 0; + + dtbo_start =3D __dtbo_imx8mp_hdmi_tx_connector_fixup_begin; + dtbo_size =3D __dtbo_imx8mp_hdmi_tx_connector_fixup_end - + __dtbo_imx8mp_hdmi_tx_connector_fixup_begin; + + return of_overlay_fdt_apply(dtbo_start, dtbo_size, &ovcs_id, NULL); +} + +subsys_initcall(imx8mp_hdmi_tx_connector_fixup_init); diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx-connector-fixup.dtso= b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx-connector-fixup.dtso new file mode 100644 index 000000000000..5dbe06d5ffe7 --- /dev/null +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx-connector-fixup.dtso @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * DTS overlay adding an hdmi-connector node to boards using the imx8mp hd= mi_tx + * + * Copyright (C) 2026 GE HealthCare + * Author: Luca Ceresoli + */ + +/dts-v1/; +/plugin/; + +&{/} { + #address-cells =3D <2>; + #size-cells =3D <2>; + + fixup-hdmi-connector { + compatible =3D "hdmi-connector"; + label =3D "HDMI"; + type =3D "a"; + + port { + fixup_hdmi_connector_in: endpoint { + remote-endpoint =3D <&hdmi_tx_out>; + }; + }; + }; + + soc@0 { + #address-cells =3D <1>; + #size-cells =3D <1>; + ranges =3D <0x0 0x0 0x0 0x3e000000>; + + bus@32c00000 { + reg =3D <0x32c00000 0x400000>; + #address-cells =3D <1>; + #size-cells =3D <1>; + + hdmi@32fd8000 { + reg =3D <0x32fd8000 0x7eff>; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@1 { + reg =3D <1>; + + hdmi_tx_out: endpoint { + remote-endpoint =3D <&fixup_hdmi_connector_in>; + }; + }; + }; + }; + }; + }; +}; --=20 2.53.0