Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3325402ybd; Tue, 25 Jun 2019 00:15:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqLOaB4T0NoWIXwrSMPNrZqQrSXqUUUAjM1P39bDgmSxVwmAtInZsIOSJaZAULMifqr64a X-Received: by 2002:a17:902:8205:: with SMTP id x5mr55002082pln.279.1561446925691; Tue, 25 Jun 2019 00:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561446925; cv=none; d=google.com; s=arc-20160816; b=FQgMRJcwihvU+UOetPVQNDXmwiX3hWFA9Ih97ATdQOwKFbDUsd51ibktk3W42TwOa2 n8VJ7DwrO3FYPeXnuZ5bl0Bvu/RLPpCQR1ZEX21bupebE5VNgmi0WeJPtP1WwDpjjcsL Zw72g+7v3nYrAVZANskkTJOsSTNdf5kP77NFXae/I2u2pvWmSTMUdqdG17ngX2STdBTs sD4hnqj6JBjjhV3AdEya2uOzoYh3g1tc8MFpbshKHMigSOZuHhUqehFfBdLBcn3DbM+2 oGhLs706qHrnSs4BjB/+0RtfxeA5YDyJ1kQkC3CfaEdLIQGPTcT3hc3mOVUBofeQmRdK jZWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xSDH/ok8CW9SbNnaNAwXiWQPIve7Xz+jyrpbhWFgBPA=; b=UD6QeuBVDEDU2xPWXg1whd3Hg5qiUhQrRr9omrupwPkc/5Yn40kGweIVByBySr8fy6 2Y7jlQaDsO+AOKQ1DDUNirISqbYhnJKQwxZgL7lrlawKanDUoMqQwlOxSE4eyxXEwePE 5RGG4zueYqkwhkB0jdWyCAaOO6I1GCmY93Sme1HKqnSQl8MVHuaGnag3V0fYFTi4HnrL qWVlWchghWUpaPa3ZAemm2+v3UEVspS32irXgJiaYHJDCjMtpeJWJosKB2Ceckk+/+FM whXX6/Yhgvo2iPgGSAlnMWi8UwyItueArpEh+zhGHM8bluP65Nj9mMdEUtWH4PxnwHPX eKaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=YBlYZSo1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 79si9808325pga.276.2019.06.25.00.15.09; Tue, 25 Jun 2019 00:15:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=YBlYZSo1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfFYFKd (ORCPT + 99 others); Tue, 25 Jun 2019 01:10:33 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:43477 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727170AbfFYFKc (ORCPT ); Tue, 25 Jun 2019 01:10:32 -0400 Received: by mail-qk1-f196.google.com with SMTP id m14so11579859qka.10 for ; Mon, 24 Jun 2019 22:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xSDH/ok8CW9SbNnaNAwXiWQPIve7Xz+jyrpbhWFgBPA=; b=YBlYZSo1HY9rwh3BdkYDs6loVnStHN+AIrnN5txkbW6DbN9BFvQ9wLuioABD+5nV4k KC7/bV3XzLmGsf1F8WEB5wE/s4JaWaMh5Bf3V3+NroQDxQ4vh2We5Fg2IPeYoda75X+G bjmNh73KbfMKWmpyAuluII0wE890z1hR+vLzEv1Fof7gQG5xmbIq2M7XxPTd9PQpL1c3 1jpFIdogLdZpByN3baZJDwfUMcw0aTo/yIDAQA2OQDq3ckJ38Ep2iIogT/yLPvHTfcTo tmPdVoeb01m/BaBhXheeTpBF5nHfvx01c4+ygLKiHxCn0WjmPrTprNSkxO+zQf2WEX8J OfIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xSDH/ok8CW9SbNnaNAwXiWQPIve7Xz+jyrpbhWFgBPA=; b=eJYq93o431PEROp30BoM52mqxvj0VAGKEXy2aYKDRjibON4THo4Ewyg9hY2gAeCjJ1 mf8etcA+53wQN/71842aL+JnZ3gtHGC/xE3Yp0UVCDH45BnTAiMjNEhwaWE7KoGGas5G jSeHm2NYUk6tAZyfZX2KOC3OsCawrPeLI2ykD+g7+bICBsc9q4pfLHkooUYTsloakbdg 8X5fhhNXOQKKDAqD3PeI4DdHgdv8pgR1NwkYBhcyxXuLDE7N2mKxbQNMIewGjNWOnrfr u3nEn59/6Ysf/BKnxNOW8ZlOWyfjahxuK/28tcut2ykkh+UZ8cWIac3u6hcJu1TQfgdU czpA== X-Gm-Message-State: APjAAAVVsCTWA35VGIbhJDEyJdhFe/8SVMygOqkrVpyvf2Hb8DCoaupF sWDyMkIuLYFcLftsetoPz5JI1i3ebnmnyI3qqQcPtg== X-Received: by 2002:a05:620a:10b2:: with SMTP id h18mr59138841qkk.14.1561439431566; Mon, 24 Jun 2019 22:10:31 -0700 (PDT) MIME-Version: 1.0 References: <20190624062114.20303-1-jian-hong@endlessm.com> In-Reply-To: <20190624062114.20303-1-jian-hong@endlessm.com> From: Daniel Drake Date: Tue, 25 Jun 2019 13:10:20 +0800 Message-ID: Subject: Re: [PATCH v2] Bluetooth: btrtl: HCI reset on close for Realtek BT chip To: Jian-Hong Pan Cc: Johan Hedberg , Marcel Holtmann , Linux Bluetooth mailing list , Linux Kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 24, 2019 at 2:24 PM Jian-Hong Pan wrote: > 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. You could also mention that scanning must be active while turning off for this bug to be hit. > bluetoothd[1576]: Failed to set mode: Failed (0x03) > > If BT is tunred off, then turned on again, it works correctly again. Typo: turned > 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. Checked the vendor driver - I see what you are referring to, so the change seems correct. #if HCI_VERSION_CODE >= KERNEL_VERSION(3, 7, 1) if (!reset) set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); RTKBT_DBG("set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);"); #endif However I'm pretty sure this is not saying that kernel 3.7.0 did not need the reset. I think it just means that the flag did not exist before Linux-3.7.1, so they added the ifdef to add some level of compatibility with older kernel versions. I think you can remove "since kernel v3.7.1." from the comment. After those changes you can add: Link: https://bugzilla.kernel.org/show_bug.cgi?id=203429 Reviewed-by: Daniel Drake > Signed-off-by: Jian-Hong Pan > --- > 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 >