From nobody Wed Nov 27 08:45:37 2024 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) (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 E04E814430E; Sat, 12 Oct 2024 07:37:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728718634; cv=fail; b=tBnPaHluuhfF9BfqxFZ2zVqLp2yRn8RK2QGFP/ZuGbercz20jAq0lBQSlIUt1XNdAr1nMMq/qVJcdyZZqJegw3VR6Tm3HXr3nTrKpjg7wm768KYfvhopk3gS/tdhT3wZ/Uo4NaIYp0czPRZPFMMrL16KiPLl0jDfXNhcgUYbm24= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728718634; c=relaxed/simple; bh=fj9/Ly7dkEuYEdVsdsCMfP4mXPNUOXMBwhyU0ckUfhw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tVuK2SmpzMzuTFAKADAZRv9MAteE+uCIz5g60Ig3e6ZLQ1V/Iayz66eb8X/iFptw3TZbiXSnnagOEAfvMYs6ECMMGBm5OggiliymS9vXQmNnuDwAk5PNrRpPfjiAQyUKT9w9Jli25hY6jH2aW4qSzg4Nqi4amzj8fVSMQI/6X8s= 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=C+sZZA0c; arc=fail smtp.client-ip=40.107.104.81 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="C+sZZA0c" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yOkk+DQdvLkw+nrunFdw3ApS/S6RDi3fOu8GScaJgjrGng9221NW7GgpiYcXofkhIbkpe1+51J2DjtN2XBYoE42ehDp2voDuc+T8NBAGkLAtyb3/x3/bM809QhH2/VLUC3Y1Ucm++72HhpKhaDuM3giJAw+nVrbDumNwHPqK17TfcHNGb8+M2dADvOizOrHuO03FnXbMj2dnsmY5p3v+TrUIxJHDOKnSEfkfPb38NeOsfY0z1HIV4ar/fFJE2us6IGC3lDj621NuZ/dS3Zyo8GJ7R8vObeBN/aqUPY+Q/1bEkdx9gUkcDhaWrDEDjNG73aEtDrUHC+vkPhW1YHJViw== 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=jBZVQJTOrU/JnRQT+7SOzdF+c+EY5OzZfSCgS64pO1c=; b=h7KX7F5EPWNu8Gm7+EyXzE856IlaDvzM295P3NS4ztoIfz3DaCdW0KIhAP4yafzcbKpRq2bDtkP9Cq/WwZ12OUUgRlsHj10SKEYudLiKIM/C1umWRJtDRrJVhYIZ2ATPPNPK8KYIr/3IP+IGWfpddwOA9ZYZA74+EmmN1IbgfO6z/mh0c4NMXS9OiqF1HKO+3RMPud13js8niMYS1xJtgiVeByLCX1CqcEIhWp2L5JHvLYFXyFhW3CCQY71f85NIpMB4QbuQTzlsx25Y1pez+87qoXJ78Bt000IUpSA8gMNORygi2WRYv3vM9VdOujJBeTktNiPPfNJU9o5/nIx7DQ== 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=jBZVQJTOrU/JnRQT+7SOzdF+c+EY5OzZfSCgS64pO1c=; b=C+sZZA0cplY5hQU/bhy07KDxmHJiaLfYBQPgfbuduY0yNtANaYfaBBFlQYOidGsGMWrEFrJNEEGA8ycWaKldQ1bKWA/ebyUgDh8FvCSEk6Yf0df2EXU3yumUYMWJ5IVddBvXFO3AwfXX/KiR8PejdoXYwtS6XkRyyu7JvhxZduOXxUS8tM5sq8ZjMII4nRI8GiUahkEpt2H93yDi5RMNlf7ZROMfzS92+kvM0iKH6tD/l9FKPQhcjffBhbIUmzzdl5Wby3lxWf+31Xa1jktzIK7X9ou0jZdb7VvV69CL6Yo9EqBjnyrWjyIfy+nFxH6HKN0x8k2ZpGI6Ar+vzCk+VQ== 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 DB8PR04MB6986.eurprd04.prod.outlook.com (2603:10a6:10:116::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.22; Sat, 12 Oct 2024 07:37:10 +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.8048.020; Sat, 12 Oct 2024 07:37:10 +0000 From: Liu Ying To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@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, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, catalin.marinas@arm.com, will@kernel.org, quic_bjorande@quicinc.com, geert+renesas@glider.be, dmitry.baryshkov@linaro.org, arnd@arndb.de, nfraprado@collabora.com, o.rempel@pengutronix.de, y.moog@phytec.de, marex@denx.de, isaac.scott@ideasonboard.com, biju.das.jz@bp.renesas.com Subject: [PATCH v2 3/9] drm/bridge: fsl-ldb: Get the next non-panel bridge Date: Sat, 12 Oct 2024 15:35:37 +0800 Message-Id: <20241012073543.1388069-4-victor.liu@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012073543.1388069-1-victor.liu@nxp.com> References: <20241012073543.1388069-1-victor.liu@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR01CA0051.apcprd01.prod.exchangelabs.com (2603:1096:4:193::6) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|DB8PR04MB6986:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a6238b6-8869-4669-c5ba-08dcea90ae70 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|1800799024|7416014|376014|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?v1+4rSWeRfR2zNZ2VxrPxb7zlqAt2o5qBxCwhFXY5tv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STZdiq35ADNzU1bmKjjvBMlAHbuxc+8CTW4v?= =?us-ascii?Q?nO2tZW0Y2NyZLqKiY0KZnuSyyMif2S6eASFqolDhTcfTowubVpF7uk0h8JJq?= =?us-ascii?Q?SPGylvkt0+k2spZQroMEMYusp5MLmluKuxVh/GkTyhXTqXlMHh6xiyqnCaaf?= =?us-ascii?Q?br+a6EabB+fts7NuprE1ai+f1Op5r+bqURYXO/Zhc7c347LQ3EtZjNQZWbUQ?= =?us-ascii?Q?DI0InfkesDmnO5U0nrj8pt4r/xqLZVjPC6n7RSxm7ijq38y/KUt0F/njitOR?= =?us-ascii?Q?5LoSOoUArKglRPexFm2axJ0juYcwOZYrCJLeFRsW9OWFmjSkcIoDY5kRYAeR?= =?us-ascii?Q?VeqvC1FBlGho+i+4n3V6hiZqvI0ImFA6O+e/qQ7PjVnKaaFvTUD04gRYJavY?= =?us-ascii?Q?rj+cgkq9SUkmR0ELaMouNi5YWyGbdHZr1P/oQAGISTMugA=3D=3D?= 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)(1800799024)(7416014)(376014)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3Ep91U6uiqSQuAl5wxiuntU+lUUwg745ZyInXhR4bODPkk8u4SG2/T19xnXV?= =?us-ascii?Q?HBrcKK+pQwW50tly8f+wQ/vrY+Vfald6mk/TIquhtKttY8CRLYsWNkjKHfeh?= =?us-ascii?Q?7+r3/IJIRIm3q9gCwOc9aQyi7EKnUhZqRkOhkx5wJStDYLe4gq9WkOdtdVcU?= =?us-ascii?Q?oOE/UB3PzZDgGw1j9/TdzEpOOLnMgVYtDRAK+cco4+/m072NX/snoSH3Yjsy?= =?us-ascii?Q?dm1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ZXCLDA/?= =?us-ascii?Q?xmVP17md8Wn3duDZ7CBkBCQmVgHiWvMbEr5cE64YvkKiEBrNYZFBJ9noCaUS?= =?us-ascii?Q?h1l9FHFFK4Yz6FGEsQy03e1WWvHUvtrrlc/2Z1MipT8UcjNZw0IfPxa1Ec5L?= =?us-ascii?Q?x785CfjvnKYDgBymmfzqy6MlrzZ9RXLZyQm5XD24/H0/6eCFtq32nR2ailG7?= =?us-ascii?Q?84Pk0DlMeY6NSrQZXoNrvdB46s5Hncuc4EMlDQbfyLSHUn+hDcmmiiZFqlwk?= =?us-ascii?Q?toI2t9YFqtPnbQQTwWWPzF2SaKXZ6GxUWVYZKBkUwqzm2gnj14XClL5Sq6K8?= =?us-ascii?Q?PPBtyFu5h4oJ08Rp+wdefUOs7Z0C8F26x3/W3mt/Loded/jZGtRj7kQNIWFc?= =?us-ascii?Q?xcXUr/wJWOLYgkv2lxC77+4lqF3oo1LdD8qD8QGk4314ezq+Dx2wOLtOUe1+?= =?us-ascii?Q?wr4gkQUIC2tbNT4R/Zk3bATuI931rCitAWEXZ/6W?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a6238b6-8869-4669-c5ba-08dcea90ae70 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 07:37:10.4398 (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: JgWzLlYo5cMcrpBiTMMWGFEwZiBJ6mCMTn7JXb3DOkRcKDwy/bJVUXw99ZF12PWzNk6wxVbSfiQpMjLvHz5R8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6986 Content-Type: text/plain; charset="utf-8" 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 --- 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 =20 #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[] =3D= { 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 =3D to_fsl_ldb(bridge); =20 - return drm_bridge_attach(bridge->encoder, fsl_ldb->panel_bridge, + return drm_bridge_attach(bridge->encoder, fsl_ldb->next_bridge, bridge, flags); } =20 @@ -292,9 +291,7 @@ static const struct drm_bridge_funcs funcs =3D { static int fsl_ldb_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; - struct device_node *panel_node; struct device_node *remote1, *remote2; - struct drm_panel *panel; struct fsl_ldb *fsl_ldb; int dual_link; =20 @@ -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); =20 - /* Locate the remote ports and the panel node */ + /* Locate the remote ports. */ remote1 =3D of_graph_get_remote_node(dev->of_node, 1, 0); remote2 =3D of_graph_get_remote_node(dev->of_node, 2, 0); fsl_ldb->ch0_enabled =3D (remote1 !=3D NULL); fsl_ldb->ch1_enabled =3D (remote2 !=3D NULL); - panel_node =3D of_node_get(remote1 ? remote1 : remote2); of_node_put(remote1); of_node_put(remote2); =20 - 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"); =20 dev_dbg(dev, "Using %s\n", fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" : fsl_ldb->ch0_enabled ? "channel 0" : "channel 1"); =20 - panel =3D of_drm_find_panel(panel_node); - of_node_put(panel_node); - if (IS_ERR(panel)) - return PTR_ERR(panel); - - fsl_ldb->panel_bridge =3D 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 =3D 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"); =20 if (fsl_ldb_is_dual(fsl_ldb)) { struct device_node *port1, *port2; --=20 2.34.1