public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH next v2 1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset
@ 2025-02-27 10:57 Catalin Popescu
  2025-02-27 10:57 ` [PATCH next v2 2/2] bluetooth: btnxpuart: implement powerup sequence Catalin Popescu
  2025-02-27 11:30 ` [next,v2,1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset bluez.test.bot
  0 siblings, 2 replies; 5+ messages in thread
From: Catalin Popescu @ 2025-02-27 10:57 UTC (permalink / raw)
  To: neeraj.sanjaykale, marcel, luiz.dentz, robh, krzk+dt,
	loic.poulain
  Cc: linux-bluetooth, devicetree, linux-kernel, m.felsch,
	amitkumar.karwar, conor+dt, Catalin Popescu, Conor Dooley

Add support for chip power supply and chip reset/powerdown.

Signed-off-by: Catalin Popescu <catalin.popescu@leica-geosystems.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
v2:
- rebase on linux-next tag next-20250227
- add acked-by
---
 .../bindings/net/bluetooth/nxp,88w8987-bt.yaml         | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
index 04f55fac42ce..97c694f2d70a 100644
--- a/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
+++ b/Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml
@@ -50,6 +50,14 @@ properties:
     description:
       The GPIO number of the NXP chipset used for BT_WAKE_OUT.
 
+  vcc-supply:
+    description:
+      phandle of the regulator that provides the supply voltage.
+
+  reset-gpios:
+    description:
+      Chip powerdown/reset signal (PDn).
+
 required:
   - compatible
 
@@ -66,5 +74,7 @@ examples:
             device-wakeup-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
             nxp,wakein-pin = /bits/ 8 <18>;
             nxp,wakeout-pin = /bits/ 8 <19>;
+            vcc-supply = <&nxp_iw612_supply>;
+            reset-gpios = <&gpioctrl 2 GPIO_ACTIVE_LOW>;
         };
     };

base-commit: be5c7bbb3a64baf884481a1ba0c2f8fb2f93f7c3
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH next v2 2/2] bluetooth: btnxpuart: implement powerup sequence
  2025-02-27 10:57 [PATCH next v2 1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset Catalin Popescu
@ 2025-02-27 10:57 ` Catalin Popescu
  2025-03-06 15:29   ` Loic Poulain
  2025-02-27 11:30 ` [next,v2,1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset bluez.test.bot
  1 sibling, 1 reply; 5+ messages in thread
From: Catalin Popescu @ 2025-02-27 10:57 UTC (permalink / raw)
  To: neeraj.sanjaykale, marcel, luiz.dentz, robh, krzk+dt,
	loic.poulain
  Cc: linux-bluetooth, devicetree, linux-kernel, m.felsch,
	amitkumar.karwar, conor+dt, Catalin Popescu

NXP bluetooth chip shares power supply and reset gpio with a WLAN
chip. Add support for power supply and reset and enforce powerup
sequence:
- apply power supply
- deassert reset/powerdown

Signed-off-by: Catalin Popescu <catalin.popescu@leica-geosystems.com>
Reviewed-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
v2:
- rebase on linux-next tag next-20250227
- add reviewed-by
---
 drivers/bluetooth/btnxpuart.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 4f2f429c9800..81d1c9b97146 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -17,6 +17,8 @@
 #include <linux/crc32.h>
 #include <linux/string_helpers.h>
 #include <linux/gpio/consumer.h>
+#include <linux/regulator/consumer.h>
+#include <linux/reset.h>
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
@@ -191,6 +193,7 @@ struct btnxpuart_dev {
 
 	struct ps_data psdata;
 	struct btnxpuart_data *nxp_data;
+	struct reset_control *pdn;
 };
 
 #define NXP_V1_FW_REQ_PKT	0xa5
@@ -1522,6 +1525,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
 {
 	struct hci_dev *hdev;
 	struct btnxpuart_dev *nxpdev;
+	int err;
 
 	nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL);
 	if (!nxpdev)
@@ -1549,6 +1553,16 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
 
 	crc8_populate_msb(crc8_table, POLYNOMIAL8);
 
+	nxpdev->pdn = devm_reset_control_get_optional_shared(&serdev->dev, NULL);
+	if (IS_ERR(nxpdev->pdn))
+		return PTR_ERR(nxpdev->pdn);
+
+	err = devm_regulator_get_enable(&serdev->dev, "vcc");
+	if (err) {
+		dev_err(&serdev->dev, "Failed to enable vcc regulator\n");
+		return err;
+	}
+
 	/* Initialize and register HCI device */
 	hdev = hci_alloc_dev();
 	if (!hdev) {
@@ -1556,6 +1570,8 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
 		return -ENOMEM;
 	}
 
+	reset_control_deassert(nxpdev->pdn);
+
 	nxpdev->hdev = hdev;
 
 	hdev->bus = HCI_UART;
@@ -1583,6 +1599,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
 	return 0;
 
 probe_fail:
+	reset_control_assert(nxpdev->pdn);
 	hci_free_dev(hdev);
 	return -ENODEV;
 }
@@ -1609,6 +1626,7 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
 	}
 	ps_cleanup(nxpdev);
 	hci_unregister_dev(hdev);
+	reset_control_assert(nxpdev->pdn);
 	hci_free_dev(hdev);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [next,v2,1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset
  2025-02-27 10:57 [PATCH next v2 1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset Catalin Popescu
  2025-02-27 10:57 ` [PATCH next v2 2/2] bluetooth: btnxpuart: implement powerup sequence Catalin Popescu
@ 2025-02-27 11:30 ` bluez.test.bot
  1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-02-27 11:30 UTC (permalink / raw)
  To: linux-bluetooth, catalin.popescu

[-- Attachment #1: Type: text/plain, Size: 2248 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=938443

---Test result---

Test Summary:
CheckPatch                    PENDING   0.24 seconds
GitLint                       PENDING   0.26 seconds
SubjectPrefix                 FAIL      0.43 seconds
BuildKernel                   PASS      24.23 seconds
CheckAllWarning               PASS      26.36 seconds
CheckSparse                   PASS      30.67 seconds
BuildKernel32                 PASS      24.13 seconds
TestRunnerSetup               PASS      428.32 seconds
TestRunner_l2cap-tester       PASS      20.95 seconds
TestRunner_iso-tester         PASS      36.17 seconds
TestRunner_bnep-tester        PASS      4.83 seconds
TestRunner_mgmt-tester        FAIL      120.63 seconds
TestRunner_rfcomm-tester      PASS      7.94 seconds
TestRunner_sco-tester         PASS      9.67 seconds
TestRunner_ioctl-tester       PASS      8.36 seconds
TestRunner_mesh-tester        PASS      6.07 seconds
TestRunner_smp-tester         PASS      7.27 seconds
TestRunner_userchan-tester    PASS      5.05 seconds
IncrementalBuild              PENDING   0.56 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
"Bluetooth: " prefix is not specified in the subject
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4

Failed Test Cases
LL Privacy - Start Discovery 1 (Disable RL)          Failed       0.174 seconds
LL Privacy - Set Device Flag 1 (Device Privacy)      Failed       0.158 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH next v2 2/2] bluetooth: btnxpuart: implement powerup sequence
  2025-02-27 10:57 ` [PATCH next v2 2/2] bluetooth: btnxpuart: implement powerup sequence Catalin Popescu
@ 2025-03-06 15:29   ` Loic Poulain
  2025-03-06 15:56     ` POPESCU Catalin
  0 siblings, 1 reply; 5+ messages in thread
From: Loic Poulain @ 2025-03-06 15:29 UTC (permalink / raw)
  To: Catalin Popescu
  Cc: neeraj.sanjaykale, marcel, luiz.dentz, robh, krzk+dt,
	linux-bluetooth, devicetree, linux-kernel, m.felsch,
	amitkumar.karwar, conor+dt

Hi,

On Thu, 27 Feb 2025 at 11:57, Catalin Popescu
<catalin.popescu@leica-geosystems.com> wrote:
>
> NXP bluetooth chip shares power supply and reset gpio with a WLAN
> chip. Add support for power supply and reset and enforce powerup
> sequence:
> - apply power supply
> - deassert reset/powerdown
>
> Signed-off-by: Catalin Popescu <catalin.popescu@leica-geosystems.com>
> Reviewed-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> ---
> v2:
> - rebase on linux-next tag next-20250227
> - add reviewed-by
[...]
> @@ -1522,6 +1525,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>  {
>         struct hci_dev *hdev;
>         struct btnxpuart_dev *nxpdev;
> +       int err;
>
>         nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL);
>         if (!nxpdev)
> @@ -1549,6 +1553,16 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>
>         crc8_populate_msb(crc8_table, POLYNOMIAL8);
>
> +       nxpdev->pdn = devm_reset_control_get_optional_shared(&serdev->dev, NULL);

Maybe devm_reset_control_get_optional_shared_deasserted could be
useful here instead?




> +       if (IS_ERR(nxpdev->pdn))
> +               return PTR_ERR(nxpdev->pdn);
> +
> +       err = devm_regulator_get_enable(&serdev->dev, "vcc");
> +       if (err) {
> +               dev_err(&serdev->dev, "Failed to enable vcc regulator\n");
> +               return err;
> +       }
> +
>         /* Initialize and register HCI device */
>         hdev = hci_alloc_dev();
>         if (!hdev) {
> @@ -1556,6 +1570,8 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>                 return -ENOMEM;
>         }
>
> +       reset_control_deassert(nxpdev->pdn);
> +
>         nxpdev->hdev = hdev;
>
>         hdev->bus = HCI_UART;
> @@ -1583,6 +1599,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>         return 0;
>
>  probe_fail:
> +       reset_control_assert(nxpdev->pdn);
>         hci_free_dev(hdev);
>         return -ENODEV;
>  }
> @@ -1609,6 +1626,7 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
>         }
>         ps_cleanup(nxpdev);
>         hci_unregister_dev(hdev);
> +       reset_control_assert(nxpdev->pdn);
>         hci_free_dev(hdev);
>  }
>
> --
> 2.43.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH next v2 2/2] bluetooth: btnxpuart: implement powerup sequence
  2025-03-06 15:29   ` Loic Poulain
@ 2025-03-06 15:56     ` POPESCU Catalin
  0 siblings, 0 replies; 5+ messages in thread
From: POPESCU Catalin @ 2025-03-06 15:56 UTC (permalink / raw)
  To: Loic Poulain
  Cc: neeraj.sanjaykale@nxp.com, marcel@holtmann.org,
	luiz.dentz@gmail.com, robh@kernel.org, krzk+dt@kernel.org,
	linux-bluetooth@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, m.felsch@pengutronix.de,
	amitkumar.karwar@nxp.com, conor+dt@kernel.org

On 06/03/2025 16:29, Loic Poulain wrote:
> This email is not from Hexagon’s Office 365 instance. Please be careful while clicking links, opening attachments, or replying to this email.
>
>
> Hi,
Hi Loic
>
> On Thu, 27 Feb 2025 at 11:57, Catalin Popescu
> <catalin.popescu@leica-geosystems.com> wrote:
>> NXP bluetooth chip shares power supply and reset gpio with a WLAN
>> chip. Add support for power supply and reset and enforce powerup
>> sequence:
>> - apply power supply
>> - deassert reset/powerdown
>>
>> Signed-off-by: Catalin Popescu <catalin.popescu@leica-geosystems.com>
>> Reviewed-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
>> ---
>> v2:
>> - rebase on linux-next tag next-20250227
>> - add reviewed-by
> [...]
>> @@ -1522,6 +1525,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>>   {
>>          struct hci_dev *hdev;
>>          struct btnxpuart_dev *nxpdev;
>> +       int err;
>>
>>          nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL);
>>          if (!nxpdev)
>> @@ -1549,6 +1553,16 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>>
>>          crc8_populate_msb(crc8_table, POLYNOMIAL8);
>>
>> +       nxpdev->pdn = devm_reset_control_get_optional_shared(&serdev->dev, NULL);
> Maybe devm_reset_control_get_optional_shared_deasserted could be
> useful here instead?
This is a new API introduced in 6.13 and my kernel is not uptodate 
enough to test it (6.12).
Moreover, it would break the powerup sequence as we first need to apply 
power then deassert the reset.
>
>
>
>> +       if (IS_ERR(nxpdev->pdn))
>> +               return PTR_ERR(nxpdev->pdn);
>> +
>> +       err = devm_regulator_get_enable(&serdev->dev, "vcc");
>> +       if (err) {
>> +               dev_err(&serdev->dev, "Failed to enable vcc regulator\n");
>> +               return err;
>> +       }
>> +
>>          /* Initialize and register HCI device */
>>          hdev = hci_alloc_dev();
>>          if (!hdev) {
>> @@ -1556,6 +1570,8 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>>                  return -ENOMEM;
>>          }
>>
>> +       reset_control_deassert(nxpdev->pdn);
>> +
>>          nxpdev->hdev = hdev;
>>
>>          hdev->bus = HCI_UART;
>> @@ -1583,6 +1599,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
>>          return 0;
>>
>>   probe_fail:
>> +       reset_control_assert(nxpdev->pdn);
>>          hci_free_dev(hdev);
>>          return -ENODEV;
>>   }
>> @@ -1609,6 +1626,7 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
>>          }
>>          ps_cleanup(nxpdev);
>>          hci_unregister_dev(hdev);
>> +       reset_control_assert(nxpdev->pdn);
>>          hci_free_dev(hdev);
>>   }
>>
>> --
>> 2.43.0
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-06 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 10:57 [PATCH next v2 1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset Catalin Popescu
2025-02-27 10:57 ` [PATCH next v2 2/2] bluetooth: btnxpuart: implement powerup sequence Catalin Popescu
2025-03-06 15:29   ` Loic Poulain
2025-03-06 15:56     ` POPESCU Catalin
2025-02-27 11:30 ` [next,v2,1/2] dt-bindings: net: bluetooth: nxp: add support for supply and reset 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