mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Chris Lu <chris.lu@mediatek.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Von Dentz <luiz.dentz@gmail.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Will Lee <will-cy.Lee@mediatek.com>, SS Wu <ss.wu@mediatek.com>,
	Steve Lee <steve.lee@mediatek.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v1] Bluetooth: btmtksdio: Add pmctrl handling for BT closed state during reset
Date: Fri, 3 Oct 2025 10:11:51 +0200	[thread overview]
Message-ID: <1e8173de-8a48-4707-b276-2e1d6cfff96d@molgen.mpg.de> (raw)
In-Reply-To: <20250930053933.1685847-1-chris.lu@mediatek.com>

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);


      parent reply	other threads:[~2025-10-03  8:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-30  5:39 Chris Lu
2025-10-02 21:10 ` patchwork-bot+bluetooth
2025-10-03  8:11 ` Paul Menzel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e8173de-8a48-4707-b276-2e1d6cfff96d@molgen.mpg.de \
    --to=pmenzel@molgen.mpg.de \
    --cc=chris.lu@mediatek.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=sean.wang@mediatek.com \
    --cc=ss.wu@mediatek.com \
    --cc=steve.lee@mediatek.com \
    --cc=will-cy.Lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®