From patchwork Thu Oct 3 15:45:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neeraj Sanjay Kale X-Patchwork-Id: 832484 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> 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-bluetooth@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: LfFtvnzmetFwuFGacr2EFzgEX+yo5FcAWI9E6fcRjb4aZ3GJdZGAJFptwwAblgLFoOKufbFf1gbUMwxG7HQZB5jC9nSmR9gsov2+OHCvXmK6vT9PQQ8+YD0A2MA6Vyo7G8d9gTmLdllJfm2e+dkAcmjZv87fXip++yE3Cw+LgM5l/sJwZjoykqS5agb+xyDzJJrDNZnFqEQ2r0yRxRA4VTACo3dkbv+vxb7FiU+I0Oyb1+rJ45sUzmFY3lI5zrLVpD9iZyZX7+i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uDvgsPqG6bQ6DZyOqg== 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: jlEoNYryLHPqE1DNg3TGRgau8+0CqjW+DsM3rAzcEY+t48KNF36vHMTrCv97eMnxeuRheNEWIGtj3xHeuI8kWad3zEe4roiIq3/wob19vZGauIL6RnWQTlWQMYxIYN9f1/LgbtvS3XqNmupttuEwpe/yp2dhwGsxqXlslWXwzhE+uPMnku6y+P09FOB2sZYq6LfkxnxgBRDGsuDJfyHdu+sxhwNN8eG7hCwSro/WR1fbxoEfhyuVircrmLw6yeJWb1RHmVsNQvlpQjdb0leTi9iZ23fHu8HrTJjG7Ruj2Fs52rPJCq4VjCoBj6Z7n62P7LuYW0+CSA9Zuj/n4IwbwXKwl2DUwkE3VLpTRQ2Dd3EeU/TvBhW02l1dQlJy7ZxZ6aK2DaMbjnRRCkGKlN1C9PT+gv2iAZhsG0WFc3b8ehTN54F3LVQlxnIXwF6uywxd05zSWrW8zCofodB3sY1BBcF01w1ovVGaPwR/UAwLEeSLp4+LL92JvAco9MqQUVLBUdz6yVRZyqbsUmput5SRp79VMkFzL9TWAqxMMOU/C3CwpDnYnJ4YVp7gazpkKSf9SUJvO5+flBqlMrM7IUWn0JrLwplkeoRNRb2+HnIyhSycVLm/4QESnl1hrAVDyWxMHJMiln0T4fl0ddNAwioafO6c1iDrVKIkXgOxaWPS/FivKtEgd3oPpx0P4L/7yFinBUld0lP/x4fpzt/a0n/DuqCGwCS7OZa1Cu73qRPLEDbcsr9cqUN4R0GvZTQYJS/M10JZzwr5wbLfJoBg5ySQaK4D8eBk68MGvKam2j0n6bpnWPSdiTk3+eiS97pAEWRoxkJbnLnjQrs5JZGr5Sm+F7tR+g6N2Jk/Ps4PM608cTms+pog/pRpPfkpXNOuCxycbddNrp7Fjqv9+y2y4/f3lcClIlf5qmrF2JU7mD/VGji00llRL/uaWm0DSU4Ovrr+ERYUu0n0I1r5UoDhRaiJgAdUziusxm21CX2RvsLrh5ipBdmc5uDXuymZmIHygJ6E4SBIsUe+gbFXI14NZyPInur9rooDE/jTQ31fYRAAa6IlZ7QR69n2HOH87G3V6HjWgdjZyo9gUPh+gV3kESMKEuKbI9vHoirwHjAWPKDTJ1LWkIPxrazm7tMWeI3qUiULPJhAjbOC4LL8gVHeGedJlBU691PwNlLifAFEGM+cU8oH10KrKBUGC8PYEXNw1/y65Hz/fit4uLAMOA3h46vP3TPFQtclsU4+W92D3BmuOJfu40P3Owee/X3LWEsic8HJkDsBU38AfIJKSL1g0bJDBpNHcjWhDEoR8JBdbqka6gwHvkyDbIGcXaXcbQJkUMzkupQHsBVRKpYF4DBp7uPhjRgWD4TnitICKYieUdmH803ZmZNDsoRRSe21cuNxoyZSn6zz9jk1pyPPMdJKBwMymigNyabKJ19dTP/shGPXPwEGKq6hWgysTd+h6rOh4RLCkYcAU0BqLEkRV8S7VpiZIGDC5aP2neCbttCxwshMKiSZ2ssEXdZ6iL2iuyQkm8cbPVZX3Cv8RF1csCnK4+YMq9cO7MFjQ+hnOJYrKkPjVg4/XJC3bbqZyFvSZKAGw/FvOtIwMH8yotmo9NpcVT6t3g== 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 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 + 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 @@ -41,10 +47,12 @@ additionalProperties: false examples: - | + #include serial { bluetooth { compatible = "nxp,88w8987-bt"; fw-init-baudrate = <3000000>; firmware-name = "uartuart8987_bt_v0.bin"; + h2c-ps-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; }; From patchwork Thu Oct 3 15:45:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neeraj Sanjay Kale X-Patchwork-Id: 832822 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> 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-bluetooth@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: ch8hJQBmuFCPDpt3HhovCUSLJ4X9dyddIGzxmHqnU1VA3JaT+aQdcJKE/fWYbcioRWIorB6qkflEdSLZRDPI4VnssVUVEwelNUj35QoSQXfsYwww/Dj0qkeNkwgd52KhBbEcgl+XsJg+b2KQx6kWAjz6KfqW6oVkjIGiUMJ6O+wf1dIcsxmDVzyJ0DsNSXuMKxSjviLQlVxB8423dBeUM00rcQpa5b3a3MP+2SH17Cjr5gYJVEwXf5XROwPw7rUCcVwnZsjXjzuFCu299Yi9RGDaXeh8jrNXr91iKiUOGm0xwBV97GC4Dd6FJpb375w7SVvlqaLxtnkBUTL/UC3KLCVoef764M3UIHcgMurt2b+HCiMBhAZaLjXbxBBMZp1ealtnZAYewbT4pmyAiS5bpv9m3dxHru57+7Df2HXgIXVDIeSsqIWE727IWUp9218B/WRJIXJatju0lfdS4fSh9gVD5xsC3kZ7z0rvaFw7vMO4hrKEXYmJn1Hw8EA2/oWcz/AT4TjVG1xX5NfM80qB6UOYpLaripCE6dkOcvsky6mfe24z5nd2D6yKeblkq+rUP3+27tFGXCgx8PilhuWqB9tHG3wr6a/eh4Kl6Tie56hX1wT9DbHepqnPlSHV83NhY+ARHjIcddVOtxnq01ZWHwH3+HJjgahTwTFIfDdHvCLNi3xPHj/DLh/jV1Et3jnChXxfyh5O8EHXDZ6fi1j1LgQg60J1io+bgBX/NI9t2ycuibOlj6FLLr7OP3BoqiN31X95AQILHPAWzqFGiP/0xRnaQ5Nrj4mZa29WgDMm2AOFJRewj0a8et0yEeSQ2H3keCzfjP9vKS7Sp3PxzcvE03f/E1alD/djzDWrHXCR6M7tYO9Jw5bLa7xY72ijlnIWt3okj+5UFyIciJ0yC9i+qfRfYPO2+X+zvqpxql0YEs02xUIzJTjZkxOLVTxIspisnhmIUAOVz1IsEXFMWgasOUKQ0EGKleAwMTui+P6HS6BdqtF4IemHyopckeYBZ2mXzj99vRDtA/4j9u9ZkDJD47z4tVlRQsHz4NbrT26oEMU47dZLhw8sakBOBn7eo9juh5VaYIg8xNAh6wZ6OEyobsj0l1/Pp9UL6TXwwbnY769vjsuVLM5LJk19bb7zuYcH3DF8N4Dw2/HE5MIqIoxEFzwMH0ZUsnWlL8i8m1GVZ0NMGyYAO2A8MKC7Svv56wbS004zJXqrdSOImO3KLiw9rB2CeBoQyFMYmsAXi+CSHiBJMKjVfFPtBtiOCZOY/iNQVU5KRYWE19Q5ZtHXD+tv8iTz8uH7QCumKYbUloOG+bMk/vy9zXRJ+8q76Fg1Tomps/TP3K65/R4yziL5CmVQIA== 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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Do3biN/LsClafIAOdXf3GtOfvio+SWQnHJfgQI6rQlfxu68m+8eH3sNMfHCLDz0fiICMruWlBxpDmoupzKNRTr5c3flGY0yUqB3iUIfJfNycvWIp1W3MOSBLIwMq+f/9AMov5PK53dWQvEHwpqYbGsSdRdm+SlfOcVu4NlXiyf2USW/g3PJYh/mv2GxpVnFkoOI92NtBLO7O38lWgylW6l740813amngVsmXGEqy5CtE7ZwUEY/kWCUpzV6EFzsPHg4jXBtRO6uDdloBcT3Ryvg9Qvm0xJedv9TdlNKDRtdK1VgSuaRiHSIZpV53kAnq7DvhxO2Bj/pZOnHEmfDeim0KXfsKx+/EamED45YH6oQFQPopjixAmJN+Y0NXh6dpaO0KC/oY0R+NpsNLPfiWsB9IGljJMbtx767NNSREP/5kWXguey/rGJcdi7rlcNniZOXGAXwFOf+yD36ms2e0fOiH9416bMRmcmm17R1gRiorY3mIc66rid6/yjefx2WDvqTw41w4c/GVkLbMGCclt/ICvConNSIaAIxiwhHGHfE7TRTwr5zmKJCXsn1ktcdLuBzngM/cPw== 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 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 #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 /* 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_state) { struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); struct ps_data *psdata = &nxpdev->psdata; - int status; + int status = 0; if (psdata->ps_state == ps_state || !test_bit(BTNXPUART_SERDEV_OPEN, &nxpdev->tx_state)) @@ -373,6 +376,12 @@ static void ps_control(struct hci_dev *hdev, u8 ps_state) mutex_lock(&psdata->ps_lock); switch (psdata->cur_h2c_wakeupmode) { + case WAKEUP_METHOD_GPIO: + if (ps_state == 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 == PS_STATE_AWAKE) status = 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 = hci_get_drvdata(hdev); + struct serdev_device *serdev = nxpdev->serdev; struct ps_data *psdata = &nxpdev->psdata; + psdata->h2c_ps_gpio = devm_gpiod_get(&serdev->dev, "h2c-ps", GPIOD_OUT_LOW); + if (IS_ERR(psdata->h2c_ps_gpio)) + psdata->h2c_wakeup_gpio = 0xff; + psdata->hdev = 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 = psdata->c2h_wakeupmode; pcmd.c2h_wakeup_gpio = psdata->c2h_wakeup_gpio; switch (psdata->h2c_wakeupmode) { + case WAKEUP_METHOD_GPIO: + pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_GPIO; + break; case WAKEUP_METHOD_DTR: pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_DSR; break; @@ -550,6 +567,7 @@ static void ps_init(struct hci_dev *hdev) { struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); struct ps_data *psdata = &nxpdev->psdata; + u8 default_h2c_wakeup_mode = DEFAULT_H2C_WAKEUP_MODE; 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 = 0xff; psdata->cur_h2c_wakeupmode = WAKEUP_METHOD_INVALID; + if (!IS_ERR(psdata->h2c_ps_gpio)) + default_h2c_wakeup_mode = WAKEUP_METHOD_GPIO; + psdata->h2c_ps_interval = PS_DEFAULT_TIMEOUT_PERIOD_MS; - switch (DEFAULT_H2C_WAKEUP_MODE) { + + switch (default_h2c_wakeup_mode) { + case WAKEUP_METHOD_GPIO: + psdata->h2c_wakeupmode = 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 = 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 sk_buff *skb) psdata->c2h_wakeup_gpio = wakeup_parm.c2h_wakeup_gpio; psdata->h2c_wakeup_gpio = wakeup_parm.h2c_wakeup_gpio; switch (wakeup_parm.h2c_wakeupmode) { + case BT_CTRL_WAKEUP_METHOD_GPIO: + psdata->h2c_wakeupmode = WAKEUP_METHOD_GPIO; + break; case BT_CTRL_WAKEUP_METHOD_DSR: psdata->h2c_wakeupmode = WAKEUP_METHOD_DTR; break;