* RE: Rework M.2 Bluetooth instantiation using the auxiliary bus
2026-09-15 14:24 [PATCH 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
@ 2026-09-15 17:11 ` bluez.test.bot
0 siblings, 0 replies; 9+ messages in thread
From: bluez.test.bot @ 2026-09-15 17:11 UTC (permalink / raw)
To: linux-bluetooth, manivannan.sadhasivam
[-- Attachment #1: Type: text/plain, Size: 857 bytes --]
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: drivers/bluetooth/btnxpuart.c:1884
error: drivers/bluetooth/btnxpuart.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus
@ 2026-11-30 12:19 Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-11-30 12:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Bartosz Golaszewski,
Manivannan Sadhasivam, Song Xue, Alex Zhou, Amitkumar Karwar,
Neeraj Kale, Philipp Zabel
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, linux-pci, linux-pm,
Wei Deng, Andy Shevchenko, Rahul Samana, Loic Poulain,
Manivannan Sadhasivam, Bartosz Golaszewski, Sherry Sun
Hi,
This series reworks the PCIe M.2 Bluetooth instantiation using the auxiliary
bus.
The Bluetooth interface of the QCA2066, WCN6855, WCN7850 and NXP 88W8987
M.2 modules is accessed over UART, but the modules show up at runtime over
PCIe and are not described in firmware like devicetree. To make the serdev
bus match the Bluetooth driver, the power sequencing driver creates a
devicetree node at runtime using an of_changeset. But, creating a node just for
driver matching is not recommended as per Krzysztof.
So this series reworks the instantiation to use the auxiliary bus instead. The
power sequencing driver still allocates the UART serdev, but now hands it over
through an auxiliary device along with the power sequencing target. Add
auxiliary drivers to hci_qca and btnxpuart that bind to this device and
bring up the controller over the existing UART transport. Then drop the
serdev based M.2 code that is no longer reachable.
Dependency
==========
This series applies on top of bluetooth-next/master.
Merge Strategy
==============
All patches should go through bluetooth tree due to dependency.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
Changes in v2:
- Rebased on top of bluetooth-next/master
- Incorporated comments from Andy on patch 2 and implemented the same for patch
1
- Collected tags
---
Manivannan Sadhasivam (5):
Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules
Bluetooth: btnxpuart: Add auxiliary driver for PCIe M.2 modules
power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface
Bluetooth: hci_qca: Drop serdev based M.2 power sequencing code
Bluetooth: btnxpuart: Drop serdev based M.2 power sequencing code
MAINTAINERS | 1 +
drivers/bluetooth/Kconfig | 2 +
drivers/bluetooth/btnxpuart.c | 215 +++++++++++++++++++-----------
drivers/bluetooth/hci_qca.c | 161 ++++++++++++++--------
drivers/power/sequencing/Kconfig | 2 +-
drivers/power/sequencing/pwrseq-pcie-m2.c | 141 +++++++++++---------
include/linux/pwrseq/pcie-m2-bt.h | 38 ++++++
7 files changed, 363 insertions(+), 197 deletions(-)
---
base-commit: f57f78086ab54f3b3122fbaeba2c842ba7bb6d00
change-id: 20260806-pci-m2-bt-rework-78dc2c926f00
Best regards,
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules
2026-11-30 12:19 [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus Manivannan Sadhasivam via B4 Relay
@ 2026-11-30 12:19 ` Manivannan Sadhasivam via B4 Relay
2026-11-30 12:49 ` Loic Poulain
2026-11-30 16:38 ` Rework M.2 Bluetooth instantiation using the auxiliary bus bluez.test.bot
2026-11-30 12:19 ` [PATCH v2 2/5] Bluetooth: btnxpuart: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
` (3 subsequent siblings)
4 siblings, 2 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-11-30 12:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Bartosz Golaszewski,
Manivannan Sadhasivam, Song Xue, Alex Zhou, Amitkumar Karwar,
Neeraj Kale, Philipp Zabel
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, linux-pci, linux-pm,
Wei Deng, Andy Shevchenko, Rahul Samana, Loic Poulain,
Manivannan Sadhasivam, Bartosz Golaszewski
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
The QCA2066, WCN6855 and WCN7850 combo modules expose Bluetooth over
UART. Since these modules are attached over PCIe, these are not described
in firmware like devicetree. So these modules are discovered at runtime
over PCIe by the power sequencing driver, which allocates the UART serdev
and creates an auxiliary device carrying that transport and the power
sequencing target to power up the Bluetooth function.
Add an auxiliary driver that binds to this device. It reuses the serdev
provided by the producer, brings up the controller through the existing
UART transport with hci_uart_register_device() and drives power through
the sequencer obtained with devm_pwrseq_get().
Add a shared header describing the auxiliary device so that the power
sequencing driver and hci_qca agree on its layout.
Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> # QCC2072 over UART
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
MAINTAINERS | 1 +
drivers/bluetooth/Kconfig | 1 +
drivers/bluetooth/hci_qca.c | 105 ++++++++++++++++++++++++++++++++++++++
include/linux/pwrseq/pcie-m2-bt.h | 38 ++++++++++++++
4 files changed, 145 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 09713dc4c6a7..d670f691b6da 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22219,6 +22219,7 @@ S: Maintained
F: Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml
F: Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
F: drivers/power/sequencing/pwrseq-pcie-m2.c
+F: include/linux/pwrseq/pcie-m2-bt.h
POWER STATE COORDINATION INTERFACE (PSCI)
M: Mark Rutland <mark.rutland@arm.com>
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index b18482b5677f..c77f526495e5 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -258,6 +258,7 @@ config BT_HCIUART_QCA
depends on BT_HCIUART_SERDEV
select BT_HCIUART_H4
select BT_QCA
+ select AUXILIARY_BUS
help
The Qualcomm Atheros protocol supports HCI In-Band Sleep feature
over serial port interface(H4) between controller and host.
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index d51db761f5a6..1212520ab6f0 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -16,6 +16,7 @@
*/
#include <linux/kernel.h>
+#include <linux/auxiliary_bus.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/debugfs.h>
@@ -29,6 +30,7 @@
#include <linux/acpi.h>
#include <linux/platform_device.h>
#include <linux/pwrseq/consumer.h>
+#include <linux/pwrseq/pcie-m2-bt.h>
#include <linux/regulator/consumer.h>
#include <linux/serdev.h>
#include <linux/string_choices.h>
@@ -2920,15 +2922,118 @@ static struct serdev_device_driver qca_serdev_driver = {
},
};
+static int qca_bt_aux_probe(struct auxiliary_device *adev,
+ const struct auxiliary_device_id *id)
+{
+ struct pcie_m2_bt_auxdev *bt_auxdev = to_pcie_m2_bt_auxdev(adev);
+ struct serdev_device *serdev = bt_auxdev->serdev;
+ const struct qca_device_data *data;
+ struct device *dev = &adev->dev;
+ struct qca_serdev *qcadev;
+ struct hci_dev *hdev;
+ bool controllable;
+ int err;
+
+ data = (const struct qca_device_data *)id->driver_data;
+ if (!data)
+ return -ENODATA;
+
+ qcadev = devm_kzalloc_obj(dev, *qcadev);
+ if (!qcadev)
+ return -ENOMEM;
+
+ qcadev->serdev_hu.serdev = serdev;
+ qcadev->btsoc_type = data->soc_type;
+ serdev_device_set_drvdata(serdev, qcadev);
+
+ qcadev->pwrseq = devm_pwrseq_get(dev, bt_auxdev->pwrseq_target);
+ if (IS_ERR(qcadev->pwrseq))
+ return dev_err_probe(dev, PTR_ERR(qcadev->pwrseq),
+ "failed to acquire power sequencer\n");
+
+ /*
+ * When the host cannot gate the BT power individually, treat it as
+ * always-on.
+ */
+ controllable = pwrseq_is_controllable(qcadev->pwrseq);
+ if (!controllable) {
+ err = pwrseq_enable(qcadev->pwrseq);
+ if (err)
+ return dev_err_probe(dev, err,
+ "failed to power on BT device\n");
+ qcadev->pwrseq = NULL;
+ }
+
+ err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
+ if (err)
+ return dev_err_probe(dev, err,
+ "failed to register hci_uart device\n");
+
+ hdev = qcadev->serdev_hu.hdev;
+
+ if (controllable) {
+ hci_set_quirk(hdev, HCI_QUIRK_NON_PERSISTENT_SETUP);
+ hdev->shutdown = qca_hci_shutdown;
+ }
+
+ if (data->capabilities & QCA_CAP_WIDEBAND_SPEECH)
+ hci_set_quirk(hdev, HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED);
+
+ if (!(data->capabilities & QCA_CAP_VALID_LE_STATES))
+ hci_set_quirk(hdev, HCI_QUIRK_BROKEN_LE_STATES);
+
+ if (data->capabilities & QCA_CAP_HFP_HW_OFFLOAD)
+ qcadev->support_hfp_hw_offload = true;
+
+ auxiliary_set_drvdata(adev, qcadev);
+
+ return 0;
+}
+
+static void qca_bt_aux_remove(struct auxiliary_device *adev)
+{
+ struct qca_serdev *qcadev = auxiliary_get_drvdata(adev);
+
+ hci_uart_unregister_device(&qcadev->serdev_hu);
+}
+
+static const struct auxiliary_device_id qca_bt_aux_id_table[] = {
+ {
+ .name = "pwrseq_pcie_m2.qca2066-bt",
+ .driver_data = (kernel_ulong_t)&qca_soc_data_qca2066,
+ },
+ {
+ .name = "pwrseq_pcie_m2.wcn6855-bt",
+ .driver_data = (kernel_ulong_t)&qca_soc_data_wcn6855,
+ },
+ {
+ .name = "pwrseq_pcie_m2.wcn7850-bt",
+ .driver_data = (kernel_ulong_t)&qca_soc_data_wcn7850,
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(auxiliary, qca_bt_aux_id_table);
+
+static struct auxiliary_driver qca_bt_aux_driver = {
+ .name = "qca_bt",
+ .probe = qca_bt_aux_probe,
+ .remove = qca_bt_aux_remove,
+ .id_table = qca_bt_aux_id_table,
+};
+
int __init qca_init(void)
{
serdev_device_driver_register(&qca_serdev_driver);
+ auxiliary_driver_register(&qca_bt_aux_driver);
+
return hci_uart_register_proto(&qca_proto);
}
int __exit qca_deinit(void)
{
+ auxiliary_driver_unregister(&qca_bt_aux_driver);
+
serdev_device_driver_unregister(&qca_serdev_driver);
return hci_uart_unregister_proto(&qca_proto);
diff --git a/include/linux/pwrseq/pcie-m2-bt.h b/include/linux/pwrseq/pcie-m2-bt.h
new file mode 100644
index 000000000000..39e7475d7962
--- /dev/null
+++ b/include/linux/pwrseq/pcie-m2-bt.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
+ */
+
+#ifndef __POWER_SEQUENCING_PCIE_M2_BT_H__
+#define __POWER_SEQUENCING_PCIE_M2_BT_H__
+
+#include <linux/auxiliary_bus.h>
+#include <linux/container_of.h>
+
+struct serdev_device;
+
+/**
+ * struct pcie_m2_bt_auxdev - Auxiliary device for the Bluetooth function of a
+ * PCIe M.2 module.
+ * @adev: Auxiliary device.
+ * @serdev: Serdev device representing the UART transport. Allocated and owned
+ * by the producer (power sequencing driver).
+ * @pwrseq_target: Power sequencing target the consumer requests to power up the
+ * Bluetooth function.
+ *
+ * On M.2 modules exposing Bluetooth over UART, the controller is not described
+ * in firmware. The power sequencing driver detects the module over PCIe and
+ * publishes this auxiliary device so that the Bluetooth driver can bind to the
+ * pre-allocated serdev transport and drive power sequencing.
+ */
+struct pcie_m2_bt_auxdev {
+ struct auxiliary_device adev;
+ struct serdev_device *serdev;
+ const char *pwrseq_target;
+};
+
+#define to_pcie_m2_bt_auxdev(_adev) \
+ container_of(_adev, struct pcie_m2_bt_auxdev, adev)
+
+#endif /* __POWER_SEQUENCING_PCIE_M2_BT_H__ */
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/5] Bluetooth: btnxpuart: Add auxiliary driver for PCIe M.2 modules
2026-11-30 12:19 [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
@ 2026-11-30 12:19 ` Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface Manivannan Sadhasivam via B4 Relay
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-11-30 12:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Bartosz Golaszewski,
Manivannan Sadhasivam, Song Xue, Alex Zhou, Amitkumar Karwar,
Neeraj Kale, Philipp Zabel
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, linux-pci, linux-pm,
Wei Deng, Andy Shevchenko, Rahul Samana, Loic Poulain,
Manivannan Sadhasivam, Sherry Sun
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
The 88W8987 combo module exposes Bluetooth over UART. Since this module is
attached over PCIe, it is not described in firmware like devicetree. So it
is discovered at runtime over PCIe by the power sequencing driver, which
allocates the UART serdev and creates an auxiliary device carrying that
transport and the power sequencing target to power up the Bluetooth
function.
Add an auxiliary driver that binds to this device. It reuses the serdev
provided by the producer, brings up the controller through the existing
UART transport with nxp_register_dev() and drives power through the
sequencer obtained with pwrseq_get().
Factor the HCI device setup and teardown shared with the serdev probe into
helpers so both paths register the same controller.
Tested-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/bluetooth/Kconfig | 1 +
drivers/bluetooth/btnxpuart.c | 209 ++++++++++++++++++++++++++++++++----------
2 files changed, 161 insertions(+), 49 deletions(-)
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index c77f526495e5..7bf159ca4cf6 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -468,6 +468,7 @@ config BT_NXPUART
select BT_HCIUART_H4
select CRC32
select CRC8
+ select AUXILIARY_BUS
help
NXP is serial driver required for NXP Bluetooth
devices with UART interface.
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 5c730e336114..c7209b3b59aa 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -7,10 +7,12 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/auxiliary_bus.h>
#include <linux/serdev.h>
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/pwrseq/consumer.h>
+#include <linux/pwrseq/pcie-m2-bt.h>
#include <linux/skbuff.h>
#include <linux/unaligned.h>
#include <linux/firmware.h>
@@ -212,7 +214,7 @@ struct btnxpuart_dev {
bool helper_downloaded;
struct ps_data psdata;
- struct btnxpuart_data *nxp_data;
+ const struct btnxpuart_data *nxp_data;
struct pwrseq_desc *pwrseq;
struct reset_control *pdn;
struct hci_uart hu;
@@ -961,7 +963,7 @@ static int nxp_recv_chip_ver_v1(struct hci_dev *hdev, struct sk_buff *skb)
static int nxp_recv_fw_req_v1(struct hci_dev *hdev, struct sk_buff *skb)
{
struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
- struct btnxpuart_data *nxp_data = nxpdev->nxp_data;
+ const struct btnxpuart_data *nxp_data = nxpdev->nxp_data;
struct v1_data_req *req;
__u16 len;
@@ -1840,20 +1842,14 @@ static bool nxp_m2_connector_is_available(struct device *dev)
return remote && of_device_is_available(remote);
}
-static int nxp_serdev_probe(struct serdev_device *serdev)
+static int nxp_register_dev(struct btnxpuart_dev *nxpdev)
{
+ struct serdev_device *serdev = nxpdev->serdev;
+ struct device *dev = &serdev->dev;
struct hci_dev *hdev;
- struct btnxpuart_dev *nxpdev;
bdaddr_t ba = {0};
int err;
- nxpdev = devm_kzalloc(&serdev->dev, sizeof(*nxpdev), GFP_KERNEL);
- if (!nxpdev)
- return -ENOMEM;
-
- nxpdev->nxp_data = (struct btnxpuart_data *)device_get_match_data(&serdev->dev);
-
- nxpdev->serdev = serdev;
serdev_device_set_drvdata(serdev, nxpdev);
serdev_device_set_client_ops(serdev, &btnxpuart_client_ops);
@@ -1864,18 +1860,17 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
init_waitqueue_head(&nxpdev->fw_dnld_done_wait_q);
init_waitqueue_head(&nxpdev->check_boot_sign_wait_q);
- device_property_read_u32(&nxpdev->serdev->dev, "fw-init-baudrate",
+ device_property_read_u32(dev, "fw-init-baudrate",
&nxpdev->fw_init_baudrate);
if (!nxpdev->fw_init_baudrate)
nxpdev->fw_init_baudrate = FW_INIT_BAUDRATE;
- device_property_read_u32(&nxpdev->serdev->dev, "max-speed",
- &nxpdev->secondary_baudrate);
+ device_property_read_u32(dev, "max-speed", &nxpdev->secondary_baudrate);
if (!nxpdev->secondary_baudrate ||
(nxpdev->secondary_baudrate != HCI_NXP_SEC_BAUDRATE_3M &&
nxpdev->secondary_baudrate != HCI_NXP_SEC_BAUDRATE_4M)) {
if (nxpdev->secondary_baudrate)
- dev_err(&serdev->dev,
+ dev_err(dev,
"Invalid max-speed. Using default 3000000.");
nxpdev->secondary_baudrate = HCI_NXP_SEC_BAUDRATE_3M;
}
@@ -1884,36 +1879,11 @@ 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;
- }
-
- if (nxp_m2_connector_is_available(&serdev->ctrl->dev)) {
- struct pwrseq_desc *pwrseq;
-
- pwrseq = pwrseq_get(&serdev->ctrl->dev, "uart");
- if (IS_ERR(pwrseq))
- return dev_err_probe(&serdev->dev, PTR_ERR(pwrseq),
- "failed to get pwrseq\n");
-
- nxpdev->pwrseq = pwrseq;
- err = pwrseq_enable(pwrseq);
- if (err)
- goto err_pwrseq_put;
- }
-
/* Initialize and register HCI device */
hdev = hci_alloc_dev();
if (!hdev) {
- dev_err(&serdev->dev, "Can't allocate HCI device\n");
- err = -ENOMEM;
- goto err_pwrseq_put;
+ dev_err(dev, "Can't allocate HCI device\n");
+ return -ENOMEM;
}
reset_control_deassert(nxpdev->pdn);
@@ -1936,17 +1906,16 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
hdev->wakeup = nxp_wakeup;
hdev->reset = nxp_reset;
hdev->set_bdaddr = nxp_set_bdaddr;
- SET_HCIDEV_DEV(hdev, &serdev->dev);
+ SET_HCIDEV_DEV(hdev, dev);
- device_property_read_u8_array(&nxpdev->serdev->dev,
- "local-bd-address",
+ device_property_read_u8_array(dev, "local-bd-address",
(u8 *)&ba, sizeof(ba));
if (bacmp(&ba, BDADDR_ANY))
hci_set_quirk(hdev, HCI_QUIRK_USE_BDADDR_PROPERTY);
err = hci_register_dev(hdev);
if (err < 0) {
- dev_err(&serdev->dev, "Can't register HCI device\n");
+ dev_err(dev, "Can't register HCI device\n");
goto probe_fail;
}
@@ -1965,15 +1934,64 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
probe_fail:
reset_control_assert(nxpdev->pdn);
hci_free_dev(hdev);
+
+ return err;
+}
+
+static int nxp_serdev_probe(struct serdev_device *serdev)
+{
+ struct device *dev = &serdev->dev;
+ struct btnxpuart_dev *nxpdev;
+ int err;
+
+ nxpdev = devm_kzalloc_obj(dev, *nxpdev);
+ if (!nxpdev)
+ return -ENOMEM;
+
+ nxpdev->nxp_data = device_get_match_data(dev);
+ if (!nxpdev->nxp_data)
+ return -ENODATA;
+
+ nxpdev->serdev = serdev;
+
+ nxpdev->pdn = devm_reset_control_get_optional_shared(dev, NULL);
+ if (IS_ERR(nxpdev->pdn))
+ return PTR_ERR(nxpdev->pdn);
+
+ err = devm_regulator_get_enable(dev, "vcc");
+ if (err) {
+ dev_err(dev, "Failed to enable vcc regulator\n");
+ return err;
+ }
+
+ if (nxp_m2_connector_is_available(&serdev->ctrl->dev)) {
+ struct pwrseq_desc *pwrseq;
+
+ pwrseq = pwrseq_get(&serdev->ctrl->dev, "uart");
+ if (IS_ERR(pwrseq))
+ return dev_err_probe(&serdev->dev, PTR_ERR(pwrseq),
+ "failed to get pwrseq\n");
+
+ nxpdev->pwrseq = pwrseq;
+ err = pwrseq_enable(pwrseq);
+ if (err)
+ goto err_pwrseq_put;
+ }
+
+ err = nxp_register_dev(nxpdev);
+ if (err)
+ goto err_pwrseq_put;
+
+ return 0;
+
err_pwrseq_put:
if (nxpdev->pwrseq)
pwrseq_put(nxpdev->pwrseq);
return err;
}
-static void nxp_serdev_remove(struct serdev_device *serdev)
+static void __nxp_remove(struct btnxpuart_dev *nxpdev)
{
- struct btnxpuart_dev *nxpdev = serdev_device_get_drvdata(serdev);
struct hci_dev *hdev = nxpdev->hdev;
if (is_fw_downloading(nxpdev)) {
@@ -2000,6 +2018,62 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
hci_free_dev(hdev);
}
+static void nxp_serdev_remove(struct serdev_device *serdev)
+{
+ struct btnxpuart_dev *nxpdev = serdev_device_get_drvdata(serdev);
+
+ __nxp_remove(nxpdev);
+}
+
+static int nxp_bt_aux_probe(struct auxiliary_device *adev,
+ const struct auxiliary_device_id *id)
+{
+ struct pcie_m2_bt_auxdev *bt_auxdev = to_pcie_m2_bt_auxdev(adev);
+ struct device *dev = &adev->dev;
+ struct btnxpuart_dev *nxpdev;
+ struct pwrseq_desc *pwrseq;
+ int err;
+
+ nxpdev = devm_kzalloc_obj(dev, *nxpdev);
+ if (!nxpdev)
+ return -ENOMEM;
+
+ nxpdev->nxp_data = (const struct btnxpuart_data *)id->driver_data;
+ if (!nxpdev->nxp_data)
+ return -ENODATA;
+
+ nxpdev->serdev = bt_auxdev->serdev;
+
+ pwrseq = pwrseq_get(dev, bt_auxdev->pwrseq_target);
+ if (IS_ERR(pwrseq))
+ return dev_err_probe(dev, PTR_ERR(pwrseq),
+ "failed to get pwrseq\n");
+
+ nxpdev->pwrseq = pwrseq;
+ err = pwrseq_enable(pwrseq);
+ if (err)
+ goto err_pwrseq_put;
+
+ err = nxp_register_dev(nxpdev);
+ if (err)
+ goto err_pwrseq_put;
+
+ auxiliary_set_drvdata(adev, nxpdev);
+
+ return 0;
+
+err_pwrseq_put:
+ pwrseq_put(nxpdev->pwrseq);
+ return err;
+}
+
+static void nxp_bt_aux_remove(struct auxiliary_device *adev)
+{
+ struct btnxpuart_dev *nxpdev = auxiliary_get_drvdata(adev);
+
+ __nxp_remove(nxpdev);
+}
+
static int __maybe_unused nxp_serdev_suspend(struct device *dev)
{
struct btnxpuart_dev *nxpdev = dev_get_drvdata(dev);
@@ -2075,7 +2149,44 @@ static struct serdev_device_driver nxp_serdev_driver = {
},
};
-module_serdev_device_driver(nxp_serdev_driver);
+static const struct auxiliary_device_id nxp_bt_aux_id_table[] = {
+ {
+ .name = "pwrseq_pcie_m2.88w8987-bt",
+ .driver_data = (kernel_ulong_t)&w8987_data,
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(auxiliary, nxp_bt_aux_id_table);
+
+static struct auxiliary_driver nxp_bt_aux_driver = {
+ .name = "nxp_bt",
+ .probe = nxp_bt_aux_probe,
+ .remove = nxp_bt_aux_remove,
+ .id_table = nxp_bt_aux_id_table,
+};
+
+static int __init nxp_bt_init(void)
+{
+ int err;
+
+ err = serdev_device_driver_register(&nxp_serdev_driver);
+ if (err)
+ return err;
+
+ err = auxiliary_driver_register(&nxp_bt_aux_driver);
+ if (err)
+ serdev_device_driver_unregister(&nxp_serdev_driver);
+
+ return err;
+}
+module_init(nxp_bt_init);
+
+static void __exit nxp_bt_exit(void)
+{
+ auxiliary_driver_unregister(&nxp_bt_aux_driver);
+ serdev_device_driver_unregister(&nxp_serdev_driver);
+}
+module_exit(nxp_bt_exit);
MODULE_AUTHOR("Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>");
MODULE_DESCRIPTION("NXP Bluetooth Serial driver");
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface
2026-11-30 12:19 [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 2/5] Bluetooth: btnxpuart: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
@ 2026-11-30 12:19 ` Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 4/5] Bluetooth: hci_qca: Drop serdev based M.2 power sequencing code Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 5/5] Bluetooth: btnxpuart: " Manivannan Sadhasivam via B4 Relay
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-11-30 12:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Bartosz Golaszewski,
Manivannan Sadhasivam, Song Xue, Alex Zhou, Amitkumar Karwar,
Neeraj Kale, Philipp Zabel
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, linux-pci, linux-pm,
Wei Deng, Andy Shevchenko, Rahul Samana, Loic Poulain,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Currently, the driver instantiates the BT interface of the WCN6855 and
WCN7850 combo modules by creating a devicetree node at runtime using an
of_changeset, with the compatible passed through the PCI ID table. But this
method of creating a devicetree node just for matching with the driver is
not recommended.
So create an auxiliary device for the BT interface instead. The serdev
transport is still allocated here and handed over to the Bluetooth driver
through the auxiliary device, along with the power sequencing target used
to power up the controller. Also extend the provider match so that the
auxiliary device created for this connector is matched as its power
sequencing consumer.
Since the runtime node creation is now gone, select AUXILIARY_BUS in
place of OF_DYNAMIC.
Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> # QCC2072 over UART
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/power/sequencing/Kconfig | 2 +-
drivers/power/sequencing/pwrseq-pcie-m2.c | 141 ++++++++++++++++--------------
2 files changed, 77 insertions(+), 66 deletions(-)
diff --git a/drivers/power/sequencing/Kconfig b/drivers/power/sequencing/Kconfig
index b6a9f25fe3e3..9b44082348b7 100644
--- a/drivers/power/sequencing/Kconfig
+++ b/drivers/power/sequencing/Kconfig
@@ -50,7 +50,7 @@ config POWER_SEQUENCING_PCIE_M2
depends on OF
depends on PCI
depends on SERIAL_DEV_BUS
- select OF_DYNAMIC
+ select AUXILIARY_BUS
help
Say Y here to enable the power sequencing driver for PCIe M.2
connectors. This driver handles the power sequencing for the M.2
diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c
index 56c5d51293c1..3ff21fa33e3e 100644
--- a/drivers/power/sequencing/pwrseq-pcie-m2.c
+++ b/drivers/power/sequencing/pwrseq-pcie-m2.c
@@ -4,16 +4,18 @@
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
*/
+#include <linux/auxiliary_bus.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
+#include <linux/idr.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
-#include <linux/of_platform.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
+#include <linux/pwrseq/pcie-m2-bt.h>
#include <linux/pwrseq/provider.h>
#include <linux/regulator/consumer.h>
#include <linux/serdev.h>
@@ -21,7 +23,7 @@
struct pwrseq_pci_dev {
struct serdev_device *serdev;
- struct of_changeset *ocs;
+ struct pcie_m2_bt_auxdev *bt;
struct pci_dev *pdev;
struct list_head list;
};
@@ -196,6 +198,14 @@ static int pwrseq_pcie_m2_match(struct pwrseq_device *pwrseq,
struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
struct device_node *endpoint __free(device_node) = NULL;
+ /*
+ * The Bluetooth function is represented by an auxiliary device created
+ * by this driver. It has no OF node, so match it by verifying that it
+ * is a child of this connector.
+ */
+ if (dev_is_auxiliary(dev) && dev->parent == ctx->dev)
+ return PWRSEQ_MATCH_OK;
+
/*
* Traverse the 'remote-endpoint' nodes and check if the remote node's
* parent matches the OF node of 'dev'.
@@ -210,82 +220,90 @@ static int pwrseq_pcie_m2_match(struct pwrseq_device *pwrseq,
return PWRSEQ_NO_MATCH;
}
+/*
+ * The Bluetooth interface of a supported module is exposed as an auxiliary
+ * device. Its name (combined with this driver's module name) is matched by
+ * the Bluetooth driver. Store that name as the PCI ID driver data.
+ */
static const struct pci_device_id pwrseq_m2_pci_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x2b43),
- .driver_data = (kernel_ulong_t)"nxp,88w8987-bt" },
+ .driver_data = (kernel_ulong_t)"88w8987-bt" },
{ PCI_DEVICE(PCI_VENDOR_ID_PHILIPS, 0x3003),
- .driver_data = (kernel_ulong_t)"nxp,88w8987-bt" },
+ .driver_data = (kernel_ulong_t)"88w8987-bt" },
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1103, PCI_VENDOR_ID_QCOM, 0x0108),
- .driver_data = (kernel_ulong_t)"qcom,qca2066-bt" },
+ .driver_data = (kernel_ulong_t)"qca2066-bt" },
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1103, PCI_VENDOR_ID_FOXCONN, 0xe105),
- .driver_data = (kernel_ulong_t)"qcom,wcn6855-bt" },
+ .driver_data = (kernel_ulong_t)"wcn6855-bt" },
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1103, PCI_VENDOR_ID_QCOM, 0x337e),
- .driver_data = (kernel_ulong_t)"qcom,wcn6855-bt" },
+ .driver_data = (kernel_ulong_t)"wcn6855-bt" },
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1107, PCI_VENDOR_ID_QCOM, 0x337c),
- .driver_data = (kernel_ulong_t)"qcom,wcn7850-bt" },
+ .driver_data = (kernel_ulong_t)"wcn7850-bt" },
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1107, PCI_VENDOR_ID_LENOVO, 0xe0e9),
- .driver_data = (kernel_ulong_t)"qcom,wcn7850-bt" },
+ .driver_data = (kernel_ulong_t)"wcn7850-bt" },
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1107, PCI_VENDOR_ID_FOXCONN, 0xe0ee),
- .driver_data = (kernel_ulong_t)"qcom,wcn7850-bt" },
+ .driver_data = (kernel_ulong_t)"wcn7850-bt" },
{ } /* Sentinel */
};
-static int pwrseq_pcie_m2_create_bt_node(struct pwrseq_pcie_m2_ctx *ctx,
+static DEFINE_IDA(pwrseq_pcie_m2_bt_ida);
+
+static void pwrseq_pcie_m2_bt_release(struct device *dev)
+{
+ struct pcie_m2_bt_auxdev *bt =
+ to_pcie_m2_bt_auxdev(to_auxiliary_dev(dev));
+
+ ida_free(&pwrseq_pcie_m2_bt_ida, bt->adev.id);
+ kfree(bt);
+}
+
+static int pwrseq_pcie_m2_create_bt_aux(struct pwrseq_pcie_m2_ctx *ctx,
struct pwrseq_pci_dev *pci_dev,
- struct device_node *parent,
struct pci_dev *pdev)
{
const struct pci_device_id *id;
struct device *dev = ctx->dev;
- const char *compatible;
- struct device_node *np;
+ struct pcie_m2_bt_auxdev *bt;
int ret;
id = pci_match_id(pwrseq_m2_pci_ids, pdev);
if (WARN_ON_ONCE(!id)) /* Shouldn't happen */
return -ENODEV;
- compatible = (const char *)id->driver_data;
-
- pci_dev->ocs = kzalloc_obj(*pci_dev->ocs);
- if (!pci_dev->ocs)
+ bt = kzalloc_obj(*bt);
+ if (!bt)
return -ENOMEM;
- of_changeset_init(pci_dev->ocs);
+ ret = ida_alloc(&pwrseq_pcie_m2_bt_ida, GFP_KERNEL);
+ if (ret < 0)
+ goto err_free_bt;
- np = of_changeset_create_node(pci_dev->ocs, parent, "bluetooth");
- if (!np) {
- dev_err(dev, "Failed to create bluetooth node\n");
- ret = -ENODEV;
- goto err_destroy_changeset;
- }
+ bt->serdev = pci_dev->serdev;
+ bt->pwrseq_target = "uart";
+ bt->adev.id = ret;
+ bt->adev.name = (const char *)id->driver_data;
+ bt->adev.dev.parent = dev;
+ bt->adev.dev.release = pwrseq_pcie_m2_bt_release;
- ret = of_changeset_add_prop_string(pci_dev->ocs, np, "compatible", compatible);
- if (ret) {
- dev_err(dev, "Failed to add bluetooth compatible: %d\n", ret);
- goto err_destroy_changeset;
- }
+ ret = auxiliary_device_init(&bt->adev);
+ if (ret)
+ goto err_free_ida;
- ret = of_changeset_apply(pci_dev->ocs);
+ ret = auxiliary_device_add(&bt->adev);
if (ret) {
- dev_err(dev, "Failed to apply changeset: %d\n", ret);
- goto err_destroy_changeset;
+ dev_err(dev, "Failed to add bluetooth auxiliary device: %d\n",
+ ret);
+ auxiliary_device_uninit(&bt->adev);
+ return ret;
}
- ret = device_add_of_node(&pci_dev->serdev->dev, np);
- if (ret) {
- dev_err(dev, "Failed to add OF node: %d\n", ret);
- goto err_revert_changeset;
- }
+ pci_dev->bt = bt;
return 0;
-err_revert_changeset:
- of_changeset_revert(pci_dev->ocs);
-err_destroy_changeset:
- of_changeset_destroy(pci_dev->ocs);
- kfree(pci_dev->ocs);
- pci_dev->ocs = NULL;
+err_free_ida:
+ ida_free(&pwrseq_pcie_m2_bt_ida, bt->adev.id);
+err_free_bt:
+ kfree(bt);
return ret;
}
@@ -333,17 +351,17 @@ static int pwrseq_pcie_m2_create_serdev_one(struct pwrseq_pcie_m2_ctx *ctx,
goto err_free_pci_dev;
}
- ret = pwrseq_pcie_m2_create_bt_node(ctx, pci_dev, serdev_parent, pdev);
- if (ret)
- goto err_free_serdev;
-
ret = serdev_device_add(pci_dev->serdev);
if (ret) {
dev_err(dev, "Failed to add serdev for PCI device (%s): %d\n",
pci_name(pdev), ret);
- goto err_free_dt_node;
+ goto err_free_serdev;
}
+ ret = pwrseq_pcie_m2_create_bt_aux(ctx, pci_dev, pdev);
+ if (ret)
+ goto err_remove_serdev;
+
serdev_controller_put(serdev_ctrl);
pci_dev->pdev = pci_dev_get(pdev);
@@ -354,15 +372,11 @@ static int pwrseq_pcie_m2_create_serdev_one(struct pwrseq_pcie_m2_ctx *ctx,
return 0;
-err_free_dt_node:
- device_remove_of_node(&pci_dev->serdev->dev);
- of_changeset_revert(pci_dev->ocs);
- of_changeset_destroy(pci_dev->ocs);
- kfree(pci_dev->ocs);
- pci_dev->ocs = NULL;
+err_remove_serdev:
+ serdev_device_remove(pci_dev->serdev);
+ goto err_free_pci_dev;
err_free_serdev:
serdev_device_put(pci_dev->serdev);
- pci_dev->serdev = NULL;
err_free_pci_dev:
kfree(pci_dev);
err_put_ctrl:
@@ -374,16 +388,13 @@ static int pwrseq_pcie_m2_create_serdev_one(struct pwrseq_pcie_m2_ctx *ctx,
static void __pwrseq_pcie_m2_remove_serdev(struct pwrseq_pcie_m2_ctx *ctx,
struct pwrseq_pci_dev *pci_dev)
{
- if (pci_dev->serdev) {
- device_remove_of_node(&pci_dev->serdev->dev);
- serdev_device_remove(pci_dev->serdev);
+ if (pci_dev->bt) {
+ auxiliary_device_delete(&pci_dev->bt->adev);
+ auxiliary_device_uninit(&pci_dev->bt->adev);
}
- if (pci_dev->ocs) {
- of_changeset_revert(pci_dev->ocs);
- of_changeset_destroy(pci_dev->ocs);
- kfree(pci_dev->ocs);
- }
+ if (pci_dev->serdev)
+ serdev_device_remove(pci_dev->serdev);
pci_dev_put(pci_dev->pdev);
list_del(&pci_dev->list);
@@ -545,6 +556,7 @@ static int pwrseq_pcie_m2_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, ctx);
+ ctx->dev = dev;
ctx->of_node = dev_of_node(dev);
ctx->pdata = device_get_match_data(dev);
if (!ctx->pdata)
@@ -592,7 +604,6 @@ static int pwrseq_pcie_m2_probe(struct platform_device *pdev)
mutex_init(&ctx->list_lock);
INIT_LIST_HEAD(&ctx->pci_devices);
- ctx->dev = dev;
/* Create serdev for available PCI devices (if required) */
ret = pwrseq_pcie_m2_create_serdev(ctx);
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/5] Bluetooth: hci_qca: Drop serdev based M.2 power sequencing code
2026-11-30 12:19 [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus Manivannan Sadhasivam via B4 Relay
` (2 preceding siblings ...)
2026-11-30 12:19 ` [PATCH v2 3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface Manivannan Sadhasivam via B4 Relay
@ 2026-11-30 12:19 ` Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 5/5] Bluetooth: btnxpuart: " Manivannan Sadhasivam via B4 Relay
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-11-30 12:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Bartosz Golaszewski,
Manivannan Sadhasivam, Song Xue, Alex Zhou, Amitkumar Karwar,
Neeraj Kale, Philipp Zabel
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, linux-pci, linux-pm,
Wei Deng, Andy Shevchenko, Rahul Samana, Loic Poulain,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Bluetooth interface in M.2 modules is now enumerated using an auxiliary
device instead of serdev. The power sequencing driver now allocates an
auxiliary device for the Bluetooth interface whenever a compatible
M.2 module shows up over PCIe. And the auxiliary device gets bind to this
hci_qca driver using the existing auxiliary driver matching logic.
Earlier the same modules were brought up by fabricating a bluetooth
node under the UART controller, so that the serdev bus matched this
driver, and qca_serdev_probe grabbed the "uart" sequencer when the M.2
connector was reachable over the OF graph. That node is no longer
created, so the serdev driver never binds for an M.2 module.
Hence, remove the serdev based M.2 power sequencing code.
Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> # QCC2072 over UART
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/bluetooth/hci_qca.c | 56 ---------------------------------------------
1 file changed, 56 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 1212520ab6f0..7599ead74287 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -26,7 +26,6 @@
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_graph.h>
#include <linux/acpi.h>
#include <linux/platform_device.h>
#include <linux/pwrseq/consumer.h>
@@ -2429,49 +2428,6 @@ static int qca_init_regulators(struct qca_serdev *qcadev,
return 0;
}
-/*
- * A BT device attached through an M.2 Key E connector is described by an OF
- * graph link from the serdev controller to the connector node. Resolve the
- * remote endpoint instead of merely testing for the presence of a local
- * 'port', as some device trees carry an unconnected port anchor which must
- * not be mistaken for an M.2 connector.
- */
-static bool qca_serdev_is_m2(struct serdev_device *serdev)
-{
- struct device_node *connector __free(device_node) =
- of_graph_get_remote_node(dev_of_node(&serdev->ctrl->dev), 0, 0);
-
- return !!connector;
-}
-
-static void qca_serdev_put_pwrseq(void *data)
-{
- pwrseq_put(data);
-}
-
-static int qca_serdev_get_m2_pwrseq(struct qca_serdev *qcadev)
-{
- struct serdev_device *serdev = qcadev->serdev_hu.serdev;
- struct pwrseq_desc *pwrseq;
-
- if (!qca_serdev_is_m2(serdev))
- return 0;
-
- /* The pwrseq is looked up on the serdev controller (which holds the
- * OF graph to the M.2 connector), but its lifetime must follow this
- * serdev consumer device, not the controller. So acquire it with the
- * non-devres pwrseq_get() and release it via a devres action bound to
- * &serdev->dev instead of using devm_pwrseq_get(&serdev->ctrl->dev).
- */
- pwrseq = pwrseq_get(&serdev->ctrl->dev, "uart");
- if (IS_ERR(pwrseq))
- return PTR_ERR(pwrseq);
-
- qcadev->pwrseq = pwrseq;
-
- return devm_add_action_or_reset(&serdev->dev, qca_serdev_put_pwrseq, pwrseq);
-}
-
static int qca_serdev_probe(struct serdev_device *serdev)
{
struct qca_serdev *qcadev;
@@ -2502,17 +2458,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)
else
qcadev->btsoc_type = QCA_ROME;
- err = qca_serdev_get_m2_pwrseq(qcadev);
- if (err)
- return err;
-
- /*
- * A module behind a connector is powered entirely by the
- * connector's power sequencer.
- */
- if (qcadev->pwrseq)
- goto power_ctrl_done;
-
switch (qcadev->btsoc_type) {
case QCA_WCN3950:
case QCA_WCN3988:
@@ -2613,7 +2558,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)
}
}
-power_ctrl_done:
if (qcadev->pwrseq) {
bt_en_available = pwrseq_is_controllable(qcadev->pwrseq);
if (!bt_en_available) {
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/5] Bluetooth: btnxpuart: Drop serdev based M.2 power sequencing code
2026-11-30 12:19 [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus Manivannan Sadhasivam via B4 Relay
` (3 preceding siblings ...)
2026-11-30 12:19 ` [PATCH v2 4/5] Bluetooth: hci_qca: Drop serdev based M.2 power sequencing code Manivannan Sadhasivam via B4 Relay
@ 2026-11-30 12:19 ` Manivannan Sadhasivam via B4 Relay
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-11-30 12:19 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Bartosz Golaszewski,
Manivannan Sadhasivam, Song Xue, Alex Zhou, Amitkumar Karwar,
Neeraj Kale, Philipp Zabel
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, linux-pci, linux-pm,
Wei Deng, Andy Shevchenko, Rahul Samana, Loic Poulain,
Manivannan Sadhasivam, Sherry Sun
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Bluetooth interface in M.2 modules is now enumerated using an auxiliary
device instead of serdev. The power sequencing driver now allocates an
auxiliary device for the Bluetooth interface whenever a compatible
M.2 module shows up over PCIe. And the auxiliary device gets bind to this
btnxpuart driver using the existing auxiliary driver matching logic.
Earlier the same modules were brought up by fabricating a bluetooth
node under the UART controller, so that the serdev bus matched this
driver, and nxp_serdev_probe grabbed the "uart" sequencer when the M.2
connector was reachable over the OF graph. That node is no longer
created, so the serdev driver never binds for an M.2 module.
Hence, remove the connector helper and the serdev power sequencing code.
Tested-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/bluetooth/btnxpuart.c | 48 +------------------------------------------
1 file changed, 1 insertion(+), 47 deletions(-)
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index c7209b3b59aa..daaefcc8f891 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -10,7 +10,6 @@
#include <linux/auxiliary_bus.h>
#include <linux/serdev.h>
#include <linux/of.h>
-#include <linux/of_graph.h>
#include <linux/pwrseq/consumer.h>
#include <linux/pwrseq/pcie-m2-bt.h>
#include <linux/skbuff.h>
@@ -1820,28 +1819,6 @@ static void nxp_coredump_notify(struct hci_dev *hdev, int state)
kobject_uevent_env(&serdev->dev.kobj, KOBJ_CHANGE, envp);
}
-/*
- * Check if the remote M.2 connector device linked via OF graph is present
- * and available. This is used to determine whether the pwrseq path should
- * be taken. When the remote connector node is disabled (e.g., by a DT
- * overlay switching from PCIe WiFi to SDIO WiFi), the pwrseq path is
- * skipped, allowing the BT driver to use a direct bluetooth child node
- * instead.
- */
-static bool nxp_m2_connector_is_available(struct device *dev)
-{
- struct device_node *ep __free(device_node) =
- of_graph_get_next_endpoint(dev_of_node(dev), NULL);
-
- if (!ep)
- return false;
-
- struct device_node *remote __free(device_node) =
- of_graph_get_remote_port_parent(ep);
-
- return remote && of_device_is_available(remote);
-}
-
static int nxp_register_dev(struct btnxpuart_dev *nxpdev)
{
struct serdev_device *serdev = nxpdev->serdev;
@@ -1964,30 +1941,7 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
return err;
}
- if (nxp_m2_connector_is_available(&serdev->ctrl->dev)) {
- struct pwrseq_desc *pwrseq;
-
- pwrseq = pwrseq_get(&serdev->ctrl->dev, "uart");
- if (IS_ERR(pwrseq))
- return dev_err_probe(&serdev->dev, PTR_ERR(pwrseq),
- "failed to get pwrseq\n");
-
- nxpdev->pwrseq = pwrseq;
- err = pwrseq_enable(pwrseq);
- if (err)
- goto err_pwrseq_put;
- }
-
- err = nxp_register_dev(nxpdev);
- if (err)
- goto err_pwrseq_put;
-
- return 0;
-
-err_pwrseq_put:
- if (nxpdev->pwrseq)
- pwrseq_put(nxpdev->pwrseq);
- return err;
+ return nxp_register_dev(nxpdev);
}
static void __nxp_remove(struct btnxpuart_dev *nxpdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules
2026-11-30 12:19 ` [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
@ 2026-11-30 12:49 ` Loic Poulain
2026-11-30 16:38 ` Rework M.2 Bluetooth instantiation using the auxiliary bus bluez.test.bot
1 sibling, 0 replies; 9+ messages in thread
From: Loic Poulain @ 2026-11-30 12:49 UTC (permalink / raw)
To: manivannan.sadhasivam
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Bartosz Golaszewski,
Manivannan Sadhasivam, Song Xue, Alex Zhou, Amitkumar Karwar,
Neeraj Kale, Philipp Zabel, linux-kernel, linux-bluetooth,
linux-arm-msm, linux-pci, linux-pm, Wei Deng, Andy Shevchenko,
Rahul Samana, Bartosz Golaszewski
Hi Mani,
On Mon, Nov 30, 2026 at 1:20 PM Manivannan Sadhasivam via B4 Relay
<devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote:
>
> From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
>
> The QCA2066, WCN6855 and WCN7850 combo modules expose Bluetooth over
> UART. Since these modules are attached over PCIe, these are not described
> in firmware like devicetree. So these modules are discovered at runtime
> over PCIe by the power sequencing driver, which allocates the UART serdev
> and creates an auxiliary device carrying that transport and the power
> sequencing target to power up the Bluetooth function.
>
> Add an auxiliary driver that binds to this device. It reuses the serdev
> provided by the producer, brings up the controller through the existing
> UART transport with hci_uart_register_device() and drives power through
> the sequencer obtained with devm_pwrseq_get().
The mechanism being introduced does not look Qualcomm specific. Other
Bluetooth vendors could ship M.2 devices exposing Bluetooth over UART
and use the same discovery model. So perhaps the generic plumbing
belongs in hci_uart.c or a dedicated hci_aux.c instead of each vendor
driver implementing its own auxiliary probe?
>
> Add a shared header describing the auxiliary device so that the power
> sequencing driver and hci_qca agree on its layout.
>
> Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> # QCC2072 over UART
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> MAINTAINERS | 1 +
> drivers/bluetooth/Kconfig | 1 +
> drivers/bluetooth/hci_qca.c | 105 ++++++++++++++++++++++++++++++++++++++
> include/linux/pwrseq/pcie-m2-bt.h | 38 ++++++++++++++
> 4 files changed, 145 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 09713dc4c6a7..d670f691b6da 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -22219,6 +22219,7 @@ S: Maintained
> F: Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml
> F: Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml
> F: drivers/power/sequencing/pwrseq-pcie-m2.c
> +F: include/linux/pwrseq/pcie-m2-bt.h
>
> POWER STATE COORDINATION INTERFACE (PSCI)
> M: Mark Rutland <mark.rutland@arm.com>
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index b18482b5677f..c77f526495e5 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -258,6 +258,7 @@ config BT_HCIUART_QCA
> depends on BT_HCIUART_SERDEV
> select BT_HCIUART_H4
> select BT_QCA
> + select AUXILIARY_BUS
> help
> The Qualcomm Atheros protocol supports HCI In-Band Sleep feature
> over serial port interface(H4) between controller and host.
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index d51db761f5a6..1212520ab6f0 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -16,6 +16,7 @@
> */
>
> #include <linux/kernel.h>
> +#include <linux/auxiliary_bus.h>
> #include <linux/clk.h>
> #include <linux/completion.h>
> #include <linux/debugfs.h>
> @@ -29,6 +30,7 @@
> #include <linux/acpi.h>
> #include <linux/platform_device.h>
> #include <linux/pwrseq/consumer.h>
> +#include <linux/pwrseq/pcie-m2-bt.h>
> #include <linux/regulator/consumer.h>
> #include <linux/serdev.h>
> #include <linux/string_choices.h>
> @@ -2920,15 +2922,118 @@ static struct serdev_device_driver qca_serdev_driver = {
> },
> };
>
> +static int qca_bt_aux_probe(struct auxiliary_device *adev,
> + const struct auxiliary_device_id *id)
> +{
> + struct pcie_m2_bt_auxdev *bt_auxdev = to_pcie_m2_bt_auxdev(adev);
> + struct serdev_device *serdev = bt_auxdev->serdev;
> + const struct qca_device_data *data;
> + struct device *dev = &adev->dev;
> + struct qca_serdev *qcadev;
> + struct hci_dev *hdev;
> + bool controllable;
> + int err;
> +
> + data = (const struct qca_device_data *)id->driver_data;
> + if (!data)
> + return -ENODATA;
> +
> + qcadev = devm_kzalloc_obj(dev, *qcadev);
> + if (!qcadev)
> + return -ENOMEM;
> +
> + qcadev->serdev_hu.serdev = serdev;
> + qcadev->btsoc_type = data->soc_type;
> + serdev_device_set_drvdata(serdev, qcadev);
> +
> + qcadev->pwrseq = devm_pwrseq_get(dev, bt_auxdev->pwrseq_target);
> + if (IS_ERR(qcadev->pwrseq))
> + return dev_err_probe(dev, PTR_ERR(qcadev->pwrseq),
> + "failed to acquire power sequencer\n");
> +
> + /*
> + * When the host cannot gate the BT power individually, treat it as
> + * always-on.
> + */
> + controllable = pwrseq_is_controllable(qcadev->pwrseq);
> + if (!controllable) {
> + err = pwrseq_enable(qcadev->pwrseq);
> + if (err)
> + return dev_err_probe(dev, err,
> + "failed to power on BT device\n");
> + qcadev->pwrseq = NULL;
> + }
> +
> + err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
> + if (err)
> + return dev_err_probe(dev, err,
> + "failed to register hci_uart device\n");
> +
> + hdev = qcadev->serdev_hu.hdev;
> +
> + if (controllable) {
> + hci_set_quirk(hdev, HCI_QUIRK_NON_PERSISTENT_SETUP);
> + hdev->shutdown = qca_hci_shutdown;
> + }
> +
> + if (data->capabilities & QCA_CAP_WIDEBAND_SPEECH)
> + hci_set_quirk(hdev, HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED);
> +
> + if (!(data->capabilities & QCA_CAP_VALID_LE_STATES))
> + hci_set_quirk(hdev, HCI_QUIRK_BROKEN_LE_STATES);
> +
> + if (data->capabilities & QCA_CAP_HFP_HW_OFFLOAD)
> + qcadev->support_hfp_hw_offload = true;
> +
> + auxiliary_set_drvdata(adev, qcadev);
> +
> + return 0;
> +}
> +
> +static void qca_bt_aux_remove(struct auxiliary_device *adev)
> +{
> + struct qca_serdev *qcadev = auxiliary_get_drvdata(adev);
> +
> + hci_uart_unregister_device(&qcadev->serdev_hu);
> +}
> +
> +static const struct auxiliary_device_id qca_bt_aux_id_table[] = {
> + {
> + .name = "pwrseq_pcie_m2.qca2066-bt",
> + .driver_data = (kernel_ulong_t)&qca_soc_data_qca2066,
> + },
> + {
> + .name = "pwrseq_pcie_m2.wcn6855-bt",
> + .driver_data = (kernel_ulong_t)&qca_soc_data_wcn6855,
> + },
> + {
> + .name = "pwrseq_pcie_m2.wcn7850-bt",
> + .driver_data = (kernel_ulong_t)&qca_soc_data_wcn7850,
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(auxiliary, qca_bt_aux_id_table);
> +
> +static struct auxiliary_driver qca_bt_aux_driver = {
> + .name = "qca_bt",
> + .probe = qca_bt_aux_probe,
> + .remove = qca_bt_aux_remove,
> + .id_table = qca_bt_aux_id_table,
> +};
> +
> int __init qca_init(void)
> {
> serdev_device_driver_register(&qca_serdev_driver);
>
> + auxiliary_driver_register(&qca_bt_aux_driver);
> +
> return hci_uart_register_proto(&qca_proto);
> }
>
> int __exit qca_deinit(void)
> {
> + auxiliary_driver_unregister(&qca_bt_aux_driver);
> +
> serdev_device_driver_unregister(&qca_serdev_driver);
>
> return hci_uart_unregister_proto(&qca_proto);
> diff --git a/include/linux/pwrseq/pcie-m2-bt.h b/include/linux/pwrseq/pcie-m2-bt.h
> new file mode 100644
> index 000000000000..39e7475d7962
> --- /dev/null
> +++ b/include/linux/pwrseq/pcie-m2-bt.h
> @@ -0,0 +1,38 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + * Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> + */
> +
> +#ifndef __POWER_SEQUENCING_PCIE_M2_BT_H__
> +#define __POWER_SEQUENCING_PCIE_M2_BT_H__
> +
> +#include <linux/auxiliary_bus.h>
> +#include <linux/container_of.h>
> +
> +struct serdev_device;
> +
> +/**
> + * struct pcie_m2_bt_auxdev - Auxiliary device for the Bluetooth function of a
> + * PCIe M.2 module.
> + * @adev: Auxiliary device.
> + * @serdev: Serdev device representing the UART transport. Allocated and owned
> + * by the producer (power sequencing driver).
> + * @pwrseq_target: Power sequencing target the consumer requests to power up the
> + * Bluetooth function.
> + *
> + * On M.2 modules exposing Bluetooth over UART, the controller is not described
> + * in firmware. The power sequencing driver detects the module over PCIe and
> + * publishes this auxiliary device so that the Bluetooth driver can bind to the
> + * pre-allocated serdev transport and drive power sequencing.
> + */
> +struct pcie_m2_bt_auxdev {
> + struct auxiliary_device adev;
> + struct serdev_device *serdev;
> + const char *pwrseq_target;
> +};
> +
> +#define to_pcie_m2_bt_auxdev(_adev) \
> + container_of(_adev, struct pcie_m2_bt_auxdev, adev)
> +
> +#endif /* __POWER_SEQUENCING_PCIE_M2_BT_H__ */
>
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: Rework M.2 Bluetooth instantiation using the auxiliary bus
2026-11-30 12:19 ` [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
2026-11-30 12:49 ` Loic Poulain
@ 2026-11-30 16:38 ` bluez.test.bot
1 sibling, 0 replies; 9+ messages in thread
From: bluez.test.bot @ 2026-11-30 16:38 UTC (permalink / raw)
To: linux-bluetooth, manivannan.sadhasivam
[-- Attachment #1: Type: text/plain, Size: 2074 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/series/1226727/
---Test result---
Test Summary:
CheckPatch PASS 4.31 seconds
VerifyFixes PASS 0.08 seconds
VerifySignedoff PASS 0.08 seconds
GitLint FAIL 1.30 seconds
SubjectPrefix FAIL 0.37 seconds
BuildKernel PASS 31.09 seconds
CheckAllWarning PASS 36.19 seconds
CheckSparse PASS 38.78 seconds
BuildKernel32 PASS 31.75 seconds
CheckKernelLLVM PASS 33.18 seconds
TestRunnerSetup PASS 717.22 seconds
TestRunner_l2cap-tester PASS 14.65 seconds
TestRunner_iso-tester PASS 13.38 seconds
TestRunner_bnep-tester PASS 3.15 seconds
TestRunner_mgmt-tester PASS 89.81 seconds
TestRunner_rfcomm-tester PASS 4.38 seconds
TestRunner_sco-tester PASS 5.46 seconds
TestRunner_ioctl-tester PASS 4.52 seconds
TestRunner_mesh-tester PASS 4.48 seconds
TestRunner_smp-tester PASS 4.29 seconds
TestRunner_userchan-tester PASS 3.13 seconds
TestRunner_6lowpan-tester PASS 4.35 seconds
IncrementalBuild PASS 39.64 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v2,3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface
1: T1 Title exceeds max length (85>80): "[v2,3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface"
##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
https://github.com/bluez/bluetooth-next/pull/1255
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-30 16:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 12:19 [PATCH v2 0/5] Rework M.2 Bluetooth instantiation using the auxiliary bus Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
2026-11-30 12:49 ` Loic Poulain
2026-11-30 16:38 ` Rework M.2 Bluetooth instantiation using the auxiliary bus bluez.test.bot
2026-11-30 12:19 ` [PATCH v2 2/5] Bluetooth: btnxpuart: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 3/5] power: sequencing: pcie-m2: Create auxiliary device for the M.2 BT interface Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 4/5] Bluetooth: hci_qca: Drop serdev based M.2 power sequencing code Manivannan Sadhasivam via B4 Relay
2026-11-30 12:19 ` [PATCH v2 5/5] Bluetooth: btnxpuart: " Manivannan Sadhasivam via B4 Relay
-- strict thread matches above, loose matches on Subject: below --
2026-09-15 14:24 [PATCH 1/5] Bluetooth: hci_qca: Add auxiliary driver for PCIe M.2 modules Manivannan Sadhasivam via B4 Relay
2026-09-15 17:11 ` Rework M.2 Bluetooth instantiation using the auxiliary bus 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