linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jian-Hong Pan <jian-hong@endlessm.com>
To: Daniel Drake <drake@endlessm.com>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jian-Hong Pan <jian-hong@endlessm.com>
Subject: [PATCH v2] Bluetooth: btrtl: HCI reset on close for Realtek BT chip
Date: Mon, 24 Jun 2019 14:21:16 +0800	[thread overview]
Message-ID: <20190624062114.20303-1-jian-hong@endlessm.com> (raw)
In-Reply-To: <CAD8Lp44RP+ugBcDYkap3tUL1NSq+knGJbO9A6UAmCtcjPgxTQQ@mail.gmail.com>

Realtek RTL8822BE BT chip on ASUS X420FA cannot be turned on correctly
after on-off several times. Bluetooth daemon sets BT mode failed when
this issue happens.

bluetoothd[1576]: Failed to set mode: Failed (0x03)

If BT is tunred off, then turned on again, it works correctly again.

According to the vendor driver, the HCI_QUIRK_RESET_ON_CLOSE flag is set
during probing. So, this patch makes Realtek's BT reset on close to fix
this issue.

Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
---
v2:
 - According to the vendor driver, it makes "all" Realtek's BT reset on
   close. So, this version makes it the same.
 - Change to the new subject for all Realtek BT chips.

 drivers/bluetooth/btrtl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 208feef63de4..be6d5f7e1e44 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -630,6 +630,10 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
 		return PTR_ERR(btrtl_dev);
 
 	ret = btrtl_download_firmware(hdev, btrtl_dev);
+	/* According to the vendor driver, BT must be reset on close to avoid
+	 * firmware crash since kernel v3.7.1.
+	 */
+	set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
 
 	btrtl_free(btrtl_dev);
 
-- 
2.22.0


  reply	other threads:[~2019-06-24  6:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21  8:58 [PATCH] Bluetooth: btrtl: HCI reset on close for RTL8822BE Jian-Hong Pan
2019-06-24  4:53 ` Daniel Drake
2019-06-24  6:21   ` Jian-Hong Pan [this message]
2019-06-25  5:10     ` [PATCH v2] Bluetooth: btrtl: HCI reset on close for Realtek BT chip Daniel Drake
2019-06-25  5:43       ` Marcel Holtmann
2019-06-25  8:30         ` [PATCH v3] " Jian-Hong Pan
2019-07-01  7:45           ` Daniel Drake
2019-07-06 10:51           ` 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=20190624062114.20303-1-jian-hong@endlessm.com \
    --to=jian-hong@endlessm.com \
    --cc=drake@endlessm.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.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).