From: bgodavar@codeaurora.org
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
linux-bluetooth@vger.kernel.org,
Rocky Liao <rjliao@codeaurora.org>,
Zijun Hu <zijuhu@codeaurora.org>,
linux-kernel@vger.kernel.org,
Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
Claire Chang <tientzu@chromium.org>,
hemantg@codeaurora.org
Subject: Re: [PATCH 2/3] Bluetooth: hci_qca: Skip serdev wait when no transfer is pending
Date: Sat, 06 Jun 2020 18:27:59 +0530 [thread overview]
Message-ID: <ca3bb368e9959770720c8a3fbe149652@codeaurora.org> (raw)
In-Reply-To: <20200605114552.2.I2a095adb2a9a98b15c11d7310db142b27f8cab28@changeid>
Hi matthias,
On 2020-06-06 00:16, Matthias Kaehlcke wrote:
> qca_suspend() calls serdev_device_wait_until_sent() regardless of
> whether a transfer is pending. While it does no active harm since
> the function should return immediately it makes the code more
> confusing. Add a flag to track whether a transfer is pending and
> only call serdev_device_wait_until_sent() is needed.
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
>
> drivers/bluetooth/hci_qca.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index b1d82d32892e9..90ffd8ca1fb0d 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -2050,6 +2050,7 @@ static int __maybe_unused qca_suspend(struct
> device *dev)
> struct hci_uart *hu = &qcadev->serdev_hu;
> struct qca_data *qca = hu->priv;
> unsigned long flags;
> + bool tx_pending = false;
> int ret = 0;
> u8 cmd;
>
> @@ -2083,6 +2084,7 @@ static int __maybe_unused qca_suspend(struct
> device *dev)
>
> qca->tx_ibs_state = HCI_IBS_TX_ASLEEP;
> qca->ibs_sent_slps++;
> + tx_pending = true;
> break;
>
> case HCI_IBS_TX_ASLEEP:
> @@ -2099,8 +2101,10 @@ static int __maybe_unused qca_suspend(struct
> device *dev)
> if (ret < 0)
> goto error;
>
> - serdev_device_wait_until_sent(hu->serdev,
> - msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
> + if (tx_pending) {
[Bala]: Good idea why don't we move this call to switch case under
HCI_IBS_TX_AWAKE
https://elixir.bootlin.com/linux/latest/source/drivers/bluetooth/hci_qca.c#L1994
i.e. i would recommend below sequence
1. Send SLEEP BYTE
2. wait for some time to write SLEEP Byte on Tx line
3. call for Tx clock off qca_wq_serial_tx_clock_vote_off
> + serdev_device_wait_until_sent(hu->serdev,
> + msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
> + }
>
> /* Wait for HCI_IBS_SLEEP_IND sent by device to indicate its Tx is
> going
> * to sleep, so that the packet does not wake the system later.
next prev parent reply other threads:[~2020-06-06 12:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-05 18:46 [PATCH 0/3] Matthias Kaehlcke
2020-06-05 18:46 ` [PATCH 1/3] Bluetooth: hci_qca: Only remove TX clock vote after TX is completed Matthias Kaehlcke
2020-06-05 20:44 ` Abhishek Pandit-Subedi
2020-06-06 12:53 ` bgodavar
2020-06-06 15:26 ` Matthias Kaehlcke
2020-06-08 8:11 ` Marcel Holtmann
2020-06-05 18:46 ` [PATCH 2/3] Bluetooth: hci_qca: Skip serdev wait when no transfer is pending Matthias Kaehlcke
2020-06-05 20:45 ` Abhishek Pandit-Subedi
2020-06-06 12:57 ` bgodavar [this message]
2020-06-06 14:42 ` Matthias Kaehlcke
2020-06-08 8:13 ` Marcel Holtmann
2020-06-05 18:46 ` [PATCH 3/3] Bluetooth: hci_qca: Refactor error handling in qca_suspend() Matthias Kaehlcke
2020-06-05 20:46 ` Abhishek Pandit-Subedi
2020-06-08 8:14 ` Marcel Holtmann
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=ca3bb368e9959770720c8a3fbe149652@codeaurora.org \
--to=bgodavar@codeaurora.org \
--cc=abhishekpandit@chromium.org \
--cc=hemantg@codeaurora.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=mka@chromium.org \
--cc=rjliao@codeaurora.org \
--cc=tientzu@chromium.org \
--cc=zijuhu@codeaurora.org \
/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;
as well as URLs for NNTP newsgroup(s).