[PATCH v8 3/8] Bluetooth: hci_qca: Set 'bt_en_available' from pwrseq controllability

From: Loic Poulain

Date: Mon Nov 23 2026 - 05:25:57 EST


A Bluetooth device only needs the non-persistent setup if the host can
gate its power, so that it is actually reset on the next power-on. When the
power is controlled by a power sequencer, whether the host can gate it
depends on the hardware wiring, e.g. the presence of the BT_EN or
W_DISABLE2# line.

Query the generic pwrseq_is_controllable() helper whenever the BT power
comes from a sequencer, regardless of which provider it is (M2, WCN, ...).
If the power is not controllable, clear 'bt_en_available' so that
HCI_QUIRK_NON_PERSISTENT_SETUP is not set.

This is based on Manivannan's original patch that keyed the decision off
the W_DISABLE2# device tree property, it now uses the generic pwrseq helper
and handles the always-on case.

Reviewed-by: Manivannan Sadhasivam <mani@xxxxxxxxxx>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
---
drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 3b2792a3639cfbd9ee7a781b6e4c26c660495391..1b7b011cd6adf682677a01bd8d501a92ce896ec7 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2631,7 +2631,24 @@ static int qca_serdev_probe(struct serdev_device *serdev)
return PTR_ERR(qcadev->susclk);
}
}
-
+
+ if (qcadev->bt_power && qcadev->bt_power->pwrseq) {
+ bt_en_available = pwrseq_is_controllable(qcadev->bt_power->pwrseq);
+ if (!bt_en_available) {
+ /* The host cannot gate the BT power individually.
+ * Treat it as always-on and drop the pwrseq handle.
+ * The descriptor itself is still released by devres,
+ * so dropping the handle here is not a leak.
+ */
+ err = pwrseq_enable(qcadev->bt_power->pwrseq);
+ if (err)
+ return dev_err_probe(&serdev->dev, err,
+ "failed to power on BT device\n");
+
+ qcadev->bt_power->pwrseq = NULL;
+ }
+ }
+
err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
if (err) {
BT_ERR("serdev registration failed");

--
2.34.1