From nobody Wed Nov 27 18:40:34 2024 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011054.outbound.protection.outlook.com [52.101.65.54]) (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 3FC42178389; Tue, 8 Oct 2024 09:10:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378660; cv=fail; b=VccmbvSUW0RRC1bFnQu10Mp19VyKObMffEeQEP1ms5iKu0A9V0xRef9YNGM27ZmdJbaieN0HDYbrQ9I90blxmAh1OQV9WZCOYe1Zary09aKwvh5qkqy2GLiWP7wwlqICpxA/I3KEMtmEYyKpX0l2NMZgHrGJ3BMgwqcnpa2C9VU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378660; c=relaxed/simple; bh=+cMaQLokvahFRR2otSTppMDHy3p/3/JJvFFinvPDe4A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=rGIUDJ3WcVmPvTqS/KcwxvOJc251xhf30mpVynfwu3OEmoRVRcQag52X7PFc9d4uIhJdXAD0Fkk1eQ7zf2x3/roJAUIhIOIwgu/DVgHw8Y03Rvp+teFthCcku3XVOf8cXbeS1TxHLVdMMiz1ADHdM+yr8KXZ6oAxy0lWdUQ2YBg= 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=QpYYo6e8; arc=fail smtp.client-ip=52.101.65.54 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="QpYYo6e8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dxBPm6PWXd7S8SvjlSpH2qgtlLN+pz5sUt2OLNEsXjh4BAl9D9ZbVpa9KT+ILhWUeWTtuPrrOEhypGGTPLLBZMnVE0u0YBeoYmj4xZOUVXs7V6oa+5O3xhv+C1hl8rREBTkS0DQBuzTXPMRx5vHPes/2EHUpHY5fE08jnyCS75iNy2dkbiOepMGpdjbY8jXfWrkUEizIl7SJXixX42Wxdh3rUzbXNnu9rmnNMp7XgUjT3NMy6sqy8yApxUJGOdM+I8IX5/QzKU2dHZy4jtoke1i5G312urUfMKGdZJkJM1PXwYasqX1r9orZLo4QLJedTl9N2EBrKQiFYejg3eHmPg== 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=hBo4dqDcbD9b3dj8EX/DQX/hN5QgSthhY9reACEwePM=; b=H7zO4c8QXeb0X23P4HmS8N2u+D21jG62gQFnDbWt1BTbczzTO2P/ep7WO8adPyB4fZ6LGn/c+4zpQZXS18k1QumVHzhha43kjXDPsHGnBeO1Eo731SNp5TBndv3DQvCH4Xw3UITeDfenoJVdFOvXDvajdJVtJiptUtXC73I/GE2zGY+6WxmnD1mVi4lRP/D7IUkhHdlR89ZLnWohg3rVk+1JATMnjspbFszAb3edG3oFF1GRsFB50CXTMUXDTmGnGJqlRVpSM0inIrurQyQ5IyZiQ4R/ukIdZbr1zC/actwn2Lo69jfCdpgBKkaZ1Els9XjoJ5gglI/mKv7k9WKHHw== 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=hBo4dqDcbD9b3dj8EX/DQX/hN5QgSthhY9reACEwePM=; b=QpYYo6e8nYH55Q+3tQYYyLETexyXO5CpuuDHqiX2igxnKxAqdF32a8xwGp61hCTlj7jaWxZ3logOnMvuKB8w2XYcyjDSsJa4cMIjGJV3lAkMJw2Usw7qxeSsSxFX3r+qi9zwuf8896JPdqxVQd4P0894ifTgduTD0oyayUPkt/vh8FzDSfevIfn4/9Mmw8/j76qy71qoBksGm+DE0J8NT3mfaex2VgTxr3HqElPXIzDKRIUv5t+h2HrhoKA8poitiiOEjpha2ooQ0hMr+HB09nPS70gqej4DrskrdpiHMsGRcrSF8YtBTtFNKKbEMkGIG3nq2TNwATIFzY81dREW5g== 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 AS8PR04MB7544.eurprd04.prod.outlook.com (2603:10a6:20b:23f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Tue, 8 Oct 2024 09:10:54 +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.020; Tue, 8 Oct 2024 09:10:53 +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 v5 1/2] dt-bindings: net: bluetooth: nxp: Add support for power save feature using GPIO Date: Tue, 8 Oct 2024 14:41:58 +0530 Message-Id: <20241008091159.650531-2-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241008091159.650531-1-neeraj.sanjaykale@nxp.com> References: <20241008091159.650531-1-neeraj.sanjaykale@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS4P190CA0047.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:656::11) 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_|AS8PR04MB7544:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b712f6b-1d97-4f30-f5d5-08dce7791c88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?TetU+yeqYm/vt4ebnGXes8mh241bl1CBhTZdlatKEaJbFu8O85ajVyqD3WTk?= =?us-ascii?Q?Bu/87TM9FgbPqANAkIndRNTiHueZtXXT8G3Myg+o6/1opFZhlyGIxphIq9UT?= =?us-ascii?Q?FKKEBx2/8x300E7IA4z6tU4uaRDSHSyLPq3GiyYz1vatAZMD3qcltkK1nDLX?= =?us-ascii?Q?ZOyG/QeggF91ZajnSjCF/8tFHnAtrDCeJ9CxoYN+rXaTMocWmFka77JYJ7Nz?= =?us-ascii?Q?zt6/cC8a8ivns+Y9eMJ6xq44s4dpiLA2VaZvZUp9j3q9JPQ+0E3RbnokVJ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1TiCn4Px+XMuJBEVQpiPGwHUFC2zPdBYgk?= =?us-ascii?Q?QUvSgb2rHjoS071QhBiy+KcnunSAYm1BYtsYd7r1QbxPO8leCdj0pG9bWr8v?= =?us-ascii?Q?VtWM1CzSVwuaXLwooaJwrWpP1CzwN6lQUk1Y9kt/TVGDbaPzWnuoUDjxT1SG?= =?us-ascii?Q?WhxUaXL8SZ8mgHG6JGIIP+0wKJZY7yvb8oVsXKEIhSUiyg=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)(376014)(366016)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ug4zicIHn9euWi2gByXw5cDsF/PTJ4QWhi3IjyRUhph6hifp3exaMWwXhOjC?= =?us-ascii?Q?xkOMULwGR2FJVYvrg473ar8nF6B19wucdtRQzSHAuEtFH+JSfGitEhA4J5Bz?= =?us-ascii?Q?GLEmzh9aX2cNrZ8f3K68z4YpA1HOYBqyRmS6CcEdceT1rPYHrAcIr0Bs2E4i?= =?us-ascii?Q?FQf68JjoFn7R0E8FupY+iq7fAWPI7z3/+RftPAXWyLeWxIszG5slvBYE4t+h?= =?us-ascii?Q?Z7YC0CvsbhWKRZRL3oQCeZy63r9jW6FNPz9PnbZYejQYR8z+N4PwVa9a2jgU?= =?us-ascii?Q?1h6CJcqzo3xpR78cMh1SXr9+k3COyym4hvWiGm4o1sCOOf8k6T9NhPBDjZLO?= =?us-ascii?Q?3TiA7yDXCwpymNKSFwU6nFaMMTSvjWwXUCaxzfZ+LFhrPG3mBVbn89pPVg0b?= =?us-ascii?Q?ME67R/6gQHsKrJ5N94RoxSeEviMWIhqLLEMelTWCqyq9EBlGldk4Qy+n5CLV?= =?us-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+h0k9nOGrH?= =?us-ascii?Q?tT0tX5va+10impwAnFaP+LLOPepvg9UA7WM0+K3wrF7ypjlMOzKSvVo/RC19?= =?us-ascii?Q?LXw88utuLWRBiFSYHlNHrfoc+qNuiRRr4r/k2k+L9DwwWcNg1LMrpV73cwMp?= =?us-ascii?Q?zTLs8kDcfNVg9FxgP4b/QRSHyUiq4ZKYIeDDMcDbZj3+5X6bjD35TBCdCvUg?= =?us-ascii?Q?RkL6zatuVPxxzwSss/pBbGFNa0lnCyDFrG51flDkJ6EFFMBFgRAHIH77cNRj?= =?us-ascii?Q?/Q=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b712f6b-1d97-4f30-f5d5-08dce7791c88 X-MS-Exchange-CrossTenant-AuthSource: AS4PR04MB9692.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 09:10:53.8475 (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: 35a9c19nNfI4kH6pFfr7BPkrnsXSDm7RBBK/r4EnEFpMPjIOKR2Usz76SyVE99mTqqAJn9uCR64KHJ962hAlb2wk8CT9mKsBwamGRYEw57s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7544 Content-Type: text/plain; charset="utf-8" This adds a new optional device tree property device-wakeup-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 Reviewed-by: Rob Herring (Arm) --- v2: Rephrase description and use "-gpios". (Krzysztof, Rob) v3: Use device-wakeup-gpios instead of h2c-ps-gpios. (Krzysztof) v4: Add Reviewed-by (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..0a2d7baf5db3 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 + device-wakeup-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"; + device-wakeup-gpios =3D <&gpio 11 GPIO_ACTIVE_HIGH>; }; }; --=20 2.25.1 From nobody Wed Nov 27 18:40:34 2024 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011054.outbound.protection.outlook.com [52.101.65.54]) (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 55A7C17C7C9; Tue, 8 Oct 2024 09:11:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378662; cv=fail; b=YHlsiGSf+SY66IH9ny86w63Lx5PBrvUJ+s7aXtJxPOqkh1LnVqXZNSMZq7smZF/MQaUa/4xgFTqaksmM2VIL/PZFDxg4npScSSpQhV4+7uK0VuSmFlHm/MP7zBkw25w56a2+yA9KUYOuVtlgmIVEiMfRNlDXRHhk+28dfOHig3E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378662; c=relaxed/simple; bh=/c054IFxTP46+nz34Ct7/umyZ/AkGMOVKHhmNfoEbXI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VBXywWSr7ojerlgykaL2rsbw42oMGBv7q5pu7z9XRbjA5HL7un0Q6s/AnjlWSiavIQiiKEVfUBolee5Vf+nHHAjB6AvIVSqJq6C/V2p55EdqkKgLT7BhpRtZdVrF6spvVTFKa6TbdoS9ad3ySj2trj2Of54OQ1prgWH1f5XoDao= 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=JGvOqWs5; arc=fail smtp.client-ip=52.101.65.54 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="JGvOqWs5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wco5OHuxQDREOb/A4JNhcCVHSjN/nwr7qkQHP2Vkb7m8O7orwcwGdERWuWs5UPVfkmgh8ZJvI4wcD/p1/yV9L/3S5Zu4MW1UAQuaPrwCaIj6V3TaPjh6cHP2l8gzq0DSWWmdC8j75PJc+uQgqerF43PZoCXHqknfuBHPU8V3kWBRs7cf3oEglGEVzK5fqUdzA/a/gkh6EdjWnPTS694cQ1EOq+lF/cejmw//R8Yow3QLzrSmje6+CNJh7wSMiSg4kU8LuVQWJeJ9ET5SVqECvPycFzCfgkbF+4TVM3EDZwm9D8DiJ9JLu2tyFEybob80EQ9gByjv6WHtgqkhwrM5wg== 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=kQbhR5yGG+mtWg5Yo3cCpXA8AQT9HOh0GceAekqococ=; b=pOYLk92Dsk5h8nW0Bq9VQmes+rPgPV3906qU56ZnFEsCAWcqxr13yx4LwxTkulX2qWgEk7LvDICMJtIZSKYonZpm6qj2ZisQ8fsfO+vhsa216bv8w8npHa7biIGqdQAQylTUhOw3hdnpsYLz9IbAOW3uUqzRBjlvvZE1rYAvTyPXv07ngRYEisAL2qXmhMNjUcLa12oA5tvjL9iKuHJMlEBnxpwwgSJlntjH9S3+c1D0eeBr743g2wHJQ1sMVOCJ/mQN1VDSd8NYfvd0HXYKsZyz0HNTUY8jcQhSTvw1Lki6GpJJZtgdh9HccurWwpPCIowA7S8qbHx9ggHv+xI4jQ== 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=kQbhR5yGG+mtWg5Yo3cCpXA8AQT9HOh0GceAekqococ=; b=JGvOqWs5VMO3Ib7nOoYWsGpLjwa69ZfhDMn5MFvDzVU9+ZQ/emEYqiunaVTq2Ky0cUcwYVd644LJxgZSTP9LhDHlyW71TqF5IW0kcb/xsxySRsP8EqfOOcSZNs98uxliXdLa0juvRh7pK8ElX5+ufNgAF9J1yWAOHN1D1SSZma6j5Qxwnwz/HSI8CHw3W7f6hvLawNusx+9qLd1dkgOp7S+ycZhD8HoXRJX27CqsJ0E589GR0cu/CR7SdTteuq6BiEEpa4a1fcrGaV8ypi7a62RtkUpK33QZLs15YQKHBLYUBFzHNBYIZNitkmwEOoBh/9KsEe6X5kI4b9hCFg1SrA== 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 AS8PR04MB7544.eurprd04.prod.outlook.com (2603:10a6:20b:23f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Tue, 8 Oct 2024 09:10:56 +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.020; Tue, 8 Oct 2024 09:10:56 +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 v5 2/2] Bluetooth: btnxpuart: Add GPIO support to power save feature Date: Tue, 8 Oct 2024 14:41:59 +0530 Message-Id: <20241008091159.650531-3-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241008091159.650531-1-neeraj.sanjaykale@nxp.com> References: <20241008091159.650531-1-neeraj.sanjaykale@nxp.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS4P190CA0047.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:656::11) 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_|AS8PR04MB7544:EE_ X-MS-Office365-Filtering-Correlation-Id: 25538413-2911-4389-7c54-08dce7791e51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?EcVKS2D9boQJqaJdO2XVkHjG+ZJoKYhZnxIjDAihfOueA9nQFYmi51fkLQ7P?= =?us-ascii?Q?DxUtTDFEdE7k5XbeWcbnacBYV22lsvmVgr+/SsfHwsY7yhHJm107ZVS2vwGQ?= =?us-ascii?Q?9Wnv+fjFWOM7muQiLA3aMOt+Nd2ga9WOM6B42JCo7bcw78k/PidHrnJ0Dfmx?= =?us-ascii?Q?j+wPLrTMCknA+b53lZV41yAiwuSltLXHsx9MP6YNgwYH5h+f/+KHfYbgzwJr?= =?us-ascii?Q?3g8iMedb0z0r0IezaazHUT2SS2/MAGZl/Fy4qvenqtzJSnWqCDaAyrCRQtn5?= =?us-ascii?Q?Tkt7bcZEJ63YZmUx8YQnL3WYJbg0PA5JnRPjpuLzOsHjFxBQziy47d9FpJ6M?= =?us-ascii?Q?0R6iOT6T4X994ocamZlCoLMO0MRGizQXDIE8LZfqb5+LQ+0NAolNC0LTorFY?= =?us-ascii?Q?RcZhuG9enZleoYXa6e/POSpAyzc0zD1WmxpeQW+FUt9gkb+20xPFk4dAkH5W?= =?us-ascii?Q?uBygeg+ZQ64WiOYrOonZug5rMZLNI0L6t7KOUlifrYW8jCywQpZPBoDTYnqR?= =?us-ascii?Q?ISTsjFOTnHrrVuHO/oZJy2zFtGyBM1UI0DNkeEjys8lCwaCv59H7DsnB+N15?= =?us-ascii?Q?ozWSQEZdP4l8/gCtrx8DohCUL91bVdjvBC+ENi4C7SV7LcU2zgrXKkQ4I/Ew?= =?us-ascii?Q?NH1CVYKZuc0myGHlQICn1QxZw1/WnJ9ZIH5LCF54ZJxRBsgVHyr6mjmCP4pG?= =?us-ascii?Q?XxPMervztaLM61WSQWpgzQA7CkbAoO0FD1mCIwuvRMEXD9lKCaA0cW8R+ree?= =?us-ascii?Q?SyNIU3nmz5FKmrxrxJGydg4PfoXqE2yJp0ljRsQsfCLUrtH7QsI92i+q4Een?= =?us-ascii?Q?5cbDz3mc6vtVGRBIUBTUC8lLg4D4aflvVMwB82m9qu7w6SQeHJ4e6DO3zFU+?= =?us-ascii?Q?SDrBlZXrPNUKMdoSZueR8Fur5zf/14JRrjRfkh1F5R8z4fwGOo+8fnmENHO4?= =?us-ascii?Q?Upo57kjtjGTqFvcFlz74UUHfQLw/aObQJ9ZI7NO70LMg4P1+lXOShO9Ad1np?= =?us-ascii?Q?p/RhkIE76GDJbnWNZaFVu/Mcxa/PpfwTEMt08P4xhwvcprD9S8oz2j02jogM?= =?us-ascii?Q?PA308aHzMK6tzn2X4HgLl4D3/OgO2UCJ4OiN0+9Yg2ti4646Em6/aA7ryBfQ?= =?us-ascii?Q?bp5Qwcx1FXYHoGoxn5zkB010x4ROdg8Nhvnd4VW+D32hUVMoD6bVZQcIewgg?= =?us-ascii?Q?UACITCyuAjR/QKHV9ZO3vAlK8D5VHqGnIQf/ixbmrG7S1wDLhw9bQC1ZsyJD?= =?us-ascii?Q?2RpDsHKeGNgWcsYGBjRDER7wPMv0yig1wsP81IgLtKctqKh3lbcIfV81ukqr?= =?us-ascii?Q?sdT/i1HJ+pHz7G910ggyQWp83moYjt5/TFJjMQkEcYI9tw=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)(376014)(366016)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?V+lUDrlz57FT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kyNekELa?= =?us-ascii?Q?JwhnTsBOTkd9EL5OWRttLFY8E+cmmM0ebcm6Ws2YGgSMR2KWo3VMMQEwg42J?= =?us-ascii?Q?m/UmGuILM/FSyPMyRWBggmFibqwqPA2zAEuZzhq535dR4ilB8kOkqv1chXEE?= =?us-ascii?Q?W8TYNbNotsnkVw/bK4d3PFkjJWzlbVkEryitOWKhTrPLz/lTTdyC67VB/7+a?= =?us-ascii?Q?/9N8WsYxSvIAbSVzQq58PTwfJjRvXp+pjcPeQWA/r9+7jNPwDtWRL+wW8vuk?= =?us-ascii?Q?FVQ8r8XzXkfIkaSouJ8w1Dx16DMVvj9GjshWto0iLI1lGdkAe1/X2x8mOZZG?= =?us-ascii?Q?1kF7OFCZXC5PPztzZzWHLyq8x07icWcz0EvEKPx6zBNRrvZ5ODj8Pt2KLVoX?= =?us-ascii?Q?JqNKWA406zaGLuS8CdJC8/JoEJcBi07SWjeE3N9ePn5UccbuyU4Oxbszozu6?= =?us-ascii?Q?1ZIR8MwyQOrpKKB/EuHSwuJZPsC8gf8xW9Hdlz9EriFpTq8edUM/yz/yNXqY?= =?us-ascii?Q?fpfkP1okmarKEJB9eMk2RHQ8SZYqJs7i8OlSlrprRDXItxHIAwpGLVEgIOf0?= =?us-ascii?Q?zFmHNPhNVoy5P9luEYLfkxuQaFhWf/i3O9gGhM4IoB99/WMJ8TOWkrNKEMY4?= =?us-ascii?Q?oM6VcEuxbGI/epOLfZeKwEL/bqWPRdU7gj6wtoAabmhO1bhoLhnKcBBqkFc1?= =?us-ascii?Q?T/TfGmEMiKua/Jo9VqjdKEpce/5dJF1qOSo4AA05FUV7KyCtymCn1skrUyT4?= =?us-ascii?Q?Fw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25538413-2911-4389-7c54-08dce7791e51 X-MS-Exchange-CrossTenant-AuthSource: AS4PR04MB9692.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 09:10:56.8224 (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: 5Igvsrv+GY9GeWmV68swORV8TPyQc7rW/FFcg7ngrUWJYofgty+Jk46a1uhEkzQFO0KEvH7mtyIUhBkmu0QqgrnyxSxe6obcAatWj6Uc7CM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7544 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 device-wakeup-gpios 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 --- v3: Remove GPIO toggling in ps_init(). (Shenwei Wang) v4: Use devm_gpiod_get_optional() instead of devm_gpiod_get() v5: Fix compile error due to copy-paste. (kernel test robot ) --- drivers/bluetooth/btnxpuart.c | 57 +++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index 2b8a07c745c9..ff4acc7347a2 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,14 @@ 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); + bt_dev_dbg(hdev, "Set h2c_ps_gpio: %s", + str_high_low(ps_state =3D=3D PS_STATE_SLEEP)); + break; case WAKEUP_METHOD_DTR: if (ps_state =3D=3D PS_STATE_AWAKE) status =3D serdev_device_set_tiocm(nxpdev->serdev, TIOCM_DTR, 0); @@ -422,15 +433,29 @@ static void ps_timeout_func(struct timer_list *t) } } =20 -static void ps_setup(struct hci_dev *hdev) +static int 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_optional(&serdev->dev, "device-wak= eup", + GPIOD_OUT_LOW); + if (IS_ERR(psdata->h2c_ps_gpio)) { + bt_dev_err(hdev, "Error fetching device-wakeup-gpios: %ld", + PTR_ERR(psdata->h2c_ps_gpio)); + return PTR_ERR(psdata->h2c_ps_gpio); + } + + if (!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); timer_setup(&psdata->ps_timer, ps_timeout_func, 0); + + return 0; } =20 static bool ps_wakeup(struct btnxpuart_dev *nxpdev) @@ -516,6 +541,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 +578,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 +590,17 @@ static void ps_init(struct hci_dev *hdev) psdata->c2h_wakeup_gpio =3D 0xff; =20 psdata->cur_h2c_wakeupmode =3D WAKEUP_METHOD_INVALID; + if (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, 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 +1317,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; @@ -1509,13 +1550,17 @@ static int nxp_serdev_probe(struct serdev_device *s= erdev) =20 if (hci_register_dev(hdev) < 0) { dev_err(&serdev->dev, "Can't register HCI device\n"); - hci_free_dev(hdev); - return -ENODEV; + goto probe_fail; } =20 - ps_setup(hdev); + if (ps_setup(hdev)) + goto probe_fail; =20 return 0; + +probe_fail: + hci_free_dev(hdev); + return -ENODEV; } =20 static void nxp_serdev_remove(struct serdev_device *serdev) --=20 2.25.1