From patchwork Tue Nov 12 10:05:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13872036 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 C19E1D32D83 for ; Tue, 12 Nov 2024 10:13:27 +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:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cp8Cblo+6YwXQz3tVzJgq0Ki6AfMLZd/vEcpZZbQNLM=; b=ns3YcO3XdO24UFLOoOniPSjNE0 ochRcOUqFWPBYX3GYt4ih4s8TdWEV6Z4FIXl8RmfQ0PRR4yiyS+bJ5E++PjN+278xHq1Uf67JPo0a 0T5oyKPkJ90WBfTVofG4NgmkLqoU+Qg3pFxbOKXYCe6XYDFbudgfWMSmms3L68/kjM+w7Wi+PluxN LGS6OVVa896ODBN2CBEJgM97oUAjtZUyfzDOcYaTU2xEIZwiaFZZtZreb5YcjBPVE4FXHTvaN5Pm5 M+60Ljr5zN3Uz/2mIVvwMxHWT9vm7kwNDAB5GinDRyFRQ5X363RRe+fqbDsrxauFT2CvBxCas0Ro0 kkbrJrvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tAntX-00000002zW4-3oCh; Tue, 12 Nov 2024 10:13:11 +0000 Received: from mail-vi1eur03on20607.outbound.protection.outlook.com ([2a01:111:f403:260c::607] helo=EUR03-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tAnmr-00000002yAn-2gdH for linux-arm-kernel@lists.infradead.org; Tue, 12 Nov 2024 10:06:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rqoMg0ExOMF9zewLGu2DycLfOI0yvARjx48raaZnQ+CBbr18RCDMKge25ptGjTZBHdkNnZtN8ZRJjIE1Eu60mavk+g+UYX0WYKvzqQOO/b4tEX0of6swzVr7m9Iw/tXqNhvpYdZZwhlvacNgyYDUUTReIuU+ggNXuhWPSMsDmHd2yUE7tVYk9N267qmqk19O2xbdxTpwj8+IeMuvWsIzIu4ZE9zZ5Um7aNoL6pLApbl2WXi+dmFEEj7I4hkjNT9Gknljrw2WLsYwW03wFsKJDYQ6zFdUpNu3gONl4bLAZ1TKPicaCN/imnnnpCHQk16MwJjjgXT0MJpsJq6rt0rfPQ== 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=cp8Cblo+6YwXQz3tVzJgq0Ki6AfMLZd/vEcpZZbQNLM=; b=c1E2iFX8ROr6WaACBZ2LvKt5j/A20haWROGoTFA7n+XQS3N45NFBDexKWq8yEthjKAXaRW0WYiDPaBuz7Gj2Pd0JbHcLqJLEVbV44b/eL+WVm4TwQrskWLyxOyd2/76gDArCjr0l0Lhzad321/3CGP3TToVoyGvILURo11l1/PLHMpDNDVeoi565bruqG/0gNvpwTnEMJboyOmr5BoAbIu3W1tJE06Wf3OGMehds74aM5uNc6vjHutf8rEbtxEUJGHmjd1/FFFJNwIq+kj2Kea0s8eDBFjt8C878KYfyiQM1h38bw+n2xdh8HiKCAkRUnijEcj4QupotltiBSVNP0A== 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=cp8Cblo+6YwXQz3tVzJgq0Ki6AfMLZd/vEcpZZbQNLM=; b=MYPZtOrozI/PYl83raowS994RANvJwTsu8ot6dExDGQbEK1bXPXGrrOpB4L7EY/vqu0bA+ITConx0pMTsXgPiW41Nm78uj7A9ZBOBkPXUsCs1jMvOzcCiw0AzDgDwiwf+1JLPt9A3NbL05+0SXPpEYG1fgvnGrGwRpKRJ3h/NCkvxMRldlueEwevX58v8PK0FTkn9PIej12NAXY16hxbeOKdwA1WjZv05AKYe66OYgBBqwHkvEnmYS9aW/sp9WiunAEw8JLOrYY/c/PpX7pCeLyLVgLY+pMX227ITQgJoM1TTjJfe9lHZQ608tkPxxLHQ50Wtmvup6uy9pspVAMNbg== 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 PAXPR04MB8256.eurprd04.prod.outlook.com (2603:10a6:102:1c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Tue, 12 Nov 2024 10:06:12 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::d1ce:ea15:6648:6f90]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::d1ce:ea15:6648:6f90%5]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 10:06:12 +0000 From: Liu Ying To: imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, catalin.marinas@arm.com, will@kernel.org, abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, 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, quic_bjorande@quicinc.com, geert+renesas@glider.be, dmitry.baryshkov@linaro.org, arnd@arndb.de, nfraprado@collabora.com, marex@denx.de Subject: [PATCH v6 3/7] drm/bridge: fsl-ldb: Get the next non-panel bridge Date: Tue, 12 Nov 2024 18:05:43 +0800 Message-Id: <20241112100547.2908497-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112100547.2908497-1-victor.liu@nxp.com> References: <20241112100547.2908497-1-victor.liu@nxp.com> X-ClientProxiedBy: SG2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:3:18::13) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|PAXPR04MB8256:EE_ X-MS-Office365-Filtering-Correlation-Id: dc766a2b-227a-4861-154f-08dd0301a338 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|366016|376014|7416014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: l4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fzof5zQRDyqoV8ZlmzFpho+jVRm3wQGxmc+d+6OOPayZFo85nkeoINePXZ96WVokiSvUSbUiavdnfEL+oZMT0wKzjan9LL5NFO+yn786YN5SBrZcSithhKSRObgVxHQwzeUS1vMcsQpHNxG+cDQ3Y4jspYygPoNoMJFLtsKJVAN7lufgb2L0hGXHy93KvHT8QrJqnkk+wTt6/zFcFuILIvuT99fLEup5y3tCOKXfYBSpaYKRwmYomhM0JoxpmfghbpbDg0sLean+I39gHg8BbiDygu03jPSN/8ZW0Kt39RIJHc6WFEXQZxyionqmd4= 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)(366016)(376014)(7416014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hF95+CphTpx192y0/HhrIa8mEOIbUX3fCGnKJ73QNA5lFWKaf/UNqINIwwAOl6+YsV1j3b0GnikawGVBr7EKKCi4SZGXaeASovIV94cEOBLuWQUjxcU+PGQr/GZgqfqpY/tqdFRopwLTVilJ3O/lctEKVLTWFUvZ+4vwW8RQtVZbeZEhZWUxFW44ioJx8mHqZpf/WbWKRp2Q/Aoz7nwsvGoQU8WaxzvRGm7cZQwozm9lBuTdCBSXLlFfAw/ssAaAk1/J7NB3XwBATarlAtf5dPzgBVLz2qkreVrR00nlo0sTHPi+A3nRB/NK0e5s8929bjrUPPxUNGGXtGsd8CXgUeph3CNDgybwJjb15c0imH6ji9kKZBTWN9TIxVbc9ERiW/oKXVa6RI/zhICn68SLoQ2loRtV4QSk92O43mLZWvkLLTDmxhkALTRx06GAm0SwPkxeiVVF/yko/o3kj+fvUxjiHy9yuP4iPiIwVqMWJ9UeQXNgg4qbCg62b1jdmUCh27fKUBJz2qWK9rL3DmQ6pTnOcretpVE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.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc766a2b-227a-4861-154f-08dd0301a338 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 10:06:12.6804 (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: hBDzhMjPuThNpM+MEh7gsJfSdFISZ7BbvWSQ1noADui5xBIehY2FnmCCx6hdETXyKS71pOq0SwBdMrfgP/0T/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8256 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241112_020617_715033_9194B5B8 X-CRM114-Status: GOOD ( 16.74 ) 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 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 --- v6: * No change. 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;