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: 13926754 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 D780FE77197 for ; Sun, 5 Jan 2025 19:09:08 +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=qbPaYdLjULZi5RoBrt7rDIF6XL0fx+U5ZuOgdKQUJ1E=; b=X0+Dyb76f5pUI/kRQ3GVHGUDez w6Lg/2lvZHNH0LkqZt/c6WeYAfV5VbGeV1h/CYanTp3h2Zb6L35tsrVEBjrqQUY9djK+5QDIgPJZg gXZ0PLXc7VhMwOxTKh0y+ys4YTt03z1QJSnQZBpyrhikaY2QCaOdo0EMzhw/k/kFoykK9cL4Jvea/ zR6d+QljpKv2YcWO+SCj3vq2xoX3VAwNocaAB43hfoO8WGb4y6+AUychxJTihnJEqPJXT4leAQ4W9 Pm9DciflnQXSgvqLtGfIp6c4gI2UipvCoDyzZZbXydICa0jMznO3dZ4vkhopwle7doxhP9taNnxEN WJr9Yy4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUVzS-0000000HI4D-11Dm; Sun, 05 Jan 2025 19:08:46 +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 1tUVyG-0000000HHvV-2UYM for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 19:07:33 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250105_110732_846433_24D1A614 X-CRM114-Status: GOOD ( 16.92 ) 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 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; From patchwork Sun Jan 5 19:06:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13926755 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 8AA66E77197 for ; Sun, 5 Jan 2025 19:10:07 +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=gOuDV8a14zXoIoSeFvjSZmd07jSEQLJMy50etppxByE=; b=pUf4WAGD/VH8gDngAgr/llTivp m69rBmopebkkK61Gvn1Nu2kcg2e2uhyi9iXdL+6sOepf3Gxn0WpArr2Da9IGO47ezYgo7Ab0ZH0ap vRgVhBwOsJ4BbOUJK9PsaKKOJQuZD+rzcRoGBUiB03ZrV2x/z+uW8hc1lbG52kJLBRzqcjcmdaL3k HHzCj3ZGVWhCy6aERkwpxtf55YvOaUgdptbYrBDxTorp899chFU5VBnGB8YjJ4wlzGkoFPmwHQDS3 vewRqq48ZLT2onJBtlCREK9By8M/iznQLcb35LaZgtDye2Vxy7y/U9VG5r8ap44/Ix6cZiaevIudN pRtZirZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUW0a-0000000HI9R-3ZFZ; Sun, 05 Jan 2025 19:09:56 +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 1tUVyH-0000000HHvz-1xf9 for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 19:07:34 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EBC74104811FC; Sun, 5 Jan 2025 20:07:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1736104049; 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=gOuDV8a14zXoIoSeFvjSZmd07jSEQLJMy50etppxByE=; b=fqVm5ZlVF64yMGqkhmXc1JZKUP0YaZCtHd3rtYMxRb43FkbnhAruX/L2doszWy1IVk54AB jxLJQZv56VpyoNrLoE9cgX2BaeiWZouSJAGUULwNfmyZxeEBPyVl/s+PZQMBaTJ6+oEr8Q VEYhOkJPkKTPpqttwl++W3loV56O5FV0S5mJTeDhNc2pZozkHIEMxwLaD2vSE65tIEGbaJ j/VjMYq5v7C71i9Eby5eSSlIRrkmhSP9PpizTmthZYZ5QzNyKrgL08EJEeXdoA6JbdhPub tsB4iuRu0oT1Cii6LdotfL+NazokwyDDFO4FqXMiRrXEIyEa3YC9cE/mbntPwg== 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 2/4] drm/bridge: imx8mp-hdmi-tx: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR Date: Sun, 5 Jan 2025 20:06:04 +0100 Message-ID: <20250105190659.99941-2-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250105190659.99941-1-marex@denx.de> References: <20250105190659.99941-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-20250105_110733_647019_0F62E32F X-CRM114-Status: GOOD ( 14.77 ) 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 V4: - Remove select DRM_DISPLAY_CONNECTOR --- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 2 ++ 1 file changed, 2 insertions(+) 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 Sun Jan 5 19:06:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13926756 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 75D37E77197 for ; Sun, 5 Jan 2025 19:11:21 +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=Fh80/M+bjXGuXRz4PihlmmbyVd0aYHy4P1Io9cbXDy4=; b=MQnPyrBsKJcCIvWfcaYEiA+Jb1 1GTJhZebYkHuMZTfZUw1DDifPzgDOXR9ECrNHYXFkZgSG4/sZw4G1Jk2htE1XKBEq9YgiTrcojaqb uxlFzWRPstijaaDKw6Jxf6Y2a/uxYwZcTFLveDMBXySRBJHWNkbARMDuHlkCqQookMm1+CRV3zfgB +/jlVyVIC68Ky7rtx8Kni/fH3bkOGfvx32q1tAXTSG4jTdrsCaFlOMiz8lpU8A53IBBxNR2RY4EHo iN3lawMipN7PE6ccOPZTrmrhc6d3YbV+QCs7kHD2bIUyW6yguyiEJI7YWlqSPIbrL/MMQiKrMsNda liI8ED2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUW1k-0000000HIFZ-1xL4; Sun, 05 Jan 2025 19:11:08 +0000 Received: from mx.denx.de ([89.58.32.78]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUVyM-0000000HHxp-355Q for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 19:07:40 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 709A6104839EE; Sun, 5 Jan 2025 20:07:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1736104056; 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=Fh80/M+bjXGuXRz4PihlmmbyVd0aYHy4P1Io9cbXDy4=; b=By/EIuY8POky2LcfiA9LAlmGh2QCi0COKihtcKsGJ+cxBJSlnIFysb8sEi1PdOQjNhDuW0 M+A9mP5m39cEUElXWSI76n4ESXUycjug/fXKH5PLdutfKQJDI6Jil0SmR7sPySqjqtvlTm jdKokeI+5ULcAzI59HFPGdxmE09xqIcxWp91+PuCgcqy+Lo+oEJaNtbNnWWUjpm7Sf9/X4 b5IfcPfRca556XNN8kDunrwkxkh7JuSThbO1scCo0hCA4iCErTGIl+NJ73EOPHo3GL+sWU MpWjAnRVvNVLpBvLYn1NRN5iTT8vFNEy7OkYN9moSkglk2PwGHVEEsN225fXVw== 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 v4 3/4] drm/mxsfb: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach Date: Sun, 5 Jan 2025 20:06:05 +0100 Message-ID: <20250105190659.99941-3-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250105190659.99941-1-marex@denx.de> References: <20250105190659.99941-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-20250105_110739_052966_BD9FB684 X-CRM114-Status: GOOD ( 20.45 ) 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 V4: - Swap the DRM_BRIDGE_CONNECTOR and DRM_DISPLAY_HELPER in the right symbols - Reorder the patches, swap 3/4 and 4/4 in the series --- 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 264e74f455547..26bb2dbba49e3 100644 --- a/drivers/gpu/drm/mxsfb/Kconfig +++ b/drivers/gpu/drm/mxsfb/Kconfig @@ -10,8 +10,10 @@ 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 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; } From patchwork Sun Jan 5 19:06:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13926757 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 4C84FE77197 for ; Sun, 5 Jan 2025 19:12:31 +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=WVMN7MZLTYNaNECqZI8YdUNMyCnLmE0yhQ6oCZKfzpk=; b=I/yT5PgFT31ZjVPGhg6/iugEsQ YIVy7vlgmfzPMfQqMsq8zwgrjsQyRF+8AkYFZtvmjTI9mKw/iYr/ZMVv1KcvWKVw6zBlayr144Hss ovkhD0oz6oF5xj34tUrcuM8mwQYKcAf4ov2uct8bCVP4rEA8AGgQWrDb1qzrPNVeAw8RLwpSRt9ue d2gFQHAEEM8/M4DfUjEIb6l+ugeg21lYtrlfTdQAXbLPqr6AmmxNC1N/FNkGBK0xa1U9eqdT/AO4s v0ojrkEFM6eR6S+XQ1K3He1BAfc5T5fkItOeulkHYnWsQlrkHprWjynTIFvc5Sw4/qaCi2bWHeX3M ewvpZnBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUW2u-0000000HILf-0j2D; Sun, 05 Jan 2025 19:12:20 +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 1tUVyS-0000000HHyv-2JwQ for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 19:07:46 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DB3C610408FB9; Sun, 5 Jan 2025 20:07:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=mx-20241105; t=1736104062; 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=WVMN7MZLTYNaNECqZI8YdUNMyCnLmE0yhQ6oCZKfzpk=; b=iLYSLD6eTqvJkVi68zJV4FFFQTNNCQRJY92MzPeWmrcm8iUruFf+2GMrm0AJ+9p7vNMUji 9pWSY402DR5tXKZvwYfDK30x3DDJ5WvOulNEn4lH3Ymq4OJYqSe4UIB3Ujfota90mlBTbG MRNhiMlgGEa0Iybw3PSV9V3gMWzpYD1T41XJcT7vKq0ll8eeT8sJfc0MhoQBvwANAAV7TP e0TIZNmfZHArgxefMEXz6ijOZdus1e3FDX4xWSh3pUyQfuvvBDY3yRW/LbwhCKpmgHSlcx +/vQfmNWDFHE1aj5mYppQy611wNxoxDPn8FI+DfAZXwNCwzfUEuBK2jX0/xjMg== 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 v4 4/4] drm/lcdif: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach Date: Sun, 5 Jan 2025 20:06:06 +0100 Message-ID: <20250105190659.99941-4-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250105190659.99941-1-marex@denx.de> References: <20250105190659.99941-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-20250105_110744_891658_BF9E5507 X-CRM114-Status: GOOD ( 20.24 ) 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. V4: - Swap the DRM_BRIDGE_CONNECTOR and DRM_DISPLAY_HELPER in the right symbols - Reorder the patches, swap 3/4 and 4/4 in the series - Drop the HDMI bridge test, create connector here --- drivers/gpu/drm/mxsfb/Kconfig | 2 ++ drivers/gpu/drm/mxsfb/lcdif_drv.c | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/Kconfig b/drivers/gpu/drm/mxsfb/Kconfig index 26bb2dbba49e3..eb51d38455a6c 100644 --- a/drivers/gpu/drm/mxsfb/Kconfig +++ b/drivers/gpu/drm/mxsfb/Kconfig @@ -30,8 +30,10 @@ 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_BRIDGE_CONNECTOR select DRM_GEM_DMA_HELPER select DRM_PANEL select DRM_PANEL_BRIDGE diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c index 8ee00f59ca821..d6a4100e6080a 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 device_node *ep; + struct drm_device *drm = lcdif->drm; + struct drm_connector *connector; struct drm_bridge *bridge; + struct device_node *ep; int ret; for_each_endpoint_of_node(dev->of_node, ep) { @@ -97,13 +100,30 @@ 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); } + + 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;