|
| 1 | +From 64dad24333ddb290f4e2f6c489abe03247030320 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Orlando Chamberlain < [email protected]> |
| 3 | +Date: Tue, 28 Sep 2021 20:41:35 +1000 |
| 4 | +Subject: [PATCH] bluetooth: add disable read tx power quirk |
| 5 | + |
| 6 | +--- |
| 7 | + drivers/bluetooth/btbcm.c | 4 ++++ |
| 8 | + include/net/bluetooth/hci.h | 9 +++++++++ |
| 9 | + net/bluetooth/hci_core.c | 3 ++- |
| 10 | + 3 files changed, 15 insertions(+), 1 deletion(-) |
| 11 | + |
| 12 | +diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c |
| 13 | +index e4182acee488..4ecc50d93107 100644 |
| 14 | +--- a/drivers/bluetooth/btbcm.c |
| 15 | ++++ b/drivers/bluetooth/btbcm.c |
| 16 | +@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev) |
| 17 | + return PTR_ERR(skb); |
| 18 | + |
| 19 | + bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]); |
| 20 | ++ |
| 21 | ++ if (skb->data[1] == 150) |
| 22 | ++ set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks); |
| 23 | ++ |
| 24 | + kfree_skb(skb); |
| 25 | + |
| 26 | + /* Read Controller Features */ |
| 27 | +diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h |
| 28 | +index b80415011dcd..9ce46cb8564d 100644 |
| 29 | +--- a/include/net/bluetooth/hci.h |
| 30 | ++++ b/include/net/bluetooth/hci.h |
| 31 | +@@ -246,6 +246,15 @@ enum { |
| 32 | + * HCI after resume. |
| 33 | + */ |
| 34 | + HCI_QUIRK_NO_SUSPEND_NOTIFIER, |
| 35 | ++ |
| 36 | ++ /* |
| 37 | ++ * When this quirk is set, LE tx power is not queried on startup |
| 38 | ++ * and the min/max tx power values default to HCI_TX_POWER_INVALID. |
| 39 | ++ * |
| 40 | ++ * This quirk can be set before hci_register_dev is called or |
| 41 | ++ * during the hdev->setup vendor callback. |
| 42 | ++ */ |
| 43 | ++ HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, |
| 44 | + }; |
| 45 | + |
| 46 | + /* HCI device flags */ |
| 47 | +diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
| 48 | +index 8a47a3017d61..9a23fe7c8d67 100644 |
| 49 | +--- a/net/bluetooth/hci_core.c |
| 50 | ++++ b/net/bluetooth/hci_core.c |
| 51 | +@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt) |
| 52 | + hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL); |
| 53 | + } |
| 54 | + |
| 55 | +- if (hdev->commands[38] & 0x80) { |
| 56 | ++ if (hdev->commands[38] & 0x80 && |
| 57 | ++ !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) { |
| 58 | + /* Read LE Min/Max Tx Power*/ |
| 59 | + hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER, |
| 60 | + 0, NULL); |
| 61 | +-- |
| 62 | +2.33.0 |
| 63 | + |
0 commit comments