From patchwork Mon Nov 4 03:27:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 840679 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2074.outbound.protection.outlook.com [40.107.104.74]) (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 7275C166315; Mon, 4 Nov 2024 03:28:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730690929; cv=fail; b=fLxcjVAYQGsJ3qqDpht5zddSmHAgeH6Wlebv+BjIxmlqf8puwYkKHDSmf8rcSVJyoekx9agp2Q4NSK0wzfRrRBVG4L8ABAXbp+U1mxivdMefmPOG0iTlDURfrdx/cgCt5Fm0KEmekByHt6gN1GoHfNEYG3PJtWBu3STv4ndx2GI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730690929; c=relaxed/simple; bh=6SLKOd7Wq/kBPAqHuqZDA52KmjZ9Tya88L+LK64jGbo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hO56xW3dkniJSGp5OqgpQju1nZEY30AG3ATCX1jsAMz0PSaLWPxau9yLh0JmPcWxhElXD1aRAUhAej237i0DMYoCWbU/2+k1kcNVDKR5JpRGTbI0a69SAsKtJIl1dPl/LXXyp0If5XGwJmxZf7yF4Ua0HDs4x0u5kQxqw8SWXxk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Wnjsf2Ih; arc=fail smtp.client-ip=40.107.104.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Wnjsf2Ih" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IBJjshO1C9FHls8YNEspUNeFPZ67qfAiCJGp4UQsqq86y1k/VE0IIDG3QCP9peLGnGpluUwSYVnTUFmovk3S61owGxu+vfxZjIBwNdgddCO9e3tn8lnbobHAooww8sq9apt6rpFPhKRCypsbjFFMKwVkImYRVpVGBqheWIk9yhvGU5nfS4oyJ5LqxrnuJHEsmBvAP3oiwgVHF59efY9Obhf+lXADWKw6IFSqE7B98d2kNpuRGp6eFfm/ZMNatodGQtp0Bu6DoR3eAYM3iXLMQUOcYYSGq5Gp/1EW+rXEaKJsc1rY95XW6MSEY+AuVqhQZ2jEQfQB6uVMrvPaSorlIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iTwgJoGZ+i2vyWhZFpIrNU1QoxR72zxmrVW0muOCozw=; b=eKb7JZ5aO4THq45nqIhanRVrjoZuxrZb0CESV9ks1974GlRqHaO3heXDbCPeHm9oub4vZoSMlo4U9I2EORZflbNBJcSTmCqgg+Tr6BoYFQIr5feaxl9QugeKlRYsTsf+5NHoaoWb/klQKzoZvLUXuw2odbt6p+L9MtchXjlpuQ8FhN/BkdpJit3KRultE3+xWQN7TTvl15/NvtZEA3NybMbJqu9qDj1n0E03ZjzrWE3/BYvZVepFMQkyPCl6QLLtLYMiI1sFyjbOvkAZiQCHnReho4xAlot8l27o2wRFskeCElqapUPoS1+Rj+cPsb0q2gUP9jPyWndpbprkcQLxnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iTwgJoGZ+i2vyWhZFpIrNU1QoxR72zxmrVW0muOCozw=; b=Wnjsf2IhWxy4J6wNnFo88YM86EkoS6yTagCsw7ZWwCaQrMqgu4OZLeBckntM+vqH4dE9LazNvh9sd9dcN62FK4UDEx8FdBA2BNZJMQknIrrtesbj9RSG+sWqQQLkBoLpHWDtWeyvNdypRMm+12rlcL0FmtUf9PWqye0+LarKsm8o9TDepKvN4XywTkGYlRImuvavTPCMt+Z99A42dsWHOteUmgqan32RpJLiAGZDvglmAa09OeLKQf4dg2M4q0JuG3Ucf8XN89IafAAfhbP/EdjDOAnyy9PtrDDiZTNBcizWcEHIJJutt/HrA3ORhSkO/HHmhvQNuAus1SzwHJEevg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by PA1PR04MB10602.eurprd04.prod.outlook.com (2603:10a6:102:490::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 03:28:44 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::d1ce:ea15:6648:6f90]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::d1ce:ea15:6648:6f90%4]) with mapi id 15.20.8114.028; Mon, 4 Nov 2024 03:28:44 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, quic_jesszhan@quicinc.com, mchehab@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, catalin.marinas@arm.com, will@kernel.org, sakari.ailus@linux.intel.com, hverkuil@xs4all.nl, tomi.valkeinen@ideasonboard.com, quic_bjorande@quicinc.com, geert+renesas@glider.be, dmitry.baryshkov@linaro.org, arnd@arndb.de, nfraprado@collabora.com, thierry.reding@gmail.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sam@ravnborg.org, marex@denx.de, biju.das.jz@bp.renesas.com Subject: [PATCH v5 02/13] drm/bridge: fsl-ldb: Get the next non-panel bridge Date: Mon, 4 Nov 2024 11:27:55 +0800 Message-Id: <20241104032806.611890-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104032806.611890-1-victor.liu@nxp.com> References: <20241104032806.611890-1-victor.liu@nxp.com> X-ClientProxiedBy: SGXP274CA0016.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::28) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PA1PR04MB10602:EE_ X-MS-Office365-Filtering-Correlation-Id: 1678932c-e7a4-4160-b5c8-08dcfc80c96e X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: MCoYZ46bGsAf+EvtPQhXwsn2RZoft9WffGQE2JctZeItd/sSeACT//4PuOs91bgZrlVKelZUOxKImWhbeJERGMgEheKVjJtAyI0af6dln0YNU5HKsczcMWlNIXc8CI24bJaTv1eaQaVQFyWzJCUPx/2cvvShQ4v91fu2zKJqansUkzO0G1xRYbrBNkLFQ49Yq3GrN+nIWfEYafBOZrWeg4LVbRcOz/7hxsJ5dLryYeqwWKO5X5DK5AsnsWjge0mlyGKO19c9aRH1cR7sJGzM+P4/uLc76zfGAoBhf7yKZHoW8Tm5JsCc0x5+qiiOKPKhE7vgRQFpgj0Crj/09WsjsuuVYfZo2XbYoLR0CPRo+Em+8KOb7ybMpat1j8bZWHHuRHXjQ02Yq/sQb+BiKO4U1VhQnef9W0ECDTGKqdu85sPjxtktUQ6w1w9oCimCWwgrFkdRZcY5o5yFDCFMjak2NYxodculE1yyaAJzqAAoU1JkVCanBqSb0rpOqXBVTKzpTQYk88sdUBjod7Vb/NG5JdvLs81yKr9J2l5XRl1/o3/NiZkxC+4tmJRyv29p+j7GdUJ3R3iOVoq99sZ78MPUuhygKd2v7PxtpWBu5xi0Pwt1BnX41i2OhUar6uVZ7RBgS4fEGN+pRqsCmGr1mWySgzeoDdc+94OeHcX9h6ucdFJSZfFEnMpBTu9c3FSNvLh7botvec+/EZxwoyQvZzSYs/9keh1ARZxyluLlfj8c4+ucFfeLv+zc+Rfppv9VUJzZMS3Bx/N/a2rns7OYpL37SqgcFksbZkpKSegWUdyx9caAtu0ZcUFlmD6ksk2floyXyG7J5ywWl9DRUfV0b3GGAwxbD39/5uj+hnLL6ElTdYPxGy3/9cwsJunQTsHyynvzPlPvJK3/jMx23LcdmPe1aqr9mOQ2HMSbKTaGDGYF0A6Cz2mgu3tWn2Lt1LOIxoYlth2nqJNrAmNCx0F9KaGy1UokJIlMaXTwY/Bl+kyjtXG25WA6xfrgJiA54DyOiROb+Xz+J/qIVLFWhSEj4FvkrKCJUqd5tkQe1+bRzMpGmaSTY/ECZ7K0c3lcp538mHcYOX42MdnqHi9n+SIc+UGoF6Cj5GVsCTOp4pz9gPJModYf2/Vj9+wRf5b6JZgshRY0djx9k6c2lhi4+PJqI5eECV3p0nugVG1o5rfIKoFwNX7gnTlf+yxdoV5VD8y+ktEA8PusvjfLsIA/CXrEhp5KkcNvPasEL6k2BbJXfr32BUGQj714g0qxuQGnpyYPs99qY8BqaajQ6CcczfKHEE+ZeA6ayBuwGGxqvJWwKkTM/MQmu1I7fF67UhWuPKXimSfvT/83HLpi3aDheKDiDuaaYbnikFyEPQL8xqdWEkS8D/c= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR04MB7046.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pepQn57oFNOBlYH8erVwELSSWWWmYPrcJruOFtt0AsXX73eanoz2k2YjaMNC1kAQJ1oTXEsz1eRESUHGdAVDAaDepOtCU3Q9J1Hbq7GE103YabADzXw5XLFUaZZfE/JVT2KLj1GhlMAAFnUSIxX6+DjG688sBFTe4Vbod5t+gmgI/R0CvW7y27qjTIwoVH4VdhVRXN7BiDDZMBdWgWkxffjnkFVNqqe4lxA61tjOG8dfaswYEUW+zjdQ6oTrxijBdbhBBbqR889NXyzZ9ngoojma19JKu4e0hdNagGvL48IcCpiAcK3AMSo1ze0l9Nj/p+YSPxR00SjisguLwT8rIWnNPJ2h2StJjpTprhU+tontmQBG4BWVSNo8nYnTazGcNxfBkY8Emk/JCBCgoDZ6nQQMGvtMbSnTxIjvCQPG3kjxwDTKOS85+1KHOTLesTr6ein3kx83qtkeL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R4Bg0sNMZ9kw4MGgtX4TG2OvRtFLkagddGn2TVYm0nR9W3wkUH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1678932c-e7a4-4160-b5c8-08dcfc80c96e X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 03:28:44.7922 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fJ3N4aHXW02eJ9WuPvRyoB/arzw+2+u3bbHVzoY3Nf+rnrJVk2VpKPW38sLo8LRJAxsCjsbKxwka0cvN6/aHSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10602 The next bridge in bridge chain could be a panel bridge or a non-panel bridge. Use devm_drm_of_get_bridge() to replace the combination function calls of of_drm_find_panel() and devm_drm_panel_bridge_add() to get either a panel bridge or a non-panel bridge, instead of getting a panel bridge only. Signed-off-by: Liu Ying Reviewed-by: Dmitry Baryshkov --- v5: * No change. v4: * No change. v3: * Collect Dmitry' R-b tag. v2: * No change. drivers/gpu/drm/bridge/fsl-ldb.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/bridge/fsl-ldb.c b/drivers/gpu/drm/bridge/fsl-ldb.c index 0e4bac7dd04f..b559f3e0bef6 100644 --- a/drivers/gpu/drm/bridge/fsl-ldb.c +++ b/drivers/gpu/drm/bridge/fsl-ldb.c @@ -15,7 +15,6 @@ #include #include #include -#include #define LDB_CTRL_CH0_ENABLE BIT(0) #define LDB_CTRL_CH0_DI_SELECT BIT(1) @@ -86,7 +85,7 @@ static const struct fsl_ldb_devdata fsl_ldb_devdata[] = { struct fsl_ldb { struct device *dev; struct drm_bridge bridge; - struct drm_bridge *panel_bridge; + struct drm_bridge *next_bridge; struct clk *clk; struct regmap *regmap; const struct fsl_ldb_devdata *devdata; @@ -117,7 +116,7 @@ static int fsl_ldb_attach(struct drm_bridge *bridge, { struct fsl_ldb *fsl_ldb = to_fsl_ldb(bridge); - return drm_bridge_attach(bridge->encoder, fsl_ldb->panel_bridge, + return drm_bridge_attach(bridge->encoder, fsl_ldb->next_bridge, bridge, flags); } @@ -292,9 +291,7 @@ static const struct drm_bridge_funcs funcs = { static int fsl_ldb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *panel_node; struct device_node *remote1, *remote2; - struct drm_panel *panel; struct fsl_ldb *fsl_ldb; int dual_link; @@ -318,33 +315,27 @@ static int fsl_ldb_probe(struct platform_device *pdev) if (IS_ERR(fsl_ldb->regmap)) return PTR_ERR(fsl_ldb->regmap); - /* Locate the remote ports and the panel node */ + /* Locate the remote ports. */ remote1 = of_graph_get_remote_node(dev->of_node, 1, 0); remote2 = of_graph_get_remote_node(dev->of_node, 2, 0); fsl_ldb->ch0_enabled = (remote1 != NULL); fsl_ldb->ch1_enabled = (remote2 != NULL); - panel_node = of_node_get(remote1 ? remote1 : remote2); of_node_put(remote1); of_node_put(remote2); - if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled) { - of_node_put(panel_node); - return dev_err_probe(dev, -ENXIO, "No panel node found"); - } + if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled) + return dev_err_probe(dev, -ENXIO, "No next bridge node found"); dev_dbg(dev, "Using %s\n", fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" : fsl_ldb->ch0_enabled ? "channel 0" : "channel 1"); - panel = of_drm_find_panel(panel_node); - of_node_put(panel_node); - if (IS_ERR(panel)) - return PTR_ERR(panel); - - fsl_ldb->panel_bridge = devm_drm_panel_bridge_add(dev, panel); - if (IS_ERR(fsl_ldb->panel_bridge)) - return PTR_ERR(fsl_ldb->panel_bridge); - + fsl_ldb->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, + fsl_ldb->ch0_enabled ? 1 : 2, + 0); + if (IS_ERR(fsl_ldb->next_bridge)) + return dev_err_probe(dev, PTR_ERR(fsl_ldb->next_bridge), + "failed to get next bridge\n"); if (fsl_ldb_is_dual(fsl_ldb)) { struct device_node *port1, *port2;