* [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config
@ 2025-02-19 9:15 Loic Poulain
2025-02-19 9:15 ` [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties Loic Poulain
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Loic Poulain @ 2025-02-19 9:15 UTC (permalink / raw)
To: marcel, neeraj.sanjaykale, robh, krzk+dt
Cc: linux-bluetooth, devicetree, amitkumar.karwar, Loic Poulain
When using the out-of-band WAKE_IN and WAKE_OUT pins, we have to tell
the firmware which pins to use (from controller point of view). This
allows to report remote wakeup support when WAKE_OUT(c2h) is configured.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
v2: - Move pin properties read in ps_setup
- Display warning in case of wakein prop without related gpio
drivers/bluetooth/btnxpuart.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index aa5ec1d444a9..4f2f429c9800 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -447,8 +447,14 @@ static int ps_setup(struct hci_dev *hdev)
return PTR_ERR(psdata->h2c_ps_gpio);
}
- if (!psdata->h2c_ps_gpio)
+ 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");
psdata->h2c_wakeup_gpio = 0xff;
+ }
+
+ device_property_read_u8(&serdev->dev, "nxp,wakeout-pin", &psdata->c2h_wakeup_gpio);
psdata->hdev = hdev;
INIT_WORK(&psdata->work, ps_work_func);
@@ -540,9 +546,11 @@ 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;
+ pcmd.h2c_wakeup_gpio = 0xff;
switch (psdata->h2c_wakeupmode) {
case WAKEUP_METHOD_GPIO:
pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_GPIO;
+ pcmd.h2c_wakeup_gpio = psdata->h2c_wakeup_gpio;
break;
case WAKEUP_METHOD_DTR:
pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_DSR;
@@ -552,7 +560,6 @@ static int send_wakeup_method_cmd(struct hci_dev *hdev, void *data)
pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_BREAK;
break;
}
- pcmd.h2c_wakeup_gpio = 0xff;
skb = nxp_drv_send_cmd(hdev, HCI_NXP_WAKEUP_METHOD, sizeof(pcmd), &pcmd);
if (IS_ERR(skb)) {
@@ -586,8 +593,13 @@ static void ps_init(struct hci_dev *hdev)
usleep_range(5000, 10000);
psdata->ps_state = PS_STATE_AWAKE;
- psdata->c2h_wakeupmode = BT_HOST_WAKEUP_METHOD_NONE;
- psdata->c2h_wakeup_gpio = 0xff;
+
+ if (psdata->c2h_wakeup_gpio) {
+ psdata->c2h_wakeupmode = BT_HOST_WAKEUP_METHOD_GPIO;
+ } 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)
@@ -1266,6 +1278,17 @@ static int nxp_shutdown(struct hci_dev *hdev)
return 0;
}
+static bool nxp_wakeup(struct hci_dev *hdev)
+{
+ struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
+ struct ps_data *psdata = &nxpdev->psdata;
+
+ if (psdata->c2h_wakeupmode != BT_HOST_WAKEUP_METHOD_NONE)
+ return true;
+
+ return false;
+}
+
static int btnxpuart_queue_skb(struct hci_dev *hdev, struct sk_buff *skb)
{
struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
@@ -1546,6 +1569,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
hdev->send = nxp_enqueue;
hdev->hw_error = nxp_hw_err;
hdev->shutdown = nxp_shutdown;
+ hdev->wakeup = nxp_wakeup;
SET_HCIDEV_DEV(hdev, &serdev->dev);
if (hci_register_dev(hdev) < 0) {
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties
2025-02-19 9:15 [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config Loic Poulain
@ 2025-02-19 9:15 ` Loic Poulain
2025-02-19 9:57 ` Neeraj Sanjay Kale
2025-02-21 21:38 ` Rob Herring (Arm)
2025-02-19 9:54 ` [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config Neeraj Sanjay Kale
2025-02-24 21:00 ` patchwork-bot+bluetooth
2 siblings, 2 replies; 6+ messages in thread
From: Loic Poulain @ 2025-02-19 9:15 UTC (permalink / raw)
To: marcel, neeraj.sanjaykale, robh, krzk+dt
Cc: linux-bluetooth, devicetree, amitkumar.karwar, Loic Poulain
NXP bluetooth controller may have GPIO pins used and routed for `WAKE_IN`
and `WAKE_OUT`, such pin info must be known so that the driver is can
configure the controller's firmware accordingly.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
v2: No change
.../bindings/net/bluetooth/nxp,88w8987-bt.yaml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
index 0a2d7baf5db3..04f55fac42ce 100644
--- a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
+++ b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
@@ -40,6 +40,16 @@ properties:
Host-To-Chip power save mechanism is driven by this GPIO
connected to BT_WAKE_IN pin of the NXP chipset.
+ nxp,wakein-pin:
+ $ref: /schemas/types.yaml#/definitions/uint8
+ description:
+ The GPIO number of the NXP chipset used for BT_WAKE_IN.
+
+ nxp,wakeout-pin:
+ $ref: /schemas/types.yaml#/definitions/uint8
+ description:
+ The GPIO number of the NXP chipset used for BT_WAKE_OUT.
+
required:
- compatible
@@ -54,5 +64,7 @@ examples:
fw-init-baudrate = <3000000>;
firmware-name = "uartuart8987_bt_v0.bin";
device-wakeup-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+ nxp,wakein-pin = /bits/ 8 <18>;
+ nxp,wakeout-pin = /bits/ 8 <19>;
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config
2025-02-19 9:15 [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config Loic Poulain
2025-02-19 9:15 ` [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties Loic Poulain
@ 2025-02-19 9:54 ` Neeraj Sanjay Kale
2025-02-24 21:00 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 6+ messages in thread
From: Neeraj Sanjay Kale @ 2025-02-19 9:54 UTC (permalink / raw)
To: Loic Poulain, marcel@holtmann.org, robh@kernel.org,
krzk+dt@kernel.org
Cc: linux-bluetooth@vger.kernel.org, devicetree@vger.kernel.org,
Amitkumar Karwar, Sherry Sun
Hi Loic,
This looks good to me.
Reviewed-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
Thanks,
Neeraj
> When using the out-of-band WAKE_IN and WAKE_OUT pins, we have to tell
> the firmware which pins to use (from controller point of view). This allows to
> report remote wakeup support when WAKE_OUT(c2h) is configured.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> v2: - Move pin properties read in ps_setup
> - Display warning in case of wakein prop without related gpio
>
> drivers/bluetooth/btnxpuart.c | 32 ++++++++++++++++++++++++++++----
> 1 file changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
> index aa5ec1d444a9..4f2f429c9800 100644
> --- a/drivers/bluetooth/btnxpuart.c
> +++ b/drivers/bluetooth/btnxpuart.c
> @@ -447,8 +447,14 @@ static int ps_setup(struct hci_dev *hdev)
> return PTR_ERR(psdata->h2c_ps_gpio);
> }
>
> - if (!psdata->h2c_ps_gpio)
> + 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");
> psdata->h2c_wakeup_gpio = 0xff;
> + }
> +
> + device_property_read_u8(&serdev->dev, "nxp,wakeout-pin",
> + &psdata->c2h_wakeup_gpio);
>
> psdata->hdev = hdev;
> INIT_WORK(&psdata->work, ps_work_func); @@ -540,9 +546,11 @@
> 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;
> + pcmd.h2c_wakeup_gpio = 0xff;
> switch (psdata->h2c_wakeupmode) {
> case WAKEUP_METHOD_GPIO:
> pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_GPIO;
> + pcmd.h2c_wakeup_gpio = psdata->h2c_wakeup_gpio;
> break;
> case WAKEUP_METHOD_DTR:
> pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_DSR; @@ -
> 552,7 +560,6 @@ static int send_wakeup_method_cmd(struct hci_dev *hdev,
> void *data)
> pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_BREAK;
> break;
> }
> - pcmd.h2c_wakeup_gpio = 0xff;
>
> skb = nxp_drv_send_cmd(hdev, HCI_NXP_WAKEUP_METHOD,
> sizeof(pcmd), &pcmd);
> if (IS_ERR(skb)) {
> @@ -586,8 +593,13 @@ static void ps_init(struct hci_dev *hdev)
> usleep_range(5000, 10000);
>
> psdata->ps_state = PS_STATE_AWAKE;
> - psdata->c2h_wakeupmode = BT_HOST_WAKEUP_METHOD_NONE;
> - psdata->c2h_wakeup_gpio = 0xff;
> +
> + if (psdata->c2h_wakeup_gpio) {
> + psdata->c2h_wakeupmode = BT_HOST_WAKEUP_METHOD_GPIO;
> + } 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)
> @@ -1266,6 +1278,17 @@ static int nxp_shutdown(struct hci_dev *hdev)
> return 0;
> }
>
> +static bool nxp_wakeup(struct hci_dev *hdev) {
> + struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
> + struct ps_data *psdata = &nxpdev->psdata;
> +
> + if (psdata->c2h_wakeupmode != BT_HOST_WAKEUP_METHOD_NONE)
> + return true;
> +
> + return false;
> +}
> +
> static int btnxpuart_queue_skb(struct hci_dev *hdev, struct sk_buff *skb) {
> struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); @@ -1546,6
> +1569,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
> hdev->send = nxp_enqueue;
> hdev->hw_error = nxp_hw_err;
> hdev->shutdown = nxp_shutdown;
> + hdev->wakeup = nxp_wakeup;
> SET_HCIDEV_DEV(hdev, &serdev->dev);
>
> if (hci_register_dev(hdev) < 0) {
> --
> 2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties
2025-02-19 9:15 ` [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties Loic Poulain
@ 2025-02-19 9:57 ` Neeraj Sanjay Kale
2025-02-21 21:38 ` Rob Herring (Arm)
1 sibling, 0 replies; 6+ messages in thread
From: Neeraj Sanjay Kale @ 2025-02-19 9:57 UTC (permalink / raw)
To: Loic Poulain, marcel@holtmann.org, robh@kernel.org,
krzk+dt@kernel.org
Cc: linux-bluetooth@vger.kernel.org, devicetree@vger.kernel.org,
Amitkumar Karwar
Hi Loic,
I am okay with this DT patch for adding nxp,wakein-pin and nxp,wakeout-pin.
Thanks,
Neeraj
> NXP bluetooth controller may have GPIO pins used and routed for `WAKE_IN`
> and `WAKE_OUT`, such pin info must be known so that the driver is can
> configure the controller's firmware accordingly.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> v2: No change
>
> .../bindings/net/bluetooth/nxp,88w8987-bt.yaml | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-
> bt.yaml b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-
> bt.yaml
> index 0a2d7baf5db3..04f55fac42ce 100644
> --- a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-
> bt.yaml
> +++ b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-
> bt.yam
> +++ l
> @@ -40,6 +40,16 @@ properties:
> Host-To-Chip power save mechanism is driven by this GPIO
> connected to BT_WAKE_IN pin of the NXP chipset.
>
> + nxp,wakein-pin:
> + $ref: /schemas/types.yaml#/definitions/uint8
> + description:
> + The GPIO number of the NXP chipset used for BT_WAKE_IN.
> +
> + nxp,wakeout-pin:
> + $ref: /schemas/types.yaml#/definitions/uint8
> + description:
> + The GPIO number of the NXP chipset used for BT_WAKE_OUT.
> +
> required:
> - compatible
>
> @@ -54,5 +64,7 @@ examples:
> fw-init-baudrate = <3000000>;
> firmware-name = "uartuart8987_bt_v0.bin";
> device-wakeup-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
> + nxp,wakein-pin = /bits/ 8 <18>;
> + nxp,wakeout-pin = /bits/ 8 <19>;
> };
> };
> --
> 2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties
2025-02-19 9:15 ` [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties Loic Poulain
2025-02-19 9:57 ` Neeraj Sanjay Kale
@ 2025-02-21 21:38 ` Rob Herring (Arm)
1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring (Arm) @ 2025-02-21 21:38 UTC (permalink / raw)
To: Loic Poulain
Cc: amitkumar.karwar, krzk+dt, linux-bluetooth, devicetree,
neeraj.sanjaykale, marcel
On Wed, 19 Feb 2025 10:15:12 +0100, Loic Poulain wrote:
> NXP bluetooth controller may have GPIO pins used and routed for `WAKE_IN`
> and `WAKE_OUT`, such pin info must be known so that the driver is can
> configure the controller's firmware accordingly.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> v2: No change
>
> .../bindings/net/bluetooth/nxp,88w8987-bt.yaml | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config
2025-02-19 9:15 [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config Loic Poulain
2025-02-19 9:15 ` [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties Loic Poulain
2025-02-19 9:54 ` [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config Neeraj Sanjay Kale
@ 2025-02-24 21:00 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2025-02-24 21:00 UTC (permalink / raw)
To: Loic Poulain
Cc: marcel, neeraj.sanjaykale, robh, krzk+dt, linux-bluetooth,
devicetree, amitkumar.karwar
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 19 Feb 2025 10:15:11 +0100 you wrote:
> When using the out-of-band WAKE_IN and WAKE_OUT pins, we have to tell
> the firmware which pins to use (from controller point of view). This
> allows to report remote wakeup support when WAKE_OUT(c2h) is configured.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> v2: - Move pin properties read in ps_setup
> - Display warning in case of wakein prop without related gpio
>
> [...]
Here is the summary with links:
- [v2,1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config
https://git.kernel.org/bluetooth/bluetooth-next/c/f66b266e3e4f
- [v2,2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties
https://git.kernel.org/bluetooth/bluetooth-next/c/c3bb10f6d38a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-24 21:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 9:15 [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config Loic Poulain
2025-02-19 9:15 ` [PATCH v2 2/2] dt-bindings: net: bluetooth: nxp: Add wakeup pin properties Loic Poulain
2025-02-19 9:57 ` Neeraj Sanjay Kale
2025-02-21 21:38 ` Rob Herring (Arm)
2025-02-19 9:54 ` [PATCH v2 1/2] bluetooth: btnxpuart: Support for controller wakeup gpio config Neeraj Sanjay Kale
2025-02-24 21:00 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).