Thread (86 messages) 86 messages, 7 authors, 2021-12-21

Re: [PATCH v6 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Orlando Chamberlain <hidden>
Date: 2021-11-30 10:28:32
Also in: lkml, regressions, stable

On Tue, 30 Nov 2021 01:00:43 +1100
"Aditya Garg" [off-list ref] wrote:
From: Aditya Garg <redacted>

Some Macs with the T2 security chip had Bluetooth not working.
To fix it we add DMI based quirks to disable querying of LE Tx power.

Signed-off-by: Aditya Garg <redacted>
Reported-by: Orlando Chamberlain <redacted>
Link:
https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.com (local)
Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
---
It's hard to tell what the differences between versions of this patch
are. This spot here after the "---" is often used for a change log
(e.g. "v5->v6: Made change X and change Y"), so it would be useful to
have that if you can add one in future patches. I think someone may have
mentioned this earlier.
quoted hunk ↗ jump to hunk
 drivers/bluetooth/btbcm.c | 40
+++++++++++++++++++++++++++++++++++++++ 1 file changed, 40
insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index e4182acee488c5..40f7c9c5cf0a5a 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -8,6 +8,7 @@

 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>

 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff
*btbcm_read_usb_product(struct hci_dev *hdev) return skb;
 }

+static const struct dmi_system_id
disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME,
"MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME,
"MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME,
"MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id;
This line seems to produce a compiler warning:

drivers/bluetooth/btbcm.c: In function ‘btbcm_read_info’:
drivers/bluetooth/btbcm.c:384:22: warning: empty declaration with type
qualifier does not redeclare  tag
  384 |         const struct dmi_system_id;
      |                      ^~~~~~~~~~~~~

I think Marcel mentioned this line could be removed.

The two patches make Bluetooth work on my MacBookPro16,1, with and without
that line.

Tested-by: Orlando Chamberlain <redacted>
quoted hunk ↗ jump to hunk
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);

+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
&hdev->quirks); +
 	return 0;
 }
-- 

Thanks,

Orlando
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help