All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Thorsten Leemhuis <regressions@leemhuis.info>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Orlando Chamberlain <redecorating@protonmail.com>,
	Daniel Winkler <danielwinkler@google.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Johan Hedberg <johan.hedberg@intel.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	"regressions@lists.linux.dev" <regressions@lists.linux.dev>,
	"sonnysasaka@chromium.org" <sonnysasaka@chromium.org>
Subject: Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power
Date: Fri, 26 Nov 2021 15:15:59 +0000	[thread overview]
Message-ID: <D9375D91-1062-4265-9DE9-C7CF2B705F3F@live.com> (raw)
In-Reply-To: <332a19f1-30f0-7058-ac18-c21cf78759bb@leemhuis.info>



> On 25-Nov-2021, at 5:56 PM, Thorsten Leemhuis <regressions@leemhuis.info> wrote:
> 
> Hi, this is your Linux kernel regression tracker speaking again.
> 
> On 19.11.21 17:59, Aditya Garg wrote:
>>> On 18-Nov-2021, at 12:31 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
>>>>> So if this just affects two macs, why can't the fix be realized as a
>>>>> quirk that is only enabled on those two systems? Or are they impossible
>>>>> to detect clearly via DMI data or something like that?
>>>> 
>>>> I think we should be able to quirk based off the acpi _CID "apple-uart-blth"
>>>> or _HID "BCM2E7C". Marcel suggested quirking based of the acpi table here
>>>> https://lore.kernel.org/linux-bluetooth/1D2217A9-EA73-4D93-8D0B-5BC2718D4788@holtmann.org/
>>>> 
>>>> This would catch some unaffected Macs, but they don't support the LE Read
>>>> Transmit Power command anyway (the affected macs were released after it
>>>> was added to the Bluetooth spec, while the unaffected Macs were released
>>>> before it was added to the spec, and thus don't support it).
>>>> 
>>>> I'm not sure how to go about applying a quirk based off this, there are
>>>> quirks in drivers/bluetooth/hci_bcm.c (no_early_set_baudrate and
>>>> drive_rts_on_open), but they don't seem to be based off acpi ids.
>>>> 
>>>> It might be simpler to make it ignore the Unknown Command error, like
>>>> in this patch https://lore.kernel.org/linux-bluetooth/CABBYNZLjSfcG_KqTEbL6NOSvHhA5-b1t_S=3FQP4=GwW21kuzg@mail.gmail.com/
>>>> however that only applies on bluetooth-next and needed the status it
>>>> checks for to be -56, not 0x01.
>>> 
>>> so we abstain from try-and-error sending of commands. The Bluetooth spec
>>> has a list of supported commands that a host can query for a reason. This
>>> is really broken behavior of the controller and needs to be pointed out as
>>> such.
>> Well all I can do is provide you any logs or information I can. But we do really wish to get this regression fixed soon.
>>> 
>>> The question is just how we quirk it.
> 
> This thread once again looks stalled and smells a lot like "everyone
> agrees that his should be fixed, but afaics nobody submitted a fix or
> committed to work on one". Please speak up if my impression is wrong, as
> this is a regression and thus needs to be fixed, ideally quickly. Part
> of my job is to make that happen and thus remind developers and
> maintainers about this until we have a fix.
On the basis of DMI data, I have made this patch to disable read transmit power on 16,1. I have tested this on my 16,1 successfully. Still consider this as a draft as more models have to be added. I am sending this to get the approval of the maintainers whether this quirk is acceptable or not. If yes, I shall send the final patch.

From 3dab2e1e9e0b266574f5f010efc6680417fb0c61 Mon Sep 17 00:00:00 2001
From: Aditya Garg <gargaditya08@live.com>
Date: Fri, 26 Nov 2021 18:28:46 +0530
Subject: [PATCH] Add quirk to disable read transmit power on MacBook Pro 16
 inch, 2019

---
 net/bluetooth/hci_core.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8d33aa64846b1c..d11064cb3666ef 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -32,6 +32,7 @@
 #include <linux/property.h>
 #include <linux/suspend.h>
 #include <linux/wait.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -461,9 +462,23 @@ static void hci_set_event_mask_page_2(struct hci_request *req)
 			    sizeof(events), events);
 }
 
+static const struct dmi_system_id fix_up_apple_bluetooth[] = {
+	{
+		/* Match for Apple MacBook Pro 16 inch, 2019 which needs
+		 * read transmit power to be disabled
+		 */
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{ }
+};
+
 static int hci_init3_req(struct hci_request *req, unsigned long opt)
 {
 	struct hci_dev *hdev = req->hdev;
+	const struct dmi_system_id *dmi_id;
 	u8 p;
 
 	hci_setup_event_mask(req);
@@ -619,7 +634,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) {
+		dmi_id = dmi_first_match(fix_up_apple_bluetooth);
+		if (hdev->commands[38] & 0x80 && (!dmi_id)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
> 
> Ciao, Thorsten
> 
> #regzbot title bluetooth: "Query LE tx power on startup" broke Bluetooth
> on MacBookPro16,1
> #regzbot poke


  reply	other threads:[~2021-11-26 15:16 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29  5:09 [regression] Bluetooth: Query LE tx power on startup broke Bluetooth on MacBookPro16,1 Orlando Chamberlain
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 [this message]
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=D9375D91-1062-4265-9DE9-C7CF2B705F3F@live.com \
    --to=gargaditya08@live.com \
    --cc=danielwinkler@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan.hedberg@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=redecorating@protonmail.com \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=sonnysasaka@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.