* [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming
@ 2026-02-12 14:17 Hans de Goede
2026-02-12 14:17 ` [PATCH 2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod Hans de Goede
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Hans de Goede @ 2026-02-12 14:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz
Cc: Hans de Goede, linux-arm-msm, linux-bluetooth
The function called qca_power_off() is actually the hci_dev shutdown
handler, rename it to qca_hci_shutdown() to make this clear.
While the qca_power_shutdown() function is actually the counter-part
of qca_power_on() rename it to qca_power_off() to make this clear.
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
---
drivers/bluetooth/hci_qca.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4d562596ebf9..fa7ab4272771 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -235,8 +235,7 @@ struct qca_serdev {
static int qca_regulator_enable(struct qca_serdev *qcadev);
static void qca_regulator_disable(struct qca_serdev *qcadev);
-static void qca_power_shutdown(struct hci_uart *hu);
-static int qca_power_off(struct hci_dev *hdev);
+static void qca_power_off(struct hci_uart *hu);
static void qca_controller_memdump(struct work_struct *work);
static void qca_dmp_hdr(struct hci_dev *hdev, struct sk_buff *skb);
@@ -2015,7 +2014,7 @@ static int qca_setup(struct hci_uart *hu)
out:
if (ret && retries < MAX_INIT_RETRIES) {
bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
- qca_power_shutdown(hu);
+ qca_power_off(hu);
if (hu->serdev) {
serdev_device_close(hu->serdev);
ret = serdev_device_open(hu->serdev);
@@ -2171,7 +2170,7 @@ static const struct qca_device_data qca_soc_data_wcn7850 __maybe_unused = {
.capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES,
};
-static void qca_power_shutdown(struct hci_uart *hu)
+static void qca_power_off(struct hci_uart *hu)
{
struct qca_serdev *qcadev;
struct qca_data *qca = hu->priv;
@@ -2232,7 +2231,7 @@ static void qca_power_shutdown(struct hci_uart *hu)
set_bit(QCA_BT_OFF, &qca->flags);
}
-static int qca_power_off(struct hci_dev *hdev)
+static int qca_hci_shutdown(struct hci_dev *hdev)
{
struct hci_uart *hu = hci_get_drvdata(hdev);
struct qca_data *qca = hu->priv;
@@ -2251,7 +2250,7 @@ static int qca_power_off(struct hci_dev *hdev)
usleep_range(8000, 10000);
}
- qca_power_shutdown(hu);
+ qca_power_off(hu);
return 0;
}
@@ -2498,7 +2497,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
if (power_ctrl_enabled) {
hci_set_quirk(hdev, HCI_QUIRK_NON_PERSISTENT_SETUP);
- hdev->shutdown = qca_power_off;
+ hdev->shutdown = qca_hci_shutdown;
}
if (data) {
@@ -2530,7 +2529,7 @@ static void qca_serdev_remove(struct serdev_device *serdev)
case QCA_WCN6855:
case QCA_WCN7850:
if (power->vregs_on)
- qca_power_shutdown(&qcadev->serdev_hu);
+ qca_power_off(&qcadev->serdev_hu);
break;
default:
break;
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod
2026-02-12 14:17 [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Hans de Goede
@ 2026-02-12 14:17 ` Hans de Goede
2026-02-16 16:02 ` Bartosz Golaszewski
2026-02-12 14:27 ` [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Paul Menzel
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2026-02-12 14:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz
Cc: Hans de Goede, linux-arm-msm, linux-bluetooth
The BT core skips calling the hci_dev's shutdown method when the HCI
is unregistered. This means that qca_power_off() was not getting called
leaving BT powered on.
This causes regulators / pwrseq providers to not get disabled which also
causes problem when re-loading the module because regulators and pwrseq
providers have an enablecount which now has never dropped to 0, causing
the BT to not get properly reset between rmmod and re-load which causes
initialization failure on the re-load.
Fix this by calling qca_power_off() from qca_close() when BT has not
already been powered off through a qca_hci_shutdown() call.
hci_ldisc.c will call qca_close() after freeing the hdev, so this
means that qca_power_off() can now no longer deref hu->hdev, change
the logging in qca_power_off() to no longer use hu->hdev.
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
---
drivers/bluetooth/hci_qca.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index fa7ab4272771..9993e748b56c 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -721,6 +721,10 @@ static int qca_close(struct hci_uart *hu)
BT_DBG("hu %p qca close", hu);
+ /* BT core skips qca_hci_shutdown() which calls qca_power_off() on rmmod */
+ if (!test_bit(QCA_BT_OFF, &qca->flags))
+ qca_power_off(hu);
+
serial_clock_vote(HCI_IBS_VOTE_STATS_UPDATE, hu);
skb_queue_purge(&qca->tx_wait_q);
@@ -2220,7 +2224,7 @@ static void qca_power_off(struct hci_uart *hu)
qca_regulator_disable(qcadev);
if (qcadev->sw_ctrl) {
sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl);
- bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state);
+ BT_DBG("SW_CTRL is %d", sw_ctrl_state);
}
break;
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming
2026-02-12 14:17 [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Hans de Goede
2026-02-12 14:17 ` [PATCH 2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod Hans de Goede
@ 2026-02-12 14:27 ` Paul Menzel
2026-02-12 15:15 ` [1/2] " bluez.test.bot
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Paul Menzel @ 2026-02-12 14:27 UTC (permalink / raw)
To: Hans de Goede
Cc: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz,
linux-arm-msm, linux-bluetooth
Dear Hans,
Thank you for the patch.
Am 12.02.26 um 15:17 schrieb Hans de Goede:
> The function called qca_power_off() is actually the hci_dev shutdown
> handler, rename it to qca_hci_shutdown() to make this clear.
>
> While the qca_power_shutdown() function is actually the counter-part
> of qca_power_on() rename it to qca_power_off() to make this clear.
>
> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
> ---
> drivers/bluetooth/hci_qca.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4d562596ebf9..fa7ab4272771 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -235,8 +235,7 @@ struct qca_serdev {
>
> static int qca_regulator_enable(struct qca_serdev *qcadev);
> static void qca_regulator_disable(struct qca_serdev *qcadev);
> -static void qca_power_shutdown(struct hci_uart *hu);
> -static int qca_power_off(struct hci_dev *hdev);
> +static void qca_power_off(struct hci_uart *hu);
> static void qca_controller_memdump(struct work_struct *work);
> static void qca_dmp_hdr(struct hci_dev *hdev, struct sk_buff *skb);
>
> @@ -2015,7 +2014,7 @@ static int qca_setup(struct hci_uart *hu)
> out:
> if (ret && retries < MAX_INIT_RETRIES) {
> bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
> - qca_power_shutdown(hu);
> + qca_power_off(hu);
> if (hu->serdev) {
> serdev_device_close(hu->serdev);
> ret = serdev_device_open(hu->serdev);
> @@ -2171,7 +2170,7 @@ static const struct qca_device_data qca_soc_data_wcn7850 __maybe_unused = {
> .capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES,
> };
>
> -static void qca_power_shutdown(struct hci_uart *hu)
> +static void qca_power_off(struct hci_uart *hu)
> {
> struct qca_serdev *qcadev;
> struct qca_data *qca = hu->priv;
> @@ -2232,7 +2231,7 @@ static void qca_power_shutdown(struct hci_uart *hu)
> set_bit(QCA_BT_OFF, &qca->flags);
> }
>
> -static int qca_power_off(struct hci_dev *hdev)
> +static int qca_hci_shutdown(struct hci_dev *hdev)
> {
> struct hci_uart *hu = hci_get_drvdata(hdev);
> struct qca_data *qca = hu->priv;
> @@ -2251,7 +2250,7 @@ static int qca_power_off(struct hci_dev *hdev)
> usleep_range(8000, 10000);
> }
>
> - qca_power_shutdown(hu);
> + qca_power_off(hu);
> return 0;
> }
>
> @@ -2498,7 +2497,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>
> if (power_ctrl_enabled) {
> hci_set_quirk(hdev, HCI_QUIRK_NON_PERSISTENT_SETUP);
> - hdev->shutdown = qca_power_off;
> + hdev->shutdown = qca_hci_shutdown;
> }
>
> if (data) {
> @@ -2530,7 +2529,7 @@ static void qca_serdev_remove(struct serdev_device *serdev)
> case QCA_WCN6855:
> case QCA_WCN7850:
> if (power->vregs_on)
> - qca_power_shutdown(&qcadev->serdev_hu);
> + qca_power_off(&qcadev->serdev_hu);
> break;
> default:
> break;
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming
2026-02-12 14:17 [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Hans de Goede
2026-02-12 14:17 ` [PATCH 2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod Hans de Goede
2026-02-12 14:27 ` [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Paul Menzel
@ 2026-02-12 15:15 ` bluez.test.bot
2026-02-16 13:55 ` [PATCH 1/2] " Bartosz Golaszewski
2026-02-20 14:40 ` patchwork-bot+bluetooth
4 siblings, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2026-02-12 15:15 UTC (permalink / raw)
To: linux-bluetooth, johannes.goede
[-- Attachment #1: Type: text/plain, Size: 557 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/hci_qca.c:2015
error: drivers/bluetooth/hci_qca.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming
2026-02-12 14:17 [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Hans de Goede
` (2 preceding siblings ...)
2026-02-12 15:15 ` [1/2] " bluez.test.bot
@ 2026-02-16 13:55 ` Bartosz Golaszewski
2026-02-20 14:40 ` patchwork-bot+bluetooth
4 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2026-02-16 13:55 UTC (permalink / raw)
To: Hans de Goede
Cc: linux-arm-msm, linux-bluetooth, Bartosz Golaszewski,
Marcel Holtmann, Luiz Augusto von Dentz
On Thu, 12 Feb 2026 15:17:20 +0100, Hans de Goede
<johannes.goede@oss.qualcomm.com> said:
> The function called qca_power_off() is actually the hci_dev shutdown
> handler, rename it to qca_hci_shutdown() to make this clear.
>
> While the qca_power_shutdown() function is actually the counter-part
> of qca_power_on() rename it to qca_power_off() to make this clear.
>
> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
> ---
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod
2026-02-12 14:17 ` [PATCH 2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod Hans de Goede
@ 2026-02-16 16:02 ` Bartosz Golaszewski
0 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2026-02-16 16:02 UTC (permalink / raw)
To: Hans de Goede
Cc: linux-arm-msm, linux-bluetooth, Bartosz Golaszewski,
Marcel Holtmann, Luiz Augusto von Dentz
On Thu, 12 Feb 2026 15:17:21 +0100, Hans de Goede
<johannes.goede@oss.qualcomm.com> said:
> The BT core skips calling the hci_dev's shutdown method when the HCI
> is unregistered. This means that qca_power_off() was not getting called
> leaving BT powered on.
>
> This causes regulators / pwrseq providers to not get disabled which also
> causes problem when re-loading the module because regulators and pwrseq
> providers have an enablecount which now has never dropped to 0, causing
> the BT to not get properly reset between rmmod and re-load which causes
> initialization failure on the re-load.
>
> Fix this by calling qca_power_off() from qca_close() when BT has not
> already been powered off through a qca_hci_shutdown() call.
>
> hci_ldisc.c will call qca_close() after freeing the hdev, so this
> means that qca_power_off() can now no longer deref hu->hdev, change
> the logging in qca_power_off() to no longer use hu->hdev.
>
> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
> ---
> drivers/bluetooth/hci_qca.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index fa7ab4272771..9993e748b56c 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -721,6 +721,10 @@ static int qca_close(struct hci_uart *hu)
>
> BT_DBG("hu %p qca close", hu);
>
> + /* BT core skips qca_hci_shutdown() which calls qca_power_off() on rmmod */
> + if (!test_bit(QCA_BT_OFF, &qca->flags))
> + qca_power_off(hu);
> +
> serial_clock_vote(HCI_IBS_VOTE_STATS_UPDATE, hu);
>
> skb_queue_purge(&qca->tx_wait_q);
> @@ -2220,7 +2224,7 @@ static void qca_power_off(struct hci_uart *hu)
> qca_regulator_disable(qcadev);
> if (qcadev->sw_ctrl) {
> sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl);
> - bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state);
> + BT_DBG("SW_CTRL is %d", sw_ctrl_state);
> }
> break;
>
> --
> 2.52.0
>
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming
2026-02-12 14:17 [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Hans de Goede
` (3 preceding siblings ...)
2026-02-16 13:55 ` [PATCH 1/2] " Bartosz Golaszewski
@ 2026-02-20 14:40 ` patchwork-bot+bluetooth
4 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+bluetooth @ 2026-02-20 14:40 UTC (permalink / raw)
To: Hans de Goede; +Cc: brgl, marcel, luiz.dentz, linux-arm-msm, linux-bluetooth
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 12 Feb 2026 15:17:20 +0100 you wrote:
> The function called qca_power_off() is actually the hci_dev shutdown
> handler, rename it to qca_hci_shutdown() to make this clear.
>
> While the qca_power_shutdown() function is actually the counter-part
> of qca_power_on() rename it to qca_power_off() to make this clear.
>
> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
>
> [...]
Here is the summary with links:
- [1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming
(no matching commit)
- [2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod
https://git.kernel.org/bluetooth/bluetooth-next/c/e08fdde76adb
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] 7+ messages in thread
end of thread, other threads:[~2026-02-20 14:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 14:17 [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Hans de Goede
2026-02-12 14:17 ` [PATCH 2/2] Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod Hans de Goede
2026-02-16 16:02 ` Bartosz Golaszewski
2026-02-12 14:27 ` [PATCH 1/2] Bluetooth: hci_qca: Fix confusing shutdown() and power_off() naming Paul Menzel
2026-02-12 15:15 ` [1/2] " bluez.test.bot
2026-02-16 13:55 ` [PATCH 1/2] " Bartosz Golaszewski
2026-02-20 14:40 ` 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