From patchwork Mon Oct 21 06:44:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Ying X-Patchwork-Id: 13843676 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 374ABD3E18D for ; Mon, 21 Oct 2024 06:53:36 +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=1CmPpsfCkh6wybwvHtXbbWkKQwnl/OWMG4oEyl7Rc3g=; b=1H9Dey2kd1FzRyYHql6P1yvX3m uT3MMDUtMoVmQmzAVheMdp28If5PV0JyaxEd8QF/0IJcJKIkLmTw9RAN2tfCIoJpU+KRLU4IFxUeC h0iWs+Q66bC6+HArSLYLr8J2smGYSPwymqcZcJqEDJmE03N8C0k7GnqylfQWCJIEf0+PC+UumMYnl 3sTI1fX5EjEq8vCaNAgQCvCEbnX7iRFI8bheV+0vm3rgWNolpds6d0HDM0j2a6nWl86WBFoNYA6TD YcKmtYgw35hrHQ3ZiJ9guJXbiQyrjEElNiUVHVlcUitWng7BEYZerShuHkczsRiVM4MwPsV6wOkRn fII+2kxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2mI8-00000006HIO-0mzV; Mon, 21 Oct 2024 06:53:24 +0000 Received: from mail-db5eur02on20629.outbound.protection.outlook.com ([2a01:111:f403:2608::629] helo=EUR02-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2mAh-00000006FMa-1Bg2 for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 06:45:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZOZtqR2Rl0sFQvjVoujSBRWJfbpU2j/w1rZBp6tId1gh1yw7K8dzhTwvtq2dIyRIgpBWxhhg3s6+RshJEzfckY/+U31Jfzm/UmyzJA4HO5QRdbGw5aZEJhyYMOWNUOnfFtldwRV2DkNTV+kKugPZU5ItxhO7Mxl/lARK3MBAmqdaVJItesGlqymes4t0OXeb/k++QnOOyxg7I8wzmiKQwZskS79Vj1K8SgDAsh1surdby/hpEBVUi4zOpTBFJwBoFkVILy81PWsCxECIFOslvnzZRyc7mnfaSsr2rY3KY2zbj1nNX0+adQs9A0+LMh1j4f1b/m0MXMgB/KDoFawK+g== 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=1CmPpsfCkh6wybwvHtXbbWkKQwnl/OWMG4oEyl7Rc3g=; b=MSlRjW9edVo68mPXq9/VKWBhquSuk4pZyZwdizL9tg4wlxAF+XGgpe271fMcGXrEs1BkDmIcIMBDkuIgI7TBvtMscnkCPl58/CyKx6MpajkitQoR6CXkbUOBrTq7GYty1IUUDKcTr16tiupecLGX2Z5pfDmWtW8Dj8aqgw52CCTrUcVKWuD3BKw1bmHq78cO4UgcuznRBT+soV/k+619IN9mXLCcu/ztFw/jfV95QXZDs/Ol65WBFxQ/RE509TeefPzAusJZd6djHeSjIRCo1WkHbs2FUqR7G/fXKo+zdDHPvMibgMpU1f7KlVJmABaHVlgsO1+jmJ75C9RmqS3sbg== 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=1CmPpsfCkh6wybwvHtXbbWkKQwnl/OWMG4oEyl7Rc3g=; b=Dd1ucfXg6UrH+t2zQbXqt/KcO/mgZQ5tzZ0Sd1uu6CDoX370ycGxcsidJ5pFzy/eMoABnL4Bu0helpvGn9ufZMp7VOs4Iq4kWXKtTOxRzJlPk46v/lT0UGDUOvqb3Y8qyd+R/pvX48QaJIRx9X4jWFiApmEEQx+KfQ18sn8cHhlqV40969qzr7lO2KWfcqSUZm27XmHQhLqxMSGxFt6VMBxb5LdkvnAr/LwkUgYgpdiytdj1tvpCpOaaK+yfq/GsRK9rWsK50HshFl7y47scBVJ9AMv/TUOuHrDOXc+OcoqXA86noWJ5RLqTI0o9hwCWzF+RVGq0FeVypEMqOGP7RA== 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 AM9PR04MB8440.eurprd04.prod.outlook.com (2603:10a6:20b:3df::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.21; Mon, 21 Oct 2024 06:45:39 +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.8069.027; Mon, 21 Oct 2024 06:45:39 +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, airlied@gmail.com, simona@ffwll.ch, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, 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 v3 02/15] drm/bridge: fsl-ldb: Get the next non-panel bridge Date: Mon, 21 Oct 2024 14:44:33 +0800 Message-Id: <20241021064446.263619-3-victor.liu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021064446.263619-1-victor.liu@nxp.com> References: <20241021064446.263619-1-victor.liu@nxp.com> X-ClientProxiedBy: SG2PR03CA0111.apcprd03.prod.outlook.com (2603:1096:4:91::15) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AM9PR04MB8440:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ab3b379-8b6e-4d8e-b69a-08dcf19bf9e4 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|376014|52116014|1800799024|366016|7416014|38350700014; X-Microsoft-Antispam-Message-Info: tlQj8DfRsfs2wIOzk8hkCNSrybJgZmWlHdmaScEzTW5ajvhTbUFJtnlPx1w6IEnQG4XSDRVU0E5CGmOnqZExJ2jw+YkUoyFtC4ydSdnsVf7yUXJmqRpmKEEe8BBvQPPtyPoJVYd/8AQO0SotDWaLMUaGX3yxOrSsDIXk32+LfhteJIWWwgM8ivXR1NpXVXE7xFXVrvSmAKotbVZyt23H7xQTIYxkXZXC9H6qPPKnOTDSmXmOsB+GM1s8LiPnEOMVJNXEUd6M2TEpCPJKht7vW3pbEvHRXU6HRWCupG7v4D/EAfFbsXhYx0CNv3v/Nli36+CRwX+hUQBL1sZLOijDDrMBc1QLKlQaKIVkBI5PoSoo1uiLAbNqOD6quo+EHLeSwko3IvIcLoZdiPIKuptjdYVsS7jEfO3Zep0KW/x7K59VvoodqfiYShJI9JFoPKqb9x0BhPTCItfGuVP7QeirLxmEJAcD+zUtRIwyI71jaa+EcgGs77Y9hXeuTYZL2LMG59nl0era9A7UwZwckRA4P3FNpMzBwGdkw3j1MmnjcbcHPOfeDC1nuDE2Hvef4Sju1ocr+0zvkdLEOolYzu7SygWzQXGzsXL9XHELPOkb3H8knmEx2QhoGn4haOYGiwPBUMBcHp9ppzjspe/Ct+Vrq1jx9YSGfaa6w9JltkJCk6d64t3ZUs+8py1CctwiwzgLSLFMUJws9KTHxw+XU58+oICVEWXC7/rj+YSOKaI6ysy3s7VwC8tBnPcaAXaXNOALbrCBl6d8FcfiVkt+G3hTyDkG1Hax413/IY9pHWT4sGyxz3o9qh2zYu3KvmILzjCLbwCKt1+qyQXI0AkJFok+0bMtqy5MetGa2CqjMDxLP110xsj3Efw4cR8mJxs8mwI96397/mJLevH1EYdMtDlKW3w4oll3CUTPdwS1bIeABliM1F0fJeP8PpoI+bwlvH18o2X8kKjoocMjC1KwUs9raE9wiW/DIJr8r6VO7XqAPn4OFypczLKUhCLVeUFzirdmuCMCn4VNEeupJFc8r0TVmuMu7moxpxe/xyrSCYOyos+1r8nxzP0iwn+ZJlmDcSiIL7UQa8ztdBuA4TInoShYfXLMox4XcYwIUDj01b5P65rlZoL9J+dZIoKKBbCG7+kyuNjHYzFLNU6J/oGLd3NQpAeDTIxyyokHYLGUTPBGz1Ygx6THxsnqeRZDd0Yy8q1/msJYi20r0huksYnATFvUYv3b+7O124fwe53V11xKQ8ow4vPr/be8Kd3TftzUy8ku7XFHZICH894A/x2cj9Pv5bYpYUKMEtD5/Eh+o2yZL8bjYBxNVOP4boZ4Bd9O7N35FHKIeP1+pGLQnHFHYkUn2GLVFoDcmhXCR3IOp/46nDI= 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)(376014)(52116014)(1800799024)(366016)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fZGKM5r0xw+4/0ACkobUWp0U+/MmtwDG3pJIVKuqcjBnRAcT7ZCnDb106Ydup5UKSwXGnP1GbrGNhguxIJYnvVLpZs1J9u+zsNFy9IVEIims7TDlN/D0b54ukcqaNf1v14qvzJGzXgIWg/B+RLFzuYJ/NFjQQBtgH9Rm/4RVVoixlIE+cLqUd6SEvWUYYIUKvlUkswuNQmAGJNDFxXyD+iQ22rh7uLxt9surnUIyqRoBEnMlaOCcs5DdRGTjwXrhkbvE2sMTIS99kQlUfPHvWnrrBG/oR7NBE9rpjYYHH1Jv7wf8ctkScT487ZNc78kog3r0KXPiLxl8b01N55Q8tGUOHPNN+NFUmcGcSj3eKeuUHBaIi8VbgjUk0EkN5INHbuKb7lcjcWc97Y6UMBN6IgFFr13VoJo2w9A/aTZBs4EXPsdZyp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mH48XHnPcYQY0tstjII0Z7cu0DCG4Lkc29IUJzRD3RBNfDIPmimpXVJPSBRZO8V7msCMuJqbmR30KGpaPlz7B/1NtmWi/3F7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ab3b379-8b6e-4d8e-b69a-08dcf19bf9e4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 06:45:39.6420 (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: hhJSwcdH1sJ0WeDbFtWcipXaRNIM3XMc8lX7tAxl/5p7LupEg8QuEQ1gq1a+ysF9C0t3pBRfzqwyupKwkSEJug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8440 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241020_234543_359622_1A764CA0 X-CRM114-Status: GOOD ( 16.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 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 --- 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;