regressions.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Orlando Chamberlain <redecorating@protonmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: "regressions@lists.linux.dev" <regressions@lists.linux.dev>,
	sonnysasaka@chromium.org, danielwinkler@google.com,
	marcel@holtmann.org, johan.hedberg@intel.com
Subject: [regression] Bluetooth: Query LE tx power on startup broke Bluetooth on MacBookPro16,1
Date: Wed, 29 Sep 2021 05:09:17 +0000	[thread overview]
Message-ID: <4970a940-211b-25d6-edab-21a815313954@protonmail.com> (raw)

Commit 7c395ea521e6 made Bluetooth stop working on the MacBookPro16,1. I

believe this also affected the iMac20,1. The patch below introduces a quirk

disabling Read LE Min/Max Tx Power for affected computers, based off the brcm
chip
 id 150.



I think there are a couple of issues with this patch that I don't have the

knowledge to resolve:

1. I don't know how accurate the description of the quirk is, I based it off

   the commit message of 7c395ea521e6m, however I don't understand much about

   how Bluetooth works. Other Bluetooth quirks also have explanations as to

   why they are needed, I don't know why this quirk is needed (is it that

   these chips incorrectly say they support read le minmax tx power? I just

   don't know).

2. It may be a bug in the min max le tx power code that could be fixed instead

   of disabling it for the affected devices.



I haven't had much success in figuring out exactly why reading le minmax tx

power stops Bluetooth from working. I have noticed that these lines are not

present in dmesg when Bluetooth is not working due to this issue:



Bluetooth: RFCOMM TTY layer initialized

Bluetooth: RFCOMM socket layer initialized

Bluetooth: RFCOMM ver 1.11



I have also added some logging around the changes in 7c395ea521e6, the two

patches (one with bt working one without) I tried and their associated dmesgs

are here https://gist.github.com/Redecorating/8330bb58a7cb8730be3956058ba4599f



Regards,

Orlando Chamberlain



---

 drivers/bluetooth/btbcm.c   | 4 ++++

 include/net/bluetooth/hci.h | 9 +++++++++

 net/bluetooth/hci_core.c    | 3 ++-

 3 files changed, 15 insertions(+), 1 deletion(-)



diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c

index e4182acee488..4ecc50d93107 100644

--- a/drivers/bluetooth/btbcm.c

+++ b/drivers/bluetooth/btbcm.c

@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)

 		return PTR_ERR(skb);



 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);

+

+	if (skb->data[1] == 150)

+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);

+

 	kfree_skb(skb);



 	/* Read Controller Features */

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h

index b80415011dcd..9ce46cb8564d 100644

--- a/include/net/bluetooth/hci.h

+++ b/include/net/bluetooth/hci.h

@@ -246,6 +246,15 @@ enum {

 	 * HCI after resume.

 	 */

 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,

+

+	/*

+	 * When this quirk is set, LE tx power is not queried on startup

+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.

+	 *

+	 * This quirk can be set before hci_register_dev is called or

+	 * during the hdev->setup vendor callback.

+	 */

+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,

 };



 /* HCI device flags */

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c

index 8a47a3017d61..9a23fe7c8d67 100644

--- a/net/bluetooth/hci_core.c

+++ b/net/bluetooth/hci_core.c

@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)

 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);

 		}



-		if (hdev->commands[38] & 0x80) {

+		if (hdev->commands[38] & 0x80 &&

+	    	!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

 			/* Read LE Min/Max Tx Power*/

 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,

 				    0, NULL);

--

2.33.0


             reply	other threads:[~2021-09-29  5:09 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29  5:09 Orlando Chamberlain [this message]
2021-09-29  5:56 ` Thorsten Leemhuis
2021-09-30  6:32 ` Orlando Chamberlain
2021-09-30  6:51   ` Greg KH
2021-09-30 14:13   ` [PATCH] Bluetooth: add quirk disabling query LE tx power Orlando Chamberlain
2021-09-30 17:03     ` Thorsten Leemhuis
2021-09-30 17:58     ` Marcel Holtmann
2021-10-01  3:37       ` Orlando Chamberlain
2021-10-01  8:36         ` [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power Orlando Chamberlain
2021-10-01  9:35           ` Marcel Holtmann
2021-10-01 13:28             ` Orlando Chamberlain
2021-10-04 11:15               ` Orlando Chamberlain
2021-11-05 13:39                 ` Thorsten Leemhuis
2021-11-05 21:47           ` Luiz Augusto von Dentz
2021-11-06  9:41             ` Aditya Garg
2021-11-06 11:49               ` Greg KH
2021-11-06 17:27                 ` Aditya Garg
2021-11-07  8:35                   ` Greg KH
2021-11-16  8:18                     ` Thorsten Leemhuis
2021-11-16  9:02                       ` Orlando Chamberlain
2021-11-16  9:26                         ` Thorsten Leemhuis
2021-11-17  3:28                           ` Aditya Garg
2021-11-17  7:25                             ` Greg KH
2021-11-17  9:26                               ` Aditya Garg
2021-11-17  9:42                                 ` Thorsten Leemhuis
2021-11-17  9:59                                   ` Aditya Garg
2021-11-17 12:48                                   ` Orlando Chamberlain
2021-11-17 19:01                                     ` Marcel Holtmann
2021-11-19 16:59                                       ` Aditya Garg
2021-11-25 12:26                                         ` Thorsten Leemhuis
2021-11-26 15:15                                           ` Aditya Garg
2021-11-29  7:12                                             ` Aditya Garg
2021-11-29  7:22                                             ` [PATCH 1/6] Bluetooth: add " Aditya Garg
2021-11-29  7:27                                               ` [PATCH 2/6] btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019) Aditya Garg
2021-11-29  7:28                                                 ` [PATCH 3/6] btbcm: disable read tx power for MacBook Pro 16,2 (13 inch - 4 Thunderbolt Ports, 2020) Aditya Garg
2021-11-29  7:30                                                   ` [PATCH 4/6] btbcm: disable read tx power for MacBook Pro 16,4 (16 inch, 2019) Aditya Garg
2021-11-29  7:31                                                     ` [PATCH 5/6] btbcm: disable read tx power for iMac 20,1 (Retina 5K, 27-inch, 2020) Aditya Garg
2021-11-29  7:32                                                       ` [PATCH 6/6] btbcm: disable read tx power for iMac 20,2 " Aditya Garg
2021-11-29  7:46                                                     ` [PATCH v2 4/6] btbcm: disable read tx power for MacBook Pro 16,4 (16 inch, 2019) Aditya Garg
2021-11-29  7:45                                                   ` [PATCH v2 3/6] btbcm: disable read tx power for MacBook Pro 16,2 (13 inch - 4 Thunderbolt Ports, 2020) Aditya Garg
2021-11-29  7:44                                                 ` [PATCH v2 2/6] btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019) Aditya Garg
2021-11-29  8:08                                                 ` [PATCH " Marcel Holtmann
2021-11-29  8:11                                                   ` Aditya Garg
2021-11-29  8:22                                                     ` Marcel Holtmann
2021-11-29  8:42                                                       ` Aditya Garg
2021-11-29  7:32                                               ` [PATCH 1/6] Bluetooth: add quirk disabling LE Read Transmit Power Greg KH
2021-11-29  7:42                                                 ` [PATCH v2 " Aditya Garg
2021-11-29  7:47                                                   ` Greg KH
2021-11-29  7:49                                                     ` Aditya Garg
2021-11-29  7:47                                                   ` Greg KH
2021-11-29  8:05                                                   ` Marcel Holtmann
2021-11-29  8:32                                                     ` [PATCH v3 1/2] " Aditya Garg
2021-11-29  8:35                                                       ` [PATCH v3 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip Aditya Garg
2021-11-29  8:50                                                         ` [PATCH v3 resend " Aditya Garg
2021-11-29  9:05                                                           ` [PATCH v4 " Aditya Garg
2021-11-29  9:25                                                             ` [PATCH v5 " Aditya Garg
2021-11-29 11:03                                                           ` [PATCH v3 resend " Marcel Holtmann
2021-11-29 12:01                                                             ` Aditya Garg
2021-11-29  8:47                                                       ` [PATCH v3 resend 1/2] Bluetooth: add quirk disabling LE Read Transmit Power Aditya Garg
2021-11-29  9:03                                                         ` [PATCH v4 " Aditya Garg
2021-11-29  9:24                                                           ` [PATCH v5 " Aditya Garg
2021-11-29 13:59                                                             ` [PATCH v6 " Aditya Garg
2021-11-29 14:00                                                               ` [PATCH v6 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip Aditya Garg
2021-11-30  8:45                                                                 ` Aditya Garg
2021-11-30  8:54                                                                   ` Greg KH
2021-11-30 10:28                                                                 ` Orlando Chamberlain
2021-11-30 11:38                                                               ` [PATCH v7 1/2] Bluetooth: add quirk disabling LE Read Transmit Power Aditya Garg
2021-11-30 11:40                                                                 ` [PATCH v7 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip Aditya Garg
2021-11-30 11:41                                                                 ` [PATCH v7 1/2] Bluetooth: add quirk disabling LE Read Transmit Power Greg KH
2021-11-30 11:50                                                                   ` Aditya Garg
2021-11-30 11:48                                                                 ` [PATCH v7 resend " Aditya Garg
2021-11-30 11:49                                                                   ` [PATCH v7 resend 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip Aditya Garg
2021-11-30 12:03                                                                   ` [PATCH v7 resend 1/2] Bluetooth: add quirk disabling LE Read Transmit Power Greg KH
2021-11-30 12:53                                                                     ` Aditya Garg
2021-11-30 12:53                                                                   ` [PATCH v8 " Aditya Garg
2021-11-30 12:54                                                                     ` [PATCH v8 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip Aditya Garg
2021-12-01  7:25                                                                     ` [PATCH v8 1/2] Bluetooth: add quirk disabling LE Read Transmit Power Marcel Holtmann
2021-12-02 10:15                                                                     ` [PATCH v9 " Aditya Garg
2021-12-02 10:16                                                                       ` [PATCH v9 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip Aditya Garg
2021-12-02 12:41                                                                       ` [PATCH v10 1/2] Bluetooth: add quirk disabling LE Read Transmit Power Aditya Garg
2021-12-02 12:42                                                                         ` [PATCH v10 2/2] btbcm: disable read tx power for some Macs with the T2 Security chip Aditya Garg
2021-12-03 21:28                                                                           ` Marcel Holtmann
2021-12-21 13:44                                                                             ` Thorsten Leemhuis
2021-12-03 21:28                                                                         ` [PATCH v10 1/2] Bluetooth: add quirk disabling LE Read Transmit Power Marcel Holtmann
2021-11-29  8:52                                                       ` [PATCH v3 " Thorsten Leemhuis
2021-11-29 11:02                                                       ` Marcel Holtmann
2021-11-07  3:25             ` [PATCHv2] Bluetooth: " Orlando Chamberlain

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=4970a940-211b-25d6-edab-21a815313954@protonmail.com \
    --to=redecorating@protonmail.com \
    --cc=danielwinkler@google.com \
    --cc=johan.hedberg@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=regressions@lists.linux.dev \
    --cc=sonnysasaka@chromium.org \
    --subject='Re: [regression] Bluetooth: Query LE tx power on startup broke Bluetooth on MacBookPro16,1' \
    /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

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