linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: bgodavar@codeaurora.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>
Subject: Re: [PATCH 1/3] Bluetooth: hci_qca: Only remove TX clock vote after TX is completed
Date: Sat, 6 Jun 2020 08:26:32 -0700	[thread overview]
Message-ID: <20200606152632.GR4525@google.com> (raw)
In-Reply-To: <534a51662c623a512780e20162138469@codeaurora.org>

Hi Bala,

On Sat, Jun 06, 2020 at 06:23:13PM +0530, bgodavar@codeaurora.org wrote:
> Hi Matthias,
> 
> On 2020-06-06 00:16, Matthias Kaehlcke wrote:
> > qca_suspend() removes the vote for the UART TX clock after
> > writing an IBS sleep request to the serial buffer. This is
> > not a good idea since there is no guarantee that the request
> > has been sent at this point. Instead remove the vote after
> > successfully entering IBS sleep. This also fixes the issue
> > of the vote being removed in case of an aborted suspend due
> > to a failure of entering IBS sleep.
> > 
> > Fixes: 41d5b25fed0a0 ("Bluetooth: hci_qca: add PM support")
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> > 
> >  drivers/bluetooth/hci_qca.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> > index ece9f91cc3deb..b1d82d32892e9 100644
> > --- a/drivers/bluetooth/hci_qca.c
> > +++ b/drivers/bluetooth/hci_qca.c
> > @@ -2083,8 +2083,6 @@ static int __maybe_unused qca_suspend(struct
> > device *dev)
> > 
> >  		qca->tx_ibs_state = HCI_IBS_TX_ASLEEP;
> >  		qca->ibs_sent_slps++;
> > -
> > -		qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off);
> >  		break;
> > 
> >  	case HCI_IBS_TX_ASLEEP:
> > @@ -2112,8 +2110,10 @@ static int __maybe_unused qca_suspend(struct
> > device *dev)
> >  			qca->rx_ibs_state == HCI_IBS_RX_ASLEEP,
> >  			msecs_to_jiffies(IBS_BTSOC_TX_IDLE_TIMEOUT_MS));
> > 
> > -	if (ret > 0)
> > +	if (ret > 0) {
> > +		qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off);
> [Bala]: qca_wq_serial_tx_clock_vote_off votes for Tx clock off, when both Tx
> clock and Rx clock voted to off.
> then only actual call to clock off is called.
> https://elixir.bootlin.com/linux/latest/source/drivers/bluetooth/hci_qca.c#L312
> I would recommend to vote Tx clock off after sending SLEEP BYTE from HOST TO
> BT SOC.

Are you suggesting to move the vote after _wait_until_sent() and before
waiting for RX_SLEEP?

I think if the vote is done before RX_SLEEP and going to RX_SLEEP fails the
variables qca->tx_vote and qca->tx_votes_off would have the wrong state, even
if that doesn't lead to actually switching the clock off. I might be missing
something though, I'm not very familiar with this part.

  reply	other threads:[~2020-06-06 15:26 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 [this message]
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
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=20200606152632.GR4525@google.com \
    --to=mka@chromium.org \
    --cc=abhishekpandit@chromium.org \
    --cc=bgodavar@codeaurora.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.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).