[PATCH] Add quirk to disable read transmit power on MacBook Pro 16 inch, 2019

From: Aditya Garg
Date: Fri Nov 26 2021 - 07:58:46 EST


---
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>
=20
#include <net/bluetooth/bluetooth.h>
@@ -461,9 +462,23 @@ static void hci_set_event_mask_page_2(struct hci_reque=
st *req)
sizeof(events), events);
}
=20
+static const struct dmi_system_id fix_up_apple_bluetooth[] =3D {
+ {
+ /* Match for Apple MacBook Pro 16 inch, 2019 which needs
+ * read transmit power to be disabled
+ */
+ .matches =3D {
+ 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 =3D req->hdev;
+ const struct dmi_system_id *dmi_id;
u8 p;
=20
hci_setup_event_mask(req);
@@ -619,7 +634,8 @@ static int hci_init3_req(struct hci_request *req, unsig=
ned long opt)
hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
}
=20
- if (hdev->commands[38] & 0x80) {
+ dmi_id =3D 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);
>=20
> Ciao, Thorsten
>=20
> #regzbot title bluetooth: "Query LE tx power on startup" broke Bluetooth
> on MacBookPro16,1
> #regzbot poke