From nobody Thu Nov 28 05:42:28 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2072.outbound.protection.outlook.com [40.107.21.72]) (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 C07C81A704D; Thu, 3 Oct 2024 15:44:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727970262; cv=fail; b=JEfS3qcm2bhUGSemq8dkTDLpxsgGkiPBiqC8h0VM9PyA4+x6hnMN8kgmYBuNOmqRFJiItxh1fOXDBrQS5tB/JUNepZvha1wCitno3W0CBOh4gN8zZY5rxoVqhwyEwSkKPins600LKEqh0VeSrCBuyY48Bmsu8PvrFFLNaq4QTRk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727970262; c=relaxed/simple; bh=NtMaJac8mGAtyFIordmSzKmqfTiTgRZep0J+cDZej88=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ensoAq1nlPHdVY6qWOFBT9pMsn5P/E7VBhk+TibyJ6qEOcOHzg8MCspMYlNVCxg2OEq3WnLDItcN3X0YFSiDJwpo2/kKSkjznhcUsraYrsuGRpfD8FZ7MNRhZ1fNBf0SjvAsFTkS2zcMOXn04w+vVkeGqAw4frBysZy0ye+EdRM= 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=ej3eU2sQ; arc=fail smtp.client-ip=40.107.21.72 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="ej3eU2sQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Sy3CZfZYbtOlG3VFljbfHdEAVwV/VXdWJMrDRJf3EBFMw5szgSkSPusLwDNszVsdsyYoZZjJy59QXm22HeYS8xYkclRrsYRYgHwRZ5F9QnTpdh2P54OlEI1yJ0JBJ5ljiRBCXnF6NLQPG56LpeOUb89GS7QAff6aRWc28i8vsUdNCRQwtySZzY7cEtiDom3Z24/UI1BxPMKh7nKqeK5SRUqc7B4Dr44LkrWJYeaJqLZ+dx+4BnK47Qf3k5BH3Gkg+TT7sHc3Mer7QyF3TuC+9gd8u8w29DZdshFUZ5kWTdBOzgT+jehLKPE07IShYgrJ1dcf431UeLq80Ej+n58Sxw== 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=ubrrvonXEWsXc6UW6BKfM3J76YREE4wFkYi0VaB+6Co=; b=N3sK7+BFd7aX4Nuv3pSSKScGBEOrJKuDh7SsbhWUB+PweMl5YgzN/gH3Gj2qpCs+DxWeakKhOBIseSex5AMpVbGnV+5/FHUpofApGLcl4fm5/5TiQ1mDPRoo2Y9YBDfHfFrnnsxi4ABMd05uNugNQMKko0nHJFX6e/cfj4vOu4UqKK5C5P6B9FQlNxPgUaGr0nRsnjk3LG58bTWhphosluOQjO+p8zwwedisYnno+kWcELsLGWdE94nT6W/De7p6d2g3ZP6FW4AMknox3zgPPuNdLXVtm1TDVneHHkC2NnGiL13q8b7dzIL9MDrBYtJaN/jNlUyrCoVqo0UaEBPDvQ== 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=ubrrvonXEWsXc6UW6BKfM3J76YREE4wFkYi0VaB+6Co=; b=ej3eU2sQc0Wq1sEEohb8vSarNRMJFo/N0Q0XbwNl/ybu7axonvtuQcG+6ctoqJNfi1e0HiIhTxPg00Vv2LlRojhJssEzW0JDoyqrTXJPzqjPy2o9h4RZjZf6nFpIwKJNas4jy0ByjNQq7c+w4n+M4I+Xotd2GRLTWFwP2uwDfHXXqfefCKQ7g5yID5pbphsRzXRhnlIr7sYxAZppmYWPydTttL5AHzN9IWavvuJHUaSqxTiTGCI/l5pIIzfOUjMFmAf7Sp3stND6eAYWc0R7v0kBxxCdAnb0gkmbjOzZW/l2Xh5qM4BD6tjnrgWlY6J2rVPU1S5TH15J3zjk52uTcg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS4PR04MB9692.eurprd04.prod.outlook.com (2603:10a6:20b:4fe::20) by AS1PR04MB9558.eurprd04.prod.outlook.com (2603:10a6:20b:482::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.26; Thu, 3 Oct 2024 15:44:15 +0000 Received: from AS4PR04MB9692.eurprd04.prod.outlook.com ([fe80::a2bf:4199:6415:f299]) by AS4PR04MB9692.eurprd04.prod.outlook.com ([fe80::a2bf:4199:6415:f299%5]) with mapi id 15.20.8026.016; Thu, 3 Oct 2024 15:44:15 +0000 From: Neeraj Sanjay Kale To: marcel@holtmann.org, luiz.dentz@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amitkumar.karwar@nxp.com, rohit.fule@nxp.com, neeraj.sanjaykale@nxp.com, sherry.sun@nxp.com, ziniu.wang_1@nxp.com, haibo.chen@nxp.com, LnxRevLi@nxp.com Subject: [PATCH v2 1/2] dt-bindings: net: bluetooth: nxp: Add support for power save feature using GPIO Date: Thu, 3 Oct 2024 21:15:06 +0530 Message-Id: <20241003154507.537363-2-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241003154507.537363-1-neeraj.sanjaykale@nxp.com> References: <20241003154507.537363-1-neeraj.sanjaykale@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR03CA0014.eurprd03.prod.outlook.com (2603:10a6:208:14::27) To AS4PR04MB9692.eurprd04.prod.outlook.com (2603:10a6:20b:4fe::20) 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: AS4PR04MB9692:EE_|AS1PR04MB9558:EE_ X-MS-Office365-Filtering-Correlation-Id: ace76344-280a-4b8b-4c1d-08dce3c23c5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?LfFtvnzmetFwuFGacr2EFzgEX+yo5FcAWI9E6fcRjb4aZ3GJdZGAJFptwwAb?= =?us-ascii?Q?lgLFoOKufbFf1gbUMwxG7HQZB5jC9nSmR9gsov2+OHCvXmK6vT9PQQ8+YD0A?= =?us-ascii?Q?2MA6Vyo7G8d9gTmLdllJfm2e+dkAcmjZv87fXip++yE3Cw+LgM5l/sJwZjoy?= =?us-ascii?Q?kqS5agb+xyDzJJrDNZnFqEQ2r0yRxRA4VTACo3dkbv+vxb7FiU+I0Oyb1+rJ?= =?us-ascii?Q?45sUzmFY3lI5zrLVpD9iZyZX7+iSBVJoYRea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/QTR7OkCfhEBJovxjwy1hFizeC3dnhcRXXhlkGjuinV6t?= =?us-ascii?Q?weCYl10Lbz2a9r+DAX4HfTPZviENJvAc3khDimmRcu2kDxCGJT1J/h9rdeHO?= =?us-ascii?Q?+zcTyXDHXPLKEwHA+so8oS4ZUmEVqqQ+oPvdP37OGVe3x7xRqb1HgzGXXBVt?= =?us-ascii?Q?MzYHzF1Jt/eWi2iF0w8Z9PZ55Q+2uDvgsPqG6bQ6DZyOqg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS4PR04MB9692.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jlEoNYryLHPqE1DNg3TGRgau8+0CqjW+DsM3rAzcEY+t48KNF36vHMTrCv97?= =?us-ascii?Q?eMnxeuRheNEWIGtj3xHeuI8kWad3zEe4roiIq3/wob19vZGauIL6RnWQTlWQ?= =?us-ascii?Q?MYxIYN9f1/LgbtvS3XqNmupttuEwpe/yp2dhwGsxqXlslWXwzhE+uPMnku6y?= =?us-ascii?Q?+P09FOB2sZYq6LfkxnxgBRDGsuDJfyHdu+sxhwNN8eG7hCwSro/WR1fbxoEf?= =?us-ascii?Q?hyuVircrmLw6yeJWb1RHmVsNQvlpQjdb0leTi9iZ23fHu8HrTJjG7Ruj2Fs5?= =?us-ascii?Q?2rPJCq4VjCoBj6Z7n62P7LuYW0+CSA9Zuj/n4IwbwXKwl2DUwkE3VLpTRQ2D?= =?us-ascii?Q?d3EeU/TvBhW02l1dQlJy7ZxZ6aK2DaMbjnRRCkGKlN1C9PT+gv2iAZhsG0WF?= =?us-ascii?Q?c3b8ehTN54F3LVQlxnIXwF6uywxd05zSWrW8zCofodB3sY1BBcF01w1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VRKpYF4DBp7uPhjRgWD4TnitICKYie?= =?us-ascii?Q?UdmH803ZmZNDsoRRSe21cuNxoyZSn6zz9jk1pyPPMdJKBwMymigNyabKJ19d?= =?us-ascii?Q?TP/shGPXPwEGKq6hWgysTd+h6rOh4RLCkYcAU0BqLEkRV8S7VpiZIGDC5aP2?= =?us-ascii?Q?neCbttCxwshMKiSZ2ssEXdZ6iL2iuyQkm8cbPVZX3Cv8RF1csCnK4+YMq9cO?= =?us-ascii?Q?7MFjQ+hnOJYrKkPjVg4/XJC3bbqZyFvSZKAGw/FvOtIwMH8yotmo9NpcVT6t?= =?us-ascii?Q?3g=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ace76344-280a-4b8b-4c1d-08dce3c23c5e X-MS-Exchange-CrossTenant-AuthSource: AS4PR04MB9692.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2024 15:44:15.8235 (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: zPCRnxbZcr9IYKaWq+Ac2RN1OeXzn4YkDxT/4GZFwtd4nKNRMxaA34OezHUUzLXJXq0+aEpvGC8pEEKwRAhfY7MUJcbNaTizbn9jlZ27tkQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9558 Content-Type: text/plain; charset="utf-8" This adds a new optional device tree property h2c-ps-gpios, which specifies the GPIO connected to BT_WAKE_IN pin of the NXP chipset. If this property is defined, the driver will use this GPIO for driving chip into sleep/wakeup state, else use the UART break signal by default. Signed-off-by: Neeraj Sanjay Kale --- v2: Rephrase description and use "-gpios". (Krzysztof, Rob) --- .../devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt= .yaml b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml index 37a65badb448..cd8236eb31de 100644 --- a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml +++ b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml @@ -34,6 +34,12 @@ properties: firmware-name: maxItems: 1 =20 + h2c-ps-gpios: + maxItems: 1 + description: + Host-To-Chip power save mechanism is driven by this GPIO + connected to BT_WAKE_IN pin of the NXP chipset. + required: - compatible =20 @@ -41,10 +47,12 @@ additionalProperties: false =20 examples: - | + #include serial { bluetooth { compatible =3D "nxp,88w8987-bt"; fw-init-baudrate =3D <3000000>; firmware-name =3D "uartuart8987_bt_v0.bin"; + h2c-ps-gpios =3D <&gpio 11 GPIO_ACTIVE_HIGH>; }; }; --=20 2.25.1 From nobody Thu Nov 28 05:42:28 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2072.outbound.protection.outlook.com [40.107.21.72]) (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 DB4881A724D; Thu, 3 Oct 2024 15:44:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727970265; cv=fail; b=bzQUTHHfOh3oWvoSJ+2FQX+QRmd3TlC6WyPW2O2KzO1f56Q860+bsjwo2un4GU8S85eLkVZfxn8w2r7AKHkidPHJY3APsQ+N3gF5RjrNbBVx9tHykYd/TVSe7hEwWhJXRy60IG9NCAZUl1B5i1ozjfJKG+OOIudxLQNDmCRmUiw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727970265; c=relaxed/simple; bh=FL5XW6E22qkOMTo8vI/ivCq1ZxxOjxs75S8IVl7MOsY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=u3jdcUpN+OGnG/9/Y6HjdmWY01UasenD1riAasRdSaQyD+IaXkQb9mNDJGS7WhKeW1Xn/N+mGrQwnJx6NFJFDHiJINzU08moNFcBytfdVEgBuNBrZZiy+G37YwQqsFCzhTpCkU2uKOcp60khZVEhKif6asG7aTNXiHe50LmuQAw= 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=ntInppcg; arc=fail smtp.client-ip=40.107.21.72 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="ntInppcg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DbKuLPUneg258Sh+PAwH2qXn43laE4R7S9ugfmnOlTWjGZE9uCppkv0M6MZAwktgqVeXZuarHzMO7IPFR9xSJiot4iqHYwZqy8g9dPM/e4/iv0qBDM/UfUFz7NGXsyJoeptl6fMOfzlTGsgAAPMVwFADmRB0hJHSqZxfkkIXrF76A6PmqOZ/xxULdQbFgc3ODdRnfm3Mr683zSHRGB8MX1SZdvn57qbk9Iv0JQpTd8zUG0NgAKp6P9gBfZBRrXmdJnfXm7M4MNSJQl9/+9DV+qRga8uwIi28iJE21SsWZ6Rx5zFa0xcuSs8mBBFU9MVkvsbhTk+0MmCyweFjBx9I8g== 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=LEdspdPYJvRWLeKM4/BKX8hkqLqgRy0hVwf+e3YIk1g=; b=sCqCc9ohiBf+kGrtd9Ocpa5YdC4f3mLc1t4MWfGF+TYEdC6mUawM9LZO9gPbrCgKXaiF3xv/UbRWITqGbgnozdnPkdHSnZb2htECSMXdptdjmvZq/USJEUXU0nXe1ZbNFJ4MrHXUjgHXArholQIg0VCIOMnlK9aOmmgr85QpyfTqg2nIwCqNUSLIZCjXsAR97KsgYsqefXP56lBSPniL40GDI8wgfavRykFdebdxmZDphE8zMQ4p4moqRSTno3ewjj0k9SkgMcoe+wcJpoiybhV+HCRQ7sodOU9rtgZeHNu/P97zGpbrq74RQd6onWsLI5OmNYtTry6q/2xe5FkKGw== 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=LEdspdPYJvRWLeKM4/BKX8hkqLqgRy0hVwf+e3YIk1g=; b=ntInppcgnXmh8h0FI7kTSc2EKsE+THYOAu0HVZLr2SVznwyw+LW9ajGqVDV43+BHKzbsCU34ieSUChQPt8nzwdvIePHi5nx/1yOvSYfkGfe60xvsY+Xi4Ic7nRDtFM9YKNB7RmmRsTPbet53uSxPE41gUDjE/zSMaFrQ/JT0Q8TpCdt1foruD82qG7GxUSOnWOwKgKgdUtERYh/VS90Qu1lVvpPaYi3V96cSXFmvS29zzNh96jsQrHkmv1pTBJorzooyuGgihbXaeJxrRtI/0PoS4R+RhPX+IzfIYq4TqezdNs6DLCjONrwnKk3PI1q54PkQvVNcFSFQlVdA40Qetw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS4PR04MB9692.eurprd04.prod.outlook.com (2603:10a6:20b:4fe::20) by AS1PR04MB9558.eurprd04.prod.outlook.com (2603:10a6:20b:482::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.26; Thu, 3 Oct 2024 15:44:18 +0000 Received: from AS4PR04MB9692.eurprd04.prod.outlook.com ([fe80::a2bf:4199:6415:f299]) by AS4PR04MB9692.eurprd04.prod.outlook.com ([fe80::a2bf:4199:6415:f299%5]) with mapi id 15.20.8026.016; Thu, 3 Oct 2024 15:44:18 +0000 From: Neeraj Sanjay Kale To: marcel@holtmann.org, luiz.dentz@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amitkumar.karwar@nxp.com, rohit.fule@nxp.com, neeraj.sanjaykale@nxp.com, sherry.sun@nxp.com, ziniu.wang_1@nxp.com, haibo.chen@nxp.com, LnxRevLi@nxp.com Subject: [PATCH v2 2/2] Bluetooth: btnxpuart: Add GPIO support to power save feature Date: Thu, 3 Oct 2024 21:15:07 +0530 Message-Id: <20241003154507.537363-3-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241003154507.537363-1-neeraj.sanjaykale@nxp.com> References: <20241003154507.537363-1-neeraj.sanjaykale@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR03CA0014.eurprd03.prod.outlook.com (2603:10a6:208:14::27) To AS4PR04MB9692.eurprd04.prod.outlook.com (2603:10a6:20b:4fe::20) 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: AS4PR04MB9692:EE_|AS1PR04MB9558:EE_ X-MS-Office365-Filtering-Correlation-Id: 8220803b-1e4d-47c1-0932-08dce3c23e16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ch8hJQBmuFCPDpt3HhovCUSLJ4X9dyddIGzxmHqnU1VA3JaT+aQdcJKE/fWY?= =?us-ascii?Q?bcioRWIorB6qkflEdSLZRDPI4VnssVUVEwelNUj35QoSQXfsYwww/Dj0qkeN?= =?us-ascii?Q?kwgd52KhBbEcgl+XsJg+b2KQx6kWAjz6KfqW6oVkjIGiUMJ6O+wf1dIcsxmD?= =?us-ascii?Q?VzyJ0DsNSXuMKxSjviLQlVxB8423dBeUM00rcQpa5b3a3MP+2SH17Cjr5gYJ?= =?us-ascii?Q?VEwXf5XROwPw7rUCcVwnZsjXjzuFCu299Yi9RGDaXeh8jrNXr91iKiUOGm0x?= =?us-ascii?Q?wBV97GC4Dd6FJpb375w7SVvlqaLxtnkBUTL/UC3KLCVoef764M3UIHcgMurt?= =?us-ascii?Q?2b+HCiMBhAZaLjXbxBBMZp1ealtnZAYewbT4pmyAiS5bpv9m3dxHru57+7Df?= =?us-ascii?Q?2HXgIXVDIeSsqIWE727IWUp9218B/WRJIXJatju0lfdS4fSh9gVD5xsC3kZ7?= =?us-ascii?Q?z0rvaFw7vMO4hrKEXYmJn1Hw8EA2/oWcz/AT4TjVG1xX5NfM80qB6UOYpLar?= =?us-ascii?Q?ipCE6dkOcvsky6mfe24z5nd2D6yKeblkq+rUP3+27tFGXCgx8PilhuWqB9tH?= =?us-ascii?Q?G3wr6a/eh4Kl6Tie56hX1wT9DbHepqnPlSHV83NhY+ARHjIcddVOtxnq01ZW?= =?us-ascii?Q?HwH3+HJjgahTwTFIfDdHvCLNi3xPHj/DLh/jV1Et3jnChXxfyh5O8EHXDZ6f?= =?us-ascii?Q?i1j1LgQg60J1io+bgBX/NI9t2ycuibOlj6FLLr7OP3BoqiN31X95AQILHPAW?= =?us-ascii?Q?zqFGiP/0xRnaQ5Nrj4mZa29WgDMm2AOFJRewj0a8et0yEeSQ2H3keCzfjP9v?= =?us-ascii?Q?KS7Sp3PxzcvE03f/E1alD/djzDWrHXCR6M7tYO9Jw5bLa7xY72ijlnIWt3ok?= =?us-ascii?Q?j+5UFyIciJ0yC9i+qfRfYPO2+X+zvqpxql0YEs02xUIzJTjZkxOLVTxIspis?= =?us-ascii?Q?nhmIUAOVz1IsEXFMWgasOUKQ0EGKleAwMTui+P6HS6BdqtF4IemHyopckeYB?= =?us-ascii?Q?Z2mXzj99vRDtA/4j9u9ZkDJD47z4tVlRQsHz4NbrT26oEMU47dZLhw8sakBO?= =?us-ascii?Q?Bn7eo9juh5VaYIg8xNAh6wZ6OEyobsj0l1/Pp9UL6TXwwbnY769vjsuVLM5L?= =?us-ascii?Q?Jk19bb7zuYcH3DF8N4Dw2/HE5MIqIoxEFzwMH0ZUsnWlL8i8m1GVZ0NMGyYA?= =?us-ascii?Q?O2A8MKC7Svv56wbS004zJXqrdSOImO3KLiw9rB2CeBoQyFMYmsAXi+CSHiBJ?= =?us-ascii?Q?MKjVfFPtBtiOCZOY/iNQVU5KRYWE19Q5ZtHXD+tv8iTz8uH7QCumKYbUloOG?= =?us-ascii?Q?+bMk/vy9zXRJ+8q76Fg1Tomps/TP3K65/R4yziL5CmVQIA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS4PR04MB9692.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HPR2FhXcsWWQE+kF6s3DrNA3TXX3L5QZ0J2TzTitJuCM/BHIAaFBKu/12Tam?= =?us-ascii?Q?578vI1wms7IzPufPN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mp1?= =?us-ascii?Q?D0RII+THHMZP0fXyK/Q1NAYJv6kJ9WUDmKie5Sgn0Y9f1jBekFc0Ow6VpGPa?= =?us-ascii?Q?L7nUqH8QGF/fbUrpDo3biN/LsClafIAOdXf3GtOfvio+SWQnHJfgQI6rQlfx?= =?us-ascii?Q?u68m+8eH3sNMfHCLDz0fiICMruWlBxpDmoupzKNRTr5c3flGY0yUqB3iUIfJ?= =?us-ascii?Q?fNycvWIp1W3MOSBLIwMq+f/9AMov5PK53dWQvEHwpqYbGsSdRdm+SlfOcVu4?= =?us-ascii?Q?NlXiyf2USW/g3PJYh/mv2GxpVnFkoOI92NtBLO7O38lWgylW6l740813amng?= =?us-ascii?Q?VsmXGEqy5CtE7ZwUEY/kWCUpzV6EFzsPHg4jXBtRO6uDdloBcT3Ryvg9Qvm0?= =?us-ascii?Q?xJedv9TdlNKDRtdK1VgSuaRiHSIZpV53kAnq7DvhxO2Bj/pZOnHEmfDeim0K?= =?us-ascii?Q?XfsKx+/EamED45YH6oQFQPopjixAmJN+Y0NXh6dpaO0KC/oY0R+NpsNLPfiW?= =?us-ascii?Q?sB9IGljJMbtx767NNSREP/5kWXguey/rGJcdi7rlcNniZOXGAXwFOf+yD36m?= =?us-ascii?Q?s2e0fOiH9416bMRmcmm17R1gRiorY3mIc66rid6/yjefx2WDvqTw41w4c/GV?= =?us-ascii?Q?kLbMGCclt/ICvConNSIaAIxiwhHGHfE7TRTwr5zmKJCXsn1ktcdLuBzngM/c?= =?us-ascii?Q?Pw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8220803b-1e4d-47c1-0932-08dce3c23e16 X-MS-Exchange-CrossTenant-AuthSource: AS4PR04MB9692.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2024 15:44:18.6962 (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: 0GCJnf0bGKsZbXW71mkNap/FkAbuYpVQVcUgplmGvl/DaM90bFkTyTLhsHt4v50M771F7Nbv50wZEXe30SG2n9icyq1+hCj/BvCTG+khDps= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9558 Content-Type: text/plain; charset="utf-8" This adds support for driving the chip into sleep or wakeup with a GPIO. If the device tree property h2c-ps-gpio is defined, the driver utilizes this GPIO for controlling the chip's power save state, else it uses the default UART-break method. Signed-off-by: Neeraj Sanjay Kale --- drivers/bluetooth/btnxpuart.c | 36 +++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index 2b8a07c745c9..327c86a0329c 100644 --- a/drivers/bluetooth/btnxpuart.c +++ b/drivers/bluetooth/btnxpuart.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include #include @@ -82,6 +83,7 @@ #define WAKEUP_METHOD_BREAK 1 #define WAKEUP_METHOD_EXT_BREAK 2 #define WAKEUP_METHOD_RTS 3 +#define WAKEUP_METHOD_GPIO 4 #define WAKEUP_METHOD_INVALID 0xff =20 /* power save mode status */ @@ -135,6 +137,7 @@ struct ps_data { bool driver_sent_cmd; u16 h2c_ps_interval; u16 c2h_ps_interval; + struct gpio_desc *h2c_ps_gpio; struct hci_dev *hdev; struct work_struct work; struct timer_list ps_timer; @@ -365,7 +368,7 @@ static void ps_control(struct hci_dev *hdev, u8 ps_stat= e) { struct btnxpuart_dev *nxpdev =3D hci_get_drvdata(hdev); struct ps_data *psdata =3D &nxpdev->psdata; - int status; + int status =3D 0; =20 if (psdata->ps_state =3D=3D ps_state || !test_bit(BTNXPUART_SERDEV_OPEN, &nxpdev->tx_state)) @@ -373,6 +376,12 @@ static void ps_control(struct hci_dev *hdev, u8 ps_sta= te) =20 mutex_lock(&psdata->ps_lock); switch (psdata->cur_h2c_wakeupmode) { + case WAKEUP_METHOD_GPIO: + if (ps_state =3D=3D PS_STATE_AWAKE) + gpiod_set_value_cansleep(psdata->h2c_ps_gpio, 0); + else + gpiod_set_value_cansleep(psdata->h2c_ps_gpio, 1); + break; case WAKEUP_METHOD_DTR: if (ps_state =3D=3D PS_STATE_AWAKE) status =3D serdev_device_set_tiocm(nxpdev->serdev, TIOCM_DTR, 0); @@ -425,8 +434,13 @@ static void ps_timeout_func(struct timer_list *t) static void ps_setup(struct hci_dev *hdev) { struct btnxpuart_dev *nxpdev =3D hci_get_drvdata(hdev); + struct serdev_device *serdev =3D nxpdev->serdev; struct ps_data *psdata =3D &nxpdev->psdata; =20 + psdata->h2c_ps_gpio =3D devm_gpiod_get(&serdev->dev, "h2c-ps", GPIOD_OUT_= LOW); + if (IS_ERR(psdata->h2c_ps_gpio)) + psdata->h2c_wakeup_gpio =3D 0xff; + psdata->hdev =3D hdev; INIT_WORK(&psdata->work, ps_work_func); mutex_init(&psdata->ps_lock); @@ -516,6 +530,9 @@ static int send_wakeup_method_cmd(struct hci_dev *hdev,= void *data) pcmd.c2h_wakeupmode =3D psdata->c2h_wakeupmode; pcmd.c2h_wakeup_gpio =3D psdata->c2h_wakeup_gpio; switch (psdata->h2c_wakeupmode) { + case WAKEUP_METHOD_GPIO: + pcmd.h2c_wakeupmode =3D BT_CTRL_WAKEUP_METHOD_GPIO; + break; case WAKEUP_METHOD_DTR: pcmd.h2c_wakeupmode =3D BT_CTRL_WAKEUP_METHOD_DSR; break; @@ -550,6 +567,7 @@ static void ps_init(struct hci_dev *hdev) { struct btnxpuart_dev *nxpdev =3D hci_get_drvdata(hdev); struct ps_data *psdata =3D &nxpdev->psdata; + u8 default_h2c_wakeup_mode =3D DEFAULT_H2C_WAKEUP_MODE; =20 serdev_device_set_tiocm(nxpdev->serdev, 0, TIOCM_RTS); usleep_range(5000, 10000); @@ -561,8 +579,19 @@ static void ps_init(struct hci_dev *hdev) psdata->c2h_wakeup_gpio =3D 0xff; =20 psdata->cur_h2c_wakeupmode =3D WAKEUP_METHOD_INVALID; + if (!IS_ERR(psdata->h2c_ps_gpio)) + default_h2c_wakeup_mode =3D WAKEUP_METHOD_GPIO; + psdata->h2c_ps_interval =3D PS_DEFAULT_TIMEOUT_PERIOD_MS; - switch (DEFAULT_H2C_WAKEUP_MODE) { + + switch (default_h2c_wakeup_mode) { + case WAKEUP_METHOD_GPIO: + psdata->h2c_wakeupmode =3D WAKEUP_METHOD_GPIO; + gpiod_set_value_cansleep(psdata->h2c_ps_gpio, 1); + usleep_range(5000, 10000); + gpiod_set_value_cansleep(psdata->h2c_ps_gpio, 0); + usleep_range(5000, 10000); + break; case WAKEUP_METHOD_DTR: psdata->h2c_wakeupmode =3D WAKEUP_METHOD_DTR; serdev_device_set_tiocm(nxpdev->serdev, 0, TIOCM_DTR); @@ -1279,6 +1308,9 @@ static int nxp_enqueue(struct hci_dev *hdev, struct s= k_buff *skb) psdata->c2h_wakeup_gpio =3D wakeup_parm.c2h_wakeup_gpio; psdata->h2c_wakeup_gpio =3D wakeup_parm.h2c_wakeup_gpio; switch (wakeup_parm.h2c_wakeupmode) { + case BT_CTRL_WAKEUP_METHOD_GPIO: + psdata->h2c_wakeupmode =3D WAKEUP_METHOD_GPIO; + break; case BT_CTRL_WAKEUP_METHOD_DSR: psdata->h2c_wakeupmode =3D WAKEUP_METHOD_DTR; break; --=20 2.25.1