* [PATCH v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset
@ 2025-09-30 5:39 Chris Lu
2025-10-02 21:10 ` patchwork-bot+bluetooth
2025-10-03 8:11 ` Paul Menzel
0 siblings, 2 replies; 3+ messages in thread
From: Chris Lu @ 2025-09-30 5:39 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz
Cc: Sean Wang, Will Lee, SS Wu, Steve Lee, linux-bluetooth,
linux-kernel, linux-mediatek, Chris Lu
This patch adds logic to handle power management control when the
Bluetooth function is closed during the SDIO reset sequence.
Specifically, if BT is closed before reset, the driver enables the
SDIO function and sets driver pmctrl. After reset, if BT remains
closed, the driver sets firmware pmctrl and disables the SDIO function.
These changes ensure proper power management and device state consistency
across the reset flow.
Fixes: 8fafe702253d ("Bluetooth: mt7921s: support bluetooth reset mechanism")
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
---
drivers/bluetooth/btmtksdio.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 50abefba6d04..62db31bd6592 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1270,6 +1270,12 @@ static void btmtksdio_reset(struct hci_dev *hdev)
sdio_claim_host(bdev->func);
+ /* set drv_pmctrl if BT is closed before doing reset */
+ if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state)) {
+ sdio_enable_func(bdev->func);
+ btmtksdio_drv_pmctrl(bdev);
+ }
+
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
skb_queue_purge(&bdev->txq);
cancel_work_sync(&bdev->txrx_work);
@@ -1285,6 +1291,12 @@ static void btmtksdio_reset(struct hci_dev *hdev)
goto err;
}
+ /* set fw_pmctrl back if BT is closed after doing reset */
+ if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state)) {
+ btmtksdio_fw_pmctrl(bdev);
+ sdio_disable_func(bdev->func);
+ }
+
clear_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
err:
sdio_release_host(bdev->func);
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset
2025-09-30 5:39 [PATCH v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset Chris Lu
@ 2025-10-02 21:10 ` patchwork-bot+bluetooth
2025-10-03 8:11 ` Paul Menzel
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-10-02 21:10 UTC (permalink / raw)
To: Chris Lu
Cc: marcel, johan.hedberg, luiz.dentz, sean.wang, will-cy.Lee, ss.wu,
steve.lee, linux-bluetooth, linux-kernel, linux-mediatek
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 30 Sep 2025 13:39:33 +0800 you wrote:
> This patch adds logic to handle power management control when the
> Bluetooth function is closed during the SDIO reset sequence.
>
> Specifically, if BT is closed before reset, the driver enables the
> SDIO function and sets driver pmctrl. After reset, if BT remains
> closed, the driver sets firmware pmctrl and disables the SDIO function.
>
> [...]
Here is the summary with links:
- [v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset
https://git.kernel.org/bluetooth/bluetooth-next/c/739892687cf5
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] 3+ messages in thread* Re: [PATCH v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset
2025-09-30 5:39 [PATCH v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset Chris Lu
2025-10-02 21:10 ` patchwork-bot+bluetooth
@ 2025-10-03 8:11 ` Paul Menzel
1 sibling, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2025-10-03 8:11 UTC (permalink / raw)
To: Chris Lu
Cc: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz, Sean Wang,
Will Lee, SS Wu, Steve Lee, linux-bluetooth, linux-kernel,
linux-mediatek
Dear Chris,
Thank you for your patch.
Am 30.09.25 um 07:39 schrieb Chris Lu:
> This patch adds logic to handle power management control when the
> Bluetooth function is closed during the SDIO reset sequence.
>
> Specifically, if BT is closed before reset, the driver enables the
> SDIO function and sets driver pmctrl. After reset, if BT remains
> closed, the driver sets firmware pmctrl and disables the SDIO function.
>
> These changes ensure proper power management and device state consistency
> across the reset flow.
How can your patch be verified on a running system?
Kind regards,
Paul
> Fixes: 8fafe702253d ("Bluetooth: mt7921s: support bluetooth reset mechanism")
> Signed-off-by: Chris Lu <chris.lu@mediatek.com>
> ---
> drivers/bluetooth/btmtksdio.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
> index 50abefba6d04..62db31bd6592 100644
> --- a/drivers/bluetooth/btmtksdio.c
> +++ b/drivers/bluetooth/btmtksdio.c
> @@ -1270,6 +1270,12 @@ static void btmtksdio_reset(struct hci_dev *hdev)
>
> sdio_claim_host(bdev->func);
>
> + /* set drv_pmctrl if BT is closed before doing reset */
> + if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state)) {
> + sdio_enable_func(bdev->func);
> + btmtksdio_drv_pmctrl(bdev);
> + }
> +
> sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
> skb_queue_purge(&bdev->txq);
> cancel_work_sync(&bdev->txrx_work);
> @@ -1285,6 +1291,12 @@ static void btmtksdio_reset(struct hci_dev *hdev)
> goto err;
> }
>
> + /* set fw_pmctrl back if BT is closed after doing reset */
> + if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state)) {
> + btmtksdio_fw_pmctrl(bdev);
> + sdio_disable_func(bdev->func);
> + }
> +
> clear_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
> err:
> sdio_release_host(bdev->func);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-03 8:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30 5:39 [PATCH v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset Chris Lu
2025-10-02 21:10 ` patchwork-bot+bluetooth
2025-10-03 8:11 ` Paul Menzel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox