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: 13872019 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2084.outbound.protection.outlook.com [40.107.104.84]) (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 72ADD212182 for ; Tue, 12 Nov 2024 10:06:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731405977; cv=fail; b=c4B7QvRUOS4qLxjt58B1yNUG/R82ito6JhhIEkJidLkrfYc7eYdJdiew8g/zZJJzrZxqbD6Z2TvrUc6xrlWgUPPVilyub05fApk745/PPFcPaRXWaA/IEwFDGUfm1A7d7wY6KGeeAaNaj2YbRhMnJmu7HcTcqDI6hG2gPKLDe18= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731405977; c=relaxed/simple; bh=E30vLCjRDPCg2jtIES9K1l0bCr9ntM0Zf113C1aXCek=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=SqcEU4eQztrga78WoHrwiS7QWovZ3F8XFnWLASvA1sSY7GmD4M2lxT7F/dZE2Gox8mj4podqagk9dEzeiuRk6P6WC58Rz9E9cn4LC0YEzFvRfHkMIen9lYpp85U3JPAfNkSMDQ03oytzctBihYIvAWLVqxaOjVU8FSYxoUEZbzw= 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=MYPZtOro; arc=fail smtp.client-ip=40.107.104.84 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="MYPZtOro" 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) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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: l4ryqmJ1oe0PL+EzqxntOYSt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+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+fvUxjiHy9yuP4iPiIwVqMWJ9UeQXNgg4qbCg62b1jdmUCh27fKUBJz2qWK9rL3DmQ6pTnOcretpVE1sM2NwJeXUgAfpI8kBj+N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-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 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;