]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Bluetooth: add quirk disabling LE Read Transmit Power
authorAditya Garg <gargaditya08@live.com>
Thu, 2 Dec 2021 12:41:59 +0000 (12:41 +0000)
committerAndrea Righi <andrea.righi@canonical.com>
Fri, 21 Jan 2022 14:49:35 +0000 (15:49 +0100)
BugLink: https://bugs.launchpad.net/bugs/1958418
commit d2f8114f9574509580a8506d2ef72e7e43d1a5bd upstream.

Some devices have a bug causing them to not work if they query
LE tx power on startup. Thus we add a quirk in order to not query it
and default min/max tx power values to HCI_TX_POWER_INVALID.

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Reported-by: Orlando Chamberlain <redecorating@protonmail.com>
Tested-by: Orlando Chamberlain <redecorating@protonmail.com>
Link:
https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.com
Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
Cc: stable@vger.kernel.org
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
include/net/bluetooth/hci.h
net/bluetooth/hci_core.c

index b80415011dcd5b98a5f34fc10cc33f8686b11d4c..9ce46cb8564d64528c94d4131107d30981a5185e 100644 (file)
@@ -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 */
index 8a47a3017d61de76a9f3c5e5c06a95b5908e4c6c..325db9c4c610907f5f0eafd3379539f7f83245ca 100644 (file)
@@ -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);