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: 13926748 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 98D33E77197 for ; Sun, 5 Jan 2025 19:07:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 193AC10E521; Sun, 5 Jan 2025 19:07:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.b="By/EIuY8"; dkim-atps=neutral Received: from mx.denx.de (mx.denx.de [89.58.32.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 391EB10E521 for ; Sun, 5 Jan 2025 19:07:38 +0000 (UTC) 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-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" 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; }