From: Aditya Garg redecorating@protonmail.com
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 Tested-by: Aditya Garg gargaditya08@live.com --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
Signed-off-by: Aditya Garg gargaditya08@live.com Tested-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..c1b0ca63880a68 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,23 @@ 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[] = { + { + /* Match for Apple MacBook Pro 16,1 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"), + }, + }, + { } +}; + static int btbcm_read_info(struct hci_dev *hdev) { struct sk_buff *skb; + const struct dmi_system_id *dmi_id;
/* Read Verbose Config Version Info */ skb = btbcm_read_verbose_config(hdev); @@ -362,6 +377,11 @@ 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 */ + dmi_id = dmi_first_match(disable_broken_read_transmit_power); + if (dmi_id) + set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
return 0; }
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple MacBook Pro 16,2 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
Signed-off-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index c1b0ca63880a6..ab7b754855d8a 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -354,6 +354,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"), }, }, + { + /* Match for Apple MacBook Pro 16,2 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"), + }, + }, { } };
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple MacBook Pro 16,4 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
Signed-off-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 348a4afa0774e..88214b453b0ce 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -363,6 +363,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"), }, }, + { + /* Match for Apple MacBook Pro 16,4 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"), + }, + }, { } };
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple iMac 20,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
Signed-off-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 88214b453b0ce..15c5be927c659 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -372,6 +372,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"), }, }, + { + /* Match for Apple iMac 20,1 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"), + }, + }, { } };
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple iMac 20,2 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
Signed-off-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 15c5be927c659..601337b5a5130 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -381,6 +381,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = { DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"), }, }, + { + /* Match for Apple iMac 20,2 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"), + }, + }, { } };
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple MacBook Pro 16,4 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
v2: Wrap changelog in 72 columns.
Signed-off-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 348a4afa0774e..88214b453b0ce 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -363,6 +363,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"), }, }, + { + /* Match for Apple MacBook Pro 16,4 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"), + }, + }, { } };
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple MacBook Pro 16,2 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
v2: Wrap changelog in 72 columns
Signed-off-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index c1b0ca63880a6..ab7b754855d8a 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -354,6 +354,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"), }, }, + { + /* Match for Apple MacBook Pro 16,2 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"), + }, + }, { } };
From: Aditya Garg gargaditya08@live.com
Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
v2: Wrap the changeling at 72 columns and remove tested by.
Signed-off-by: Aditya Garg gargaditya08@live.com --- drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..c1b0ca63880a68 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,23 @@ 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[] = { + { + /* Match for Apple MacBook Pro 16,1 which needs + * Read LE Min/Max Tx Power to be disabled. + */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"), + }, + }, + { } +}; + static int btbcm_read_info(struct hci_dev *hdev) { struct sk_buff *skb; + const struct dmi_system_id *dmi_id;
/* Read Verbose Config Version Info */ skb = btbcm_read_verbose_config(hdev); @@ -362,6 +377,11 @@ 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 */ + dmi_id = dmi_first_match(disable_broken_read_transmit_power); + if (dmi_id) + set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
return 0; }
Hi Aditya,
Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.
Signed-off-by: Aditya Garg gargaditya08@live.com Tested-by: Aditya Garg gargaditya08@live.com
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..c1b0ca63880a68 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,23 @@ 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[] = {
- {
/* Match for Apple MacBook Pro 16,1 which needs
* Read LE Min/Max Tx Power to be disabled.
*/
Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
},
- },
- { }
+};
static int btbcm_read_info(struct hci_dev *hdev) { struct sk_buff *skb;
const struct dmi_system_id *dmi_id;
/* Read Verbose Config Version Info */ skb = btbcm_read_verbose_config(hdev);
@@ -362,6 +377,11 @@ 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 */
- dmi_id = dmi_first_match(disable_broken_read_transmit_power);
- if (dmi_id)
set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
if (dmi_first_match(..)) set_bit(.., &hdev->quirks);
There is really no need to have a variable for this.
Regards
Marcel
On 29-Nov-2021, at 1:38 PM, Marcel Holtmann marcel@holtmann.org wrote:
Hi Aditya,
Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.
Signed-off-by: Aditya Garg gargaditya08@live.com Tested-by: Aditya Garg gargaditya08@live.com
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..c1b0ca63880a68 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,23 @@ 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[] = {
- {
/* Match for Apple MacBook Pro 16,1 which needs
* Read LE Min/Max Tx Power to be disabled.
*/
Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.
Alright, I prepare the patches into a single one
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
},
- },
- { }
+};
static int btbcm_read_info(struct hci_dev *hdev) { struct sk_buff *skb;
const struct dmi_system_id *dmi_id;
/* Read Verbose Config Version Info */ skb = btbcm_read_verbose_config(hdev);
@@ -362,6 +377,11 @@ 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 */
- dmi_id = dmi_first_match(disable_broken_read_transmit_power);
- if (dmi_id)
set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
if (dmi_first_match(..)) set_bit(.., &hdev->quirks);
There is really no need to have a variable for this.
Fine, Ill correct this
Regards
Marcel
Hi Aditya,
Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.
Signed-off-by: Aditya Garg gargaditya08@live.com Tested-by: Aditya Garg gargaditya08@live.com
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..c1b0ca63880a68 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,23 @@ 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[] = {
- {
/* Match for Apple MacBook Pro 16,1 which needs
* Read LE Min/Max Tx Power to be disabled.
*/
Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.
Alright, I prepare the patches into a single one
two patches, one for adding the quirk to the core and one for adjusting the driver.
Regards
Marcel
On 29-Nov-2021, at 1:52 PM, Marcel Holtmann marcel@holtmann.org wrote:
Hi Aditya,
Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.
list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.
Signed-off-by: Aditya Garg gargaditya08@live.com Tested-by: Aditya Garg gargaditya08@live.com
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..c1b0ca63880a68 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,23 @@ 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[] = {
- {
/* Match for Apple MacBook Pro 16,1 which needs
* Read LE Min/Max Tx Power to be disabled.
*/
Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.
Alright, I prepare the patches into a single one
two patches, one for adding the quirk to the core and one for adjusting the driver.
Sent
Regards
Marcel
On Mon, Nov 29, 2021 at 07:22:27AM +0000, Aditya Garg wrote:
From: Aditya Garg redecorating@protonmail.com
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.
Please wrap your changelog text at 72 columns, like your editor asked you to :)
Signed-off-by: Aditya Garg gargaditya08@live.com Tested-by: Aditya Garg gargaditya08@live.com
Tested-by: is implicit for patches you create yourself, so no need to add it again :)
include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
Did you run checkpatch on this patch? Please indent properly.
thanks,
greg k-h
From: Aditya Garg gargaditya08@live.com
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.
v2: Wrap the changeling at 72 columns, correct email and remove tested by.
Signed-off-by: Aditya Garg gargaditya08@live.com --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
On Mon, Nov 29, 2021 at 07:42:39AM +0000, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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.
v2: Wrap the changeling at 72 columns, correct email and remove tested by.
These lines are not wrapped at 72 columns :(
Also the changes line goes below the --- line, as documented in the kernel documentation on how to submit a patch.
thanks,
greg k-h
On 29-Nov-2021, at 1:17 PM, Greg KH gregkh@linuxfoundation.org wrote:
On Mon, Nov 29, 2021 at 07:42:39AM +0000, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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.
v2: Wrap the changeling at 72 columns, correct email and remove tested by.
These lines are not wrapped at 72 columns :(
If I am not wrong, you mean that there should be 72 characters in one line right?
Also the changes line goes below the --- line, as documented in the kernel documentation on how to submit a patch.
thanks,
greg k-h
On Mon, Nov 29, 2021 at 07:42:39AM +0000, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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.
v2: Wrap the changeling at 72 columns, correct email and remove tested by.
Signed-off-by: Aditya Garg gargaditya08@live.com
include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
You did not fix this formatting? Why not?
thanks,
greg k-h
Hi Aditya,
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.
v2: Wrap the changeling at 72 columns, correct email and remove tested by.
that part is for the reviewer and needs to go after ---. Otherwise please break at 72 characters.
Signed-off-by: Aditya Garg gargaditya08@live.com
include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
if ((hdev->commands[38] & 0x80) && !test_bit(HCI_QUIRK_.., &hdev->quirks)) {
/* Read LE Min/Max Tx Power*/ hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER, 0, NULL);
Regards
Marcel
From: Aditya Garg gargaditya08@live.com
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 --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com --- 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 *dmi_id;
/* 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; }
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com --- 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 *dmi_id;
/* 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; }
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com Reported-by: Orlando Chamberlain redecorating@protonmail.com Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- 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 *dmi_id;
/* 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; }
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com Reported-by: Orlando Chamberlain redecorating@protonmail.com Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- 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 *dmi_id;
/* 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; }
Hi Aditya,
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 gargaditya08@live.com
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 *dmi_id;
this variable is not needed.
/* 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;
}
Regards
Marcel
On 29-Nov-2021, at 4:33 PM, Marcel Holtmann marcel@holtmann.org wrote:
Hi Aditya,
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 gargaditya08@live.com
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 *dmi_id;
this variable is not needed.
You want me to replace const struct dmi_system_id *dmi_id; with const struct dmi_system_id or remove it altogether.
/* 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;
}
Regards
Marcel
From: Aditya Garg gargaditya08@live.com
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 --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com Reported-by: Orlando Chamberlain redecorating@protonmail.com Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- 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;
/* 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; }
On 29-Nov-2021, at 7:30 PM, Aditya Garg gargaditya08@live.com wrote:
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com Reported-by: Orlando Chamberlain redecorating@protonmail.com Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
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;
/* 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;
}
May I know whether this is fine or not.
On Tue, Nov 30, 2021 at 08:45:44AM +0000, Aditya Garg wrote:
On 29-Nov-2021, at 7:30 PM, Aditya Garg gargaditya08@live.com wrote:
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com Reported-by: Orlando Chamberlain redecorating@protonmail.com Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
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;
/* 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;
}
May I know whether this is fine or not.
Please realize that maintainers have lots and lots of patches to review. If after 2 weeks of no response, it is fine to resend the patch again.
If you wish to help out with the maintainer's review load, please feel free to review patches on the relevant mailing list to help lighten that load such that your patch can be reviewed quicker.
thanks,
greg k-h
On Tue, 30 Nov 2021 01:00:43 +1100 "Aditya Garg" gargaditya08@live.com wrote:
From: Aditya Garg gargaditya08@live.com
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 gargaditya08@live.com Reported-by: Orlando Chamberlain redecorating@protonmail.com Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... 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.
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 redecorating@protonmail.com
/* 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; }
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- v7 :- Added Tested-by. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- v7 :- Removed unused variable and added Tested-by. drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..07fabaa5aa2979 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,6 +344,40 @@ 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; @@ -363,6 +398,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; }
On Tue, Nov 30, 2021 at 11:38:58AM +0000, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
v7 :- Added Tested-by. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
This line is still not properly formatted.
Please always use scripts/checkpatch.pl to find issues like this.
thanks,
greg k-h
On 30-Nov-2021, at 5:11 PM, Greg KH gregkh@linuxfoundation.org wrote:
On Tue, Nov 30, 2021 at 11:38:58AM +0000, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
v7 :- Added Tested-by. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
This line is still not properly formatted.
I hope its fine in the resent patch. I sent the patch as HTML by mistake.
Please always use scripts/checkpatch.pl to find issues like this.
thanks,
greg k-h
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- v7 :- Added Tested-by. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- v7 :- Removed unused variable and added Tested-by. drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..07fabaa5aa2979 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,6 +344,40 @@ 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; @@ -363,6 +398,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; }
On Tue, Nov 30, 2021 at 11:48:25AM +0000, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
v7 :- Added Tested-by. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
I am getting tired of saying this, but PLEASE use scripts/checkpatch.pl before you send out your patches.
If you had done so, you would see the following output in it:
CHECK: Alignment should match open parenthesis #49: FILE: net/bluetooth/hci_core.c:623: + if ((hdev->commands[38] & 0x80) && + !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
Please fix.
On 30-Nov-2021, at 5:33 PM, Greg KH gregkh@linuxfoundation.org wrote:
On Tue, Nov 30, 2021 at 11:48:25AM +0000, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
v7 :- Added Tested-by. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
I am getting tired of saying this, but PLEASE use scripts/checkpatch.pl before you send out your patches.
Sorry for offending you. The thing is that I am inexperienced in the field of submitting patches upstream. v8 shouldn't disappoint you.
If you had done so, you would see the following output in it:
CHECK: Alignment should match open parenthesis #49: FILE: net/bluetooth/hci_core.c:623:
if ((hdev->commands[38] & 0x80) &&
!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
Please fix.
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- v7 :- Added Tested-by. v8 :- Fix checkpatch error. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
From: Aditya Garg gargaditya08@live.com
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 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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") --- v7 :- Removed unused variable and added Tested-by. v8 :- No change. drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..07fabaa5aa2979 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,6 +344,40 @@ 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; @@ -363,6 +398,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; }
Hi Aditya,
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
v7 :- Added Tested-by. v8 :- Fix checkpatch error. include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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);
while patch and indentation look good now, it doesn’t actually apply cleanly against bluetooth-next tree. So you need to re-spin it.
Regards
Marcel
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") Cc: stable@vger.kernel.org --- v7 :- Added Tested-by. v8 :- Fix checkpatch error. v9 :- Remake patch for Bluetooth-next tree and add Cc: stable@vger.kernel.org include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_sync.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 0d2a92168..c4959cf9a 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index ad86caf41..52e6b5dae 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -3283,7 +3283,8 @@ static int hci_le_read_adv_tx_power_sync(struct hci_dev *hdev) /* Read LE Min/Max Tx Power*/ static int hci_le_read_tx_power_sync(struct hci_dev *hdev) { - if (!(hdev->commands[38] & 0x80)) + if (!(hdev->commands[38] & 0x80) || + test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) return 0;
return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
From: Aditya Garg gargaditya08@live.com
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 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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") Cc: stable@vger.kernel.org --- v7 :- Removed unused variable and added Tested-by. v8 :- No change. v9 :- Add Cc: stable@vger.kernel.org drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..07fabaa5aa2979 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,6 +344,40 @@ 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; @@ -363,6 +398,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; }
From: Aditya Garg gargaditya08@live.com
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") Cc: stable@vger.kernel.org --- v7 :- Added Tested-by. v8 :- Fix checkpatch error. v9 :- Remake patch for Bluetooth-next tree and add Cc: stable@vger.kernel.org v10 :- Fix gitlint include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_sync.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 0d2a92168..c4959cf9a 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index ad86caf41..52e6b5dae 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -3283,7 +3283,8 @@ static int hci_le_read_adv_tx_power_sync(struct hci_dev *hdev) /* Read LE Min/Max Tx Power*/ static int hci_le_read_tx_power_sync(struct hci_dev *hdev) { - if (!(hdev->commands[38] & 0x80)) + if (!(hdev->commands[38] & 0x80) || + test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) return 0;
return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
From: Aditya Garg gargaditya08@live.com
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 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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") Cc: stable@vger.kernel.org --- v7 :- Removed unused variable and added Tested-by. v8 :- No change. v9 :- Add Cc: stable@vger.kernel.org v10 :- Fix gitlint drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index e4182acee488c5..07fabaa5aa2979 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,6 +344,40 @@ 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; @@ -363,6 +398,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; }
Hi Aditya,
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 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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") Cc: stable@vger.kernel.org
v7 :- Removed unused variable and added Tested-by. v8 :- No change. v9 :- Add Cc: stable@vger.kernel.org v10 :- Fix gitlint drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Hi, this once again is your Linux kernel regression tracker speaking.
On 03.12.21 22:28, Marcel Holtmann wrote:
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 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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
If anyone wonders: this was for v5.11-rc1.
Cc: stable@vger.kernel.org
v7 :- Removed unused variable and added Tested-by. v8 :- No change. v9 :- Add Cc: stable@vger.kernel.org v10 :- Fix gitlint drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
patch has been applied to bluetooth-next tree.
And there are these two pages now for 19 days. What's the hold-up? Or do you consider the changes to dangerous to merge now?
Sure, it's not a recent regression, so it might not look that urgent. But it OTOH affects everyone that can't go back to v5.10 (the newest Longterm kernel without the regression) -- for example if a user needs a post-v5.10 feature or upgrades to a distro with a newer kernel.
That's why this fix (unless you considerer it to dangerous) IMHO should be merged rather sooner than later and and not wait for the merge window of v5.17. Another aspect against waiting for the next merge window: it contributes to piling up a large number of changes that need to be backported to stable and longterm kernels once v5.17-rc1 is out, resulting in stable and longterm releases with a huge pile of changes: https://lwn.net/Articles/863505/
Ciao, Thorsten
#regzbot poke
Hi Aditya,
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.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") Cc: stable@vger.kernel.org
v7 :- Added Tested-by. v8 :- Fix checkpatch error. v9 :- Remake patch for Bluetooth-next tree and add Cc: stable@vger.kernel.org v10 :- Fix gitlint include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_sync.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Hi! Great to see progress for this regression.
On 29.11.21 09:32, Aditya Garg wrote:
From: Aditya Garg gargaditya08@live.com
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
FWIW: In case you need to send an improved patch, could you please add this after your 'Signed-off-by:' (see at (¹) below for the reasoning):
Reported-by: Orlando Chamberlain redecorating@protonmail.com Link: https://lore.kernel.org/r/4970a940-211b-25d6-edab-21a815313954@protonmail.co... Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
And if the patch is already good to go: could the subsystem maintainer please add it when applying? See (¹) for the reasoning.
Ciao, Thorsten, your Linux kernel regression tracker.
(¹) Long story: The commit message would benefit from a link to the regression report, for reasons explained in Documentation/process/submitting-patches.rst. To quote:
``` If related discussions or any other background information behind the change can be found on the web, add 'Link:' tags pointing to it. In case your patch fixes a bug, for example, add a tag with a URL referencing the report in the mailing list archives or a bug tracker; ```
This concept is old, but the text was reworked recently to make this use case for the Link: tag clearer. For details see: https://git.kernel.org/linus/1f57bd42b77c
Yes, that "Link:" is not really crucial; but it's good to have if someone needs to look into the backstory of this change sometime in the future. But I care for a different reason. I'm tracking this regression (and others) with regzbot, my Linux kernel regression tracking bot. This bot will notice if a patch with a Link: tag to a tracked regression gets posted and record that, which allowed anyone looking into the regression to quickly gasp the current status from regzbot's webui (https://linux-regtracking.leemhuis.info/regzbot ) or its reports. The bot will also notice if a commit with a Link: tag to a regression report is applied by Linus and then automatically mark the regression as resolved then.
IOW: this tag makes my life a regression tracker a lot easier, as I otherwise have to tell regzbot manually when the fix lands. :-/
P.S.: As a Linux kernel regression tracker I'm getting a lot of reports on my table. I can only look briefly into most of them. Unfortunately therefore I sometimes will get things wrong or miss something important. I hope that's not the case here; if you think it is, don't hesitate to tell me about it in a public reply. That's in everyone's interest, as what I wrote above might be misleading to everyone reading this; any suggestion I gave they thus might sent someone reading this down the wrong rabbit hole, which none of us wants.
BTW, I have no personal interest in this issue, which is tracked using regzbot, my Linux kernel regression tracking bot (https://linux-regtracking.leemhuis.info/regzbot/). I'm only posting this mail to get things rolling again and hence don't need to be CC on all further activities wrt to this regression.
Hi Aditya,
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
include/net/bluetooth/hci.h | 9 +++++++++ net/bluetooth/hci_core.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 63065bc01b766c..383342efcdc464 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -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 */ diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8d33aa64846b1c..434c6878fe9640 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -619,7 +619,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)) {
if ((hdev->commands[38] && 0x80) && !test_bit(HCI_QUIRK_.., &hdev->quirks)) {
/* Read LE Min/Max Tx Power*/ hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER, 0, NULL);
Regards
Marcel
linux-stable-mirror@lists.linaro.org