* [PATCH v2 1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup
@ 2025-04-14 17:21 Neeraj Sanjay Kale
2025-04-14 17:22 ` [PATCH v2 2/2] Bluetooth: btnxpuart: Implement host-wakeup feature Neeraj Sanjay Kale
2025-04-14 18:00 ` [v2,1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup bluez.test.bot
0 siblings, 2 replies; 3+ messages in thread
From: Neeraj Sanjay Kale @ 2025-04-14 17:21 UTC (permalink / raw)
To: marcel, luiz.dentz, robh, krzk+dt, conor+dt
Cc: linux-bluetooth, linux-kernel, devicetree, amitkumar.karwar,
neeraj.sanjaykale, sherry.sun, manjeet.gupta
Add support for host wakeup on interrupt.
Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
v2: Use interrupt instead of host-wakeup-gpios. (Rob Herring)
---
.../bindings/net/bluetooth/nxp,88w8987-bt.yaml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
index d02e9dd847ef..e52ad8198900 100644
--- a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
+++ b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
@@ -48,6 +48,19 @@ properties:
description:
The GPIO number of the NXP chipset used for BT_WAKE_IN.
+ interrupts:
+ maxItems: 1
+ description:
+ Host wakeup by falling edge interrupt on this pin which is
+ connected to BT_WAKE_OUT pin of the NXP chipset.
+
+ interrupt-names:
+ maxItems: 1
+ items:
+ const: wakeup
+
+ wakeup-source: true
+
nxp,wakeout-pin:
$ref: /schemas/types.yaml#/definitions/uint8
description:
@@ -61,6 +74,7 @@ unevaluatedProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
serial {
bluetooth {
compatible = "nxp,88w8987-bt";
@@ -70,5 +84,9 @@ examples:
nxp,wakein-pin = /bits/ 8 <18>;
nxp,wakeout-pin = /bits/ 8 <19>;
local-bd-address = [66 55 44 33 22 11];
+ interrupt-parent = <&gpio>;
+ interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+ interrupt-names = "wakeup";
+ wakeup-source;
};
};
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] Bluetooth: btnxpuart: Implement host-wakeup feature
2025-04-14 17:21 [PATCH v2 1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup Neeraj Sanjay Kale
@ 2025-04-14 17:22 ` Neeraj Sanjay Kale
2025-04-14 18:00 ` [v2,1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: Neeraj Sanjay Kale @ 2025-04-14 17:22 UTC (permalink / raw)
To: marcel, luiz.dentz, robh, krzk+dt, conor+dt
Cc: linux-bluetooth, linux-kernel, devicetree, amitkumar.karwar,
neeraj.sanjaykale, sherry.sun, manjeet.gupta
This implements host wakeup feature by reading the device tree property
wakeup-source and 'wakeup' interrupt, and nxp,wakeout-pin, and configuring
it as a FALLING EDGE triggered interrupt.
When host is suspended, a trigger from the WAKE_OUT pin of the
controller wakes it up.
To enable this feature, both device tree properties are needed to be
defined.
Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
v2: Use interrupt instead of host-wakeup-gpios. (Rob Herring)
---
drivers/bluetooth/btnxpuart.c | 58 +++++++++++++++++++++++++++++++----
1 file changed, 52 insertions(+), 6 deletions(-)
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 604ab2bba231..069a394a7eb8 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -17,6 +17,7 @@
#include <linux/crc32.h>
#include <linux/string_helpers.h>
#include <linux/gpio/consumer.h>
+#include <linux/of_irq.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -143,7 +144,9 @@ struct ps_data {
bool driver_sent_cmd;
u16 h2c_ps_interval;
u16 c2h_ps_interval;
+ bool wakeup_source;
struct gpio_desc *h2c_ps_gpio;
+ s32 irq_handler;
struct hci_dev *hdev;
struct work_struct work;
struct timer_list ps_timer;
@@ -476,12 +479,21 @@ static void ps_timeout_func(struct timer_list *t)
}
}
+static irqreturn_t ps_host_wakeup_irq_handler(int irq, void *priv)
+{
+ struct btnxpuart_dev *nxpdev = (struct btnxpuart_dev *)priv;
+
+ bt_dev_dbg(nxpdev->hdev, "Host wakeup interrupt");
+ return IRQ_HANDLED;
+}
static int 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;
+ int ret = 0;
+ /* Out-Of-Band Device Wakeup */
psdata->h2c_ps_gpio = devm_gpiod_get_optional(&serdev->dev, "device-wakeup",
GPIOD_OUT_LOW);
if (IS_ERR(psdata->h2c_ps_gpio)) {
@@ -493,11 +505,37 @@ static int ps_setup(struct hci_dev *hdev)
if (device_property_read_u8(&serdev->dev, "nxp,wakein-pin", &psdata->h2c_wakeup_gpio)) {
psdata->h2c_wakeup_gpio = 0xff; /* 0xff: use default pin/gpio */
} else if (!psdata->h2c_ps_gpio) {
- bt_dev_warn(hdev, "nxp,wakein-pin property without device-wakeup GPIO");
+ bt_dev_warn(hdev, "nxp,wakein-pin property without device-wakeup-gpios");
psdata->h2c_wakeup_gpio = 0xff;
}
- device_property_read_u8(&serdev->dev, "nxp,wakeout-pin", &psdata->c2h_wakeup_gpio);
+ /* Out-Of-Band Host Wakeup */
+ if (of_property_read_bool(serdev->dev.of_node, "wakeup-source")) {
+ psdata->irq_handler = of_irq_get_byname(serdev->dev.of_node, "wakeup");
+ bt_dev_info(nxpdev->hdev, "irq_handler: %d", psdata->irq_handler);
+ if (psdata->irq_handler > 0)
+ psdata->wakeup_source = true;
+ }
+
+ if (device_property_read_u8(&serdev->dev, "nxp,wakeout-pin", &psdata->c2h_wakeup_gpio)) {
+ psdata->c2h_wakeup_gpio = 0xff;
+ if (psdata->wakeup_source) {
+ bt_dev_warn(hdev, "host wakeup interrupt without nxp,wakeout-pin");
+ psdata->wakeup_source = false;
+ }
+ } else if (!psdata->wakeup_source) {
+ bt_dev_warn(hdev, "nxp,wakeout-pin property without host wakeup interrupt");
+ psdata->c2h_wakeup_gpio = 0xff;
+ }
+
+ if (psdata->wakeup_source) {
+ ret = devm_request_irq(&serdev->dev, psdata->irq_handler,
+ ps_host_wakeup_irq_handler,
+ IRQF_ONESHOT | IRQF_TRIGGER_FALLING,
+ dev_name(&serdev->dev), nxpdev);
+ disable_irq(psdata->irq_handler);
+ device_init_wakeup(&serdev->dev, true);
+ }
psdata->hdev = hdev;
INIT_WORK(&psdata->work, ps_work_func);
@@ -637,12 +675,10 @@ static void ps_init(struct hci_dev *hdev)
psdata->ps_state = PS_STATE_AWAKE;
- if (psdata->c2h_wakeup_gpio) {
+ if (psdata->c2h_wakeup_gpio != 0xff)
psdata->c2h_wakeupmode = BT_HOST_WAKEUP_METHOD_GPIO;
- } else {
+ else
psdata->c2h_wakeupmode = BT_HOST_WAKEUP_METHOD_NONE;
- psdata->c2h_wakeup_gpio = 0xff;
- }
psdata->cur_h2c_wakeupmode = WAKEUP_METHOD_INVALID;
if (psdata->h2c_ps_gpio)
@@ -1821,6 +1857,11 @@ static int nxp_serdev_suspend(struct device *dev)
struct ps_data *psdata = &nxpdev->psdata;
ps_control(psdata->hdev, PS_STATE_SLEEP);
+
+ if (psdata->wakeup_source) {
+ enable_irq_wake(psdata->irq_handler);
+ enable_irq(psdata->irq_handler);
+ }
return 0;
}
@@ -1829,6 +1870,11 @@ static int nxp_serdev_resume(struct device *dev)
struct btnxpuart_dev *nxpdev = dev_get_drvdata(dev);
struct ps_data *psdata = &nxpdev->psdata;
+ if (psdata->wakeup_source) {
+ disable_irq(psdata->irq_handler);
+ disable_irq_wake(psdata->irq_handler);
+ }
+
ps_control(psdata->hdev, PS_STATE_AWAKE);
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [v2,1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup
2025-04-14 17:21 [PATCH v2 1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup Neeraj Sanjay Kale
2025-04-14 17:22 ` [PATCH v2 2/2] Bluetooth: btnxpuart: Implement host-wakeup feature Neeraj Sanjay Kale
@ 2025-04-14 18:00 ` bluez.test.bot
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-04-14 18:00 UTC (permalink / raw)
To: linux-bluetooth, neeraj.sanjaykale
[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=953190
---Test result---
Test Summary:
CheckPatch PENDING 0.37 seconds
GitLint PENDING 0.28 seconds
SubjectPrefix FAIL 0.50 seconds
BuildKernel PASS 24.81 seconds
CheckAllWarning PASS 27.97 seconds
CheckSparse PASS 30.45 seconds
BuildKernel32 PASS 24.39 seconds
TestRunnerSetup PASS 464.99 seconds
TestRunner_l2cap-tester PASS 21.97 seconds
TestRunner_iso-tester PASS 34.90 seconds
TestRunner_bnep-tester PASS 4.89 seconds
TestRunner_mgmt-tester PASS 120.91 seconds
TestRunner_rfcomm-tester PASS 7.86 seconds
TestRunner_sco-tester PASS 12.55 seconds
TestRunner_ioctl-tester PASS 8.37 seconds
TestRunner_mesh-tester PASS 8.52 seconds
TestRunner_smp-tester PASS 7.26 seconds
TestRunner_userchan-tester PASS 4.92 seconds
IncrementalBuild PENDING 0.78 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-14 18:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 17:21 [PATCH v2 1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup Neeraj Sanjay Kale
2025-04-14 17:22 ` [PATCH v2 2/2] Bluetooth: btnxpuart: Implement host-wakeup feature Neeraj Sanjay Kale
2025-04-14 18:00 ` [v2,1/2] dt-bindings: net: bluetooth: nxp: Add support for host-wakeup bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox