From patchwork Tue Dec 31 19:28:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13923956 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 7CF34E77188 for ; Tue, 31 Dec 2024 19:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=MZEWmN4GN5G1sABY/mv4D6+HIYv/6uOJhfv6635kFT8=; b=JSj2Z3XOun/dw1htsB4318hyRY YIRwwa4MP8tt0qNTIfc+PJ3pbR1LYOdGIssbNAXBJ9du68OW5BLGqr2gHE7Sm4JKEn6ZeUjX/MZGv N8L9zGkvX/hU3gHHR4dBJj+AEJthNkTm8VzLYSdG4zvUPilL3ZgHknXdkkJVDNtY0gNwozTFzOps6 XG+EnNB79qsjDjsD5oILdiUCOjoO5EKX/lkfF1ztr92wAhVahFEX7yHbNxcBX7kW36vctT6920ISM LtSIz4aW17SwqEWsqS6oigHLnji/DrkK2BL95KuupJa/RnU5KNLzczsFRfP0iXFgKwDG0YPbEcx5A azDAZWjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tShxH-00000007eom-3fKX; Tue, 31 Dec 2024 19:31:03 +0000 Received: from mx.denx.de ([2a03:4000:64:cc:545d:19ff:fe05:8172]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tShw7-00000007ehd-3wGp for linux-arm-kernel@lists.infradead.org; Tue, 31 Dec 2024 19:29:53 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9802E104855B1; Tue, 31 Dec 2024 20:29:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1735673388; 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=MZEWmN4GN5G1sABY/mv4D6+HIYv/6uOJhfv6635kFT8=; b=SSSiv3irUUXzx7nqQ6tWRryfPL3RUPx2U1XYOP5k8dgpHW9tWjWQWbYGFWKoyBI/lVWaPT 291ngQmHU1jh3qYi6pXY7hpznxcKYrW/ToN7VKNE2nGq+uS5/N2c537QG2zprE7qhSquMZ 0WHaNs5fSUrertBEKOltLXIoP+Mm24e/5mdu10VcfREEck46vybCD6tB/ZVQcrfHOBaX5j Kf2qAbgWJk/wrg52rumZ819AUsFbUv9Sjp781z25UxkfAa9E7GAp1qGqR1HE83OQO9p3b3 VVZKVBOCGLHoA3nWYIIC03N1swSdWXafVV3Glykw5lSnI9NcmhOYFpZP+A1CWQ== 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 v3 1/4] drm: bridge: dw_hdmi: Add flag to indicate output port is optional Date: Tue, 31 Dec 2024 20:28:48 +0100 Message-ID: <20241231192925.97614-1-marex@denx.de> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241231_112952_137906_5F977D8E X-CRM114-Status: GOOD ( 14.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Signed-off-by: Marek Vasut Reviewed-by: Dmitry Baryshkov --- 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 --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++---- include/drm/bridge/dw_hdmi.h | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 996733ed2c004..852e73c0f686f 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) - return drm_bridge_attach(bridge->encoder, hdmi->next_bridge, - bridge, flags); + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { + if (hdmi->plat_data->output_port_optional && !hdmi->next_bridge) + return dw_hdmi_connector_create(hdmi); + else + 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; From patchwork Tue Dec 31 19:28:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13923957 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 64CDFE77188 for ; Tue, 31 Dec 2024 19:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kTSJsYIKJaeGiKuNRfscuVxGJheBzxdje6XQbYHlkxw=; b=swEvl9r0G5MPmGAvHWeKyOzbum sh95WMK9tQsYqZpitn86+mIJMAlw+LFGkPQFPYIUCb9EfEZW36YwM3i7u8HF97lmNdHy81CYq/eQL In45F34Q4qgVTSeXoIAWpF4mEo91CnR/0lExI8m9/OHlHZQYL0w1vM3dnMQCSDxnih3vvTSu1C1Y/ W1WhrGc04OLOayixz1vkJjzoRPbGlBIuH77bkKY8VF/tYwzkrKnC+0WntTRxkxp55NwQryha/ah3Y PfBnt0li+kvbVlocPtTQXd9gRVKg93n8KITONld0pziaAh0B1xQtKWEFu5wIMm46Y5vliLQb5YTZg 9BrgR2hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tShyS-00000007f0m-27TA; Tue, 31 Dec 2024 19:32:16 +0000 Received: from mx.denx.de ([2a03:4000:64:cc:545d:19ff:fe05:8172]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tShw9-00000007ehw-1aBX for linux-arm-kernel@lists.infradead.org; Tue, 31 Dec 2024 19:29:54 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7CD3510486D9D; Tue, 31 Dec 2024 20:29:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1735673391; 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: in-reply-to:in-reply-to:references:references; bh=kTSJsYIKJaeGiKuNRfscuVxGJheBzxdje6XQbYHlkxw=; b=c38AdIuTLSdhpBlpGZ+3ez2eVK/z12Mo4ZVAbJrj/sqqrvSS6N09PV3tVEZ00G/jvyZtk2 0XMEW5t+vQWlmtGQO2JuafFxD37tRNCkPuJsK8Lg67llc2MrKdH7Oh9JS+aex11Ir59D/B m6XJkajkKff2iOhYZ4paud8tCngHEoZJ5N2TeWL2y4CZEu60IvFC4rk+XmCDTD6UjQfzYo 1SU4D1dhbsSGjlJHZgCPqGDpWXsuZVyj6hykrW2a763UhZD6x5csAvYxIBm4LkO1sE+UNN MEF+a59QJblXoP1Ki06BX447vFMI0sNXdYURucuwt+IEn/IN8ywf8j8JIEme0Q== 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 v3 2/4] drm/bridge: imx8mp-hdmi-tx: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR Date: Tue, 31 Dec 2024 20:28:49 +0100 Message-ID: <20241231192925.97614-2-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241231192925.97614-1-marex@denx.de> References: <20241231192925.97614-1-marex@denx.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241231_112953_613096_A168428A X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The dw-hdmi output_port is set to 1 in order to look for a connector next bridge in order to get DRM_BRIDGE_ATTACH_NO_CONNECTOR working. The output_port set to 1 makes the DW HDMI driver core look up the next bridge in DT, where the next bridge is often the hdmi-connector . Similar to 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR") Note that looking at the upstream arch/arm64/boot/dts/freescale/imx8mp*dts , the oldest commit which adds HDMI support is commit: 3e67a1ddd56d ("arm64: dts: imx8mp: Enable HDMI on TQMa8MPxL/MBa8MPxL") That already contains the HDMI connector node. Most follow up additions of HDMI support to another devices has been a variation of the same commit, including connector node, which is the proper way of eanbling HDMI on the i.MX8MP. The rest should be covered by output_port_optional which should make systems with DTs without HDMI connector node work, but such DTs should be updated and the HDMI connector node should be added. 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 --- V2: No change V3: - Update commit message - Move select DRM_DISPLAY_CONNECTOR to DRM_IMX8MP_DW_HDMI_BRIDGE - Enable output_port_optional --- drivers/gpu/drm/bridge/imx/Kconfig | 1 + drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig index 9a480c6abb856..db5c8a76193ac 100644 --- a/drivers/gpu/drm/bridge/imx/Kconfig +++ b/drivers/gpu/drm/bridge/imx/Kconfig @@ -17,6 +17,7 @@ config DRM_IMX8MP_DW_HDMI_BRIDGE tristate "Freescale i.MX8MP HDMI-TX bridge support" depends on OF depends on COMMON_CLK + select DRM_DISPLAY_CONNECTOR select DRM_DW_HDMI imply DRM_IMX8MP_HDMI_PVI imply PHY_FSL_SAMSUNG_HDMI_PHY diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c index 1e7a789ec2890..3d63200e468bf 100644 --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c @@ -101,6 +101,8 @@ static int imx8mp_dw_hdmi_probe(struct platform_device *pdev) plat_data->phy_name = "SAMSUNG HDMI TX PHY"; plat_data->priv_data = hdmi; plat_data->phy_force_vendor = true; + plat_data->output_port = 1; + plat_data->output_port_optional = true; hdmi->dw_hdmi = dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi->dw_hdmi)) From patchwork Tue Dec 31 19:28:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13923958 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 BB138E77188 for ; Tue, 31 Dec 2024 19:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+zjnnI3iPrWwOE0R208z670xT6TwIYqYj6odvgiZrgw=; b=r0XZeWWdLSLryi6XQOoxChJKJm /YvHQTHDzwHd5YH1nGZrjIzbuI+mvQWQHxbJoWdtPYyLdAH529XN6I67P7ZgBpLBv9VWcRtwLU+Gd 3010KiBua0T5JX4ZdUJwQH4lecV3EDPYKcZsHRc/MP1yxLneqQG/BU7GXoF5aekSMThnFCu0ttgg2 XcHki8zVcts7j/r5sl3N7yw50KJ56ABXfUPlDpULJnJsBgRTmACjfdiQdyB8UB1y50ivg9UECaan6 F76rq1iQ/8XdJUGxDNbt96+uQ5b5aQmZM8yl7nFYOLSHW15K5I1JviHSzmP2PnBsI/jqpjon5e9Fe JLTB0fjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tShze-00000007f8F-0gOZ; Tue, 31 Dec 2024 19:33:30 +0000 Received: from mx.denx.de ([89.58.32.78]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tShwB-00000007eiI-2pSh for linux-arm-kernel@lists.infradead.org; Tue, 31 Dec 2024 19:29:57 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 822C810486D9F; Tue, 31 Dec 2024 20:29:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1735673393; 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: in-reply-to:in-reply-to:references:references; bh=+zjnnI3iPrWwOE0R208z670xT6TwIYqYj6odvgiZrgw=; b=IUOEsjQZRLNPIjI7Ed+UsxthNvxR028jHVDEfiqfTA2JOEEImbpUOYkKZqo+9YbAIBcoBZ j/nPXfW4Fh3xsgX67siwVYtGzU9Cqx9QP9ei7eRbnnbsSzGPJjZ3VqcoTLK3QmBzE3ggRK l5eKR9CMQBJtn6Pkq+6SGSSUbd1QA+j9DNlhOKLdzUZCuBIr+1h3IfUg52QWEt1Y0m7aDv yCCeAg0zAiMf24ewR0qIfhu2/6ZWfPjFT9ZQmBYjIIshvSftPMK4BIKCt+VwsqZP0Vkb8x t8296MP6z5byvs5yqjWj/7ypJcpUxiloC1Sc2EBZJ8OSTTqMxWQUWa6LFzLhOQ== From: Marek Vasut To: dri-devel@lists.freedesktop.org Cc: Marek Vasut , Dmitry Baryshkov , 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 v3 3/4] drm/lcdif: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach Date: Tue, 31 Dec 2024 20:28:50 +0100 Message-ID: <20241231192925.97614-3-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241231192925.97614-1-marex@denx.de> References: <20241231192925.97614-1-marex@denx.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241231_112956_033291_DD719365 X-CRM114-Status: GOOD ( 19.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit a25b988ff83f ("drm/bridge: Extend bridge API to disable connector creation") added DRM_BRIDGE_ATTACH_NO_CONNECTOR bridge flag and all bridges handle this flag in some way since then. Newly added bridge drivers must no longer contain the connector creation and will fail probing if this flag isn't set. In order to be able to connect to those newly added bridges as well, make use of drm_bridge_connector API and have the connector initialized by the display controller. Based on 2e87bf389e13 ("drm/rockchip: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach") This makes LT9611 work with i.MX8M Plus. Reviewed-by: Dmitry Baryshkov 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 --- V2: Add RB from Dmitry V3: - Select DRM_DISPLAY_HELPER - Use return dev_err_probe() directly - Add missing of_node_put(ep) - Add test using drm_bridge_get_next_bridge() to try and determine if the HDMI connector was missing in DT or not, and if it was missing, if it was created by the HDMI bridge driver. --- drivers/gpu/drm/mxsfb/Kconfig | 2 ++ drivers/gpu/drm/mxsfb/lcdif_drv.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/Kconfig b/drivers/gpu/drm/mxsfb/Kconfig index 264e74f455547..fe98674d5a298 100644 --- a/drivers/gpu/drm/mxsfb/Kconfig +++ b/drivers/gpu/drm/mxsfb/Kconfig @@ -12,6 +12,7 @@ config DRM_MXSFB select DRM_CLIENT_SELECTION select DRM_MXS select DRM_KMS_HELPER + select DRM_BRIDGE_CONNECTOR select DRM_GEM_DMA_HELPER select DRM_PANEL select DRM_PANEL_BRIDGE @@ -28,6 +29,7 @@ config DRM_IMX_LCDIF depends on COMMON_CLK depends on ARCH_MXC || COMPILE_TEST select DRM_CLIENT_SELECTION + select DRM_DISPLAY_HELPER select DRM_MXS select DRM_KMS_HELPER select DRM_GEM_DMA_HELPER diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index 8ee00f59ca821..dc39adabb3cd9 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -48,8 +49,10 @@ static const struct drm_encoder_funcs lcdif_encoder_funcs = { static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) { struct device *dev = lcdif->drm->dev; + struct drm_device *drm = lcdif->drm; + struct drm_connector *connector; struct device_node *ep; - struct drm_bridge *bridge; + struct drm_bridge *bridge, *nextbridge; int ret; for_each_endpoint_of_node(dev->of_node, ep) { @@ -97,13 +100,36 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) return ret; } - ret = drm_bridge_attach(encoder, bridge, NULL, 0); + ret = drm_bridge_attach(encoder, bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) { of_node_put(ep); return dev_err_probe(dev, ret, "Failed to attach bridge for endpoint%u\n", of_ep.id); } + + nextbridge = drm_bridge_get_next_bridge(bridge); + nextbridge = drm_bridge_get_next_bridge(nextbridge); + /* Test if connector node in DT, if not, it was created already */ + if (!nextbridge) + continue; + + connector = drm_bridge_connector_init(drm, encoder); + if (IS_ERR(connector)) { + of_node_put(ep); + return dev_err_probe(drm->dev, PTR_ERR(connector), + "Failed to initialize bridge connector: %pe\n", + connector); + } + + ret = drm_connector_attach_encoder(connector, encoder); + if (ret < 0) { + of_node_put(ep); + drm_connector_cleanup(connector); + return dev_err_probe(drm->dev, ret, + "Failed to attach encoder.\n"); + } } return 0; From patchwork Tue Dec 31 19:28:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13923959 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 44B4FE77188 for ; Tue, 31 Dec 2024 19:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9jYDMn7lKraYIfnDyUnBlYqR8h6KGDWyESEreotAHAU=; b=KQjCcqTpSFhS+nFbApzx3ep0mk dc/lc0n12VMVZfoyG+WwBATRi4a908NlyCGrEbsNJ1XOPWNtiM0fW5YL8NJRve2/oYI9BWoCcPswm Z29Q7Y34MCOtWuhb6T3z9Wle/EyhPdCvNixF4s9YTchC3dM6pSVNkM0trdq0lbewRLEH59SrKR5pa cKUuHO6Hj011lM+p3d97EA/+xhqY4jvKXYvLazctuLx8tIAwjLhuuXLArfcYWXwkMwKHcDB0H66r7 fRrCnvHFL6L9b0C+gEtHMVod7PNtnU/8vOzlq+7k5E6tTugkNlfPBibdvhg2JeW35pY9D8N2VN3EE pDEXYcuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tSi0p-00000007fHP-3XHt; Tue, 31 Dec 2024 19:34:43 +0000 Received: from mx.denx.de ([2a03:4000:64:cc:545d:19ff:fe05:8172]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tShwD-00000007eic-0net for linux-arm-kernel@lists.infradead.org; Tue, 31 Dec 2024 19:29:58 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 92AE110486DA6; Tue, 31 Dec 2024 20:29:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1735673395; 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: in-reply-to:in-reply-to:references:references; bh=9jYDMn7lKraYIfnDyUnBlYqR8h6KGDWyESEreotAHAU=; b=h9rm6F9NWbsUU3Cjdobgv+kIpILYFn66sS8CZ5iDZA6GOU+hknbVb/Dowq11d6IzVAHF2R PM6Dm2vFr0BNY3cxsnKKXrBepFAhp61X0b6faPu0ujbXcnRPi52gFG3WIYiGbWSNZLO9wc pO7iVzm+l4JBke3aoK18IjAW5CzD8wxVGsHtjoJSrEIC60uF9rke0jLan0Lxsz7xxnZlIM JOmXzkDwZBvNlD77zb/NBd1XWkr5NtbxXNd0ORpexbil8ZWYU06HNa1Z6M4Y8Gh//AWRiW IFy4nciRHS7M3/CNyyOvztahzMz1b8hV0zYHJL/NZojqD6vnMoqnV72pNDvxMQ== From: Marek Vasut To: dri-devel@lists.freedesktop.org Cc: Marek Vasut , Dmitry Baryshkov , 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 v3 4/4] drm/mxsfb: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach Date: Tue, 31 Dec 2024 20:28:51 +0100 Message-ID: <20241231192925.97614-4-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241231192925.97614-1-marex@denx.de> References: <20241231192925.97614-1-marex@denx.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241231_112957_519151_D2E2202A X-CRM114-Status: GOOD ( 19.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit a25b988ff83f ("drm/bridge: Extend bridge API to disable connector creation") added DRM_BRIDGE_ATTACH_NO_CONNECTOR bridge flag and all bridges handle this flag in some way since then. Newly added bridge drivers must no longer contain the connector creation and will fail probing if this flag isn't set. In order to be able to connect to those newly added bridges as well, make use of drm_bridge_connector API and have the connector initialized by the display controller. Based on 2e87bf389e13 ("drm/rockchip: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach") This makes LT9611 work with i.MX8M Mini. Reviewed-by: Dmitry Baryshkov 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 --- V2: Cache connector from drm_bridge_connector_init() V3: - Add RB from Dmitry - Select DRM_DISPLAY_HELPER - Use return dev_err_probe() directly - Drop the single use fail path --- drivers/gpu/drm/mxsfb/Kconfig | 2 ++ drivers/gpu/drm/mxsfb/mxsfb_drv.c | 31 ++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/Kconfig b/drivers/gpu/drm/mxsfb/Kconfig index fe98674d5a298..eb51d38455a6c 100644 --- a/drivers/gpu/drm/mxsfb/Kconfig +++ b/drivers/gpu/drm/mxsfb/Kconfig @@ -10,6 +10,7 @@ config DRM_MXSFB depends on COMMON_CLK depends on ARCH_MXS || ARCH_MXC || COMPILE_TEST select DRM_CLIENT_SELECTION + select DRM_DISPLAY_HELPER select DRM_MXS select DRM_KMS_HELPER select DRM_BRIDGE_CONNECTOR @@ -32,6 +33,7 @@ config DRM_IMX_LCDIF select DRM_DISPLAY_HELPER select DRM_MXS select DRM_KMS_HELPER + select DRM_BRIDGE_CONNECTOR select DRM_GEM_DMA_HELPER select DRM_PANEL select DRM_PANEL_BRIDGE diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 59020862cf65e..07784c4f5be48 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -119,9 +120,9 @@ static const struct drm_mode_config_helper_funcs mxsfb_mode_config_helpers = { static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb) { struct drm_device *drm = mxsfb->drm; - struct drm_connector_list_iter iter; - struct drm_panel *panel; + struct drm_connector *connector; struct drm_bridge *bridge; + struct drm_panel *panel; int ret; ret = drm_of_find_panel_or_bridge(drm->dev->of_node, 0, 0, &panel, @@ -139,19 +140,27 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb) if (!bridge) return -ENODEV; - ret = drm_bridge_attach(&mxsfb->encoder, bridge, NULL, 0); + ret = drm_bridge_attach(&mxsfb->encoder, bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) return dev_err_probe(drm->dev, ret, "Failed to attach bridge\n"); - mxsfb->bridge = bridge; + connector = drm_bridge_connector_init(drm, &mxsfb->encoder); + if (IS_ERR(connector)) { + return dev_err_probe(drm->dev, PTR_ERR(connector), + "Failed to initialize bridge connector: %pe\n", + connector); + } - /* - * Get hold of the connector. This is a bit of a hack, until the bridge - * API gives us bus flags and formats. - */ - drm_connector_list_iter_begin(drm, &iter); - mxsfb->connector = drm_connector_list_iter_next(&iter); - drm_connector_list_iter_end(&iter); + ret = drm_connector_attach_encoder(connector, &mxsfb->encoder); + if (ret < 0) { + drm_connector_cleanup(connector); + return dev_err_probe(drm->dev, ret, + "Failed to attach encoder.\n"); + } + + mxsfb->bridge = bridge; + mxsfb->connector = connector; return 0; }