Skip to contentSkip to conversation

bluetooth: bcm: Set HCI_QUIRK_USE_BDADDR_PROPERTY for default addresses

PATCH In review Andre Heider 2 participants 3 messages Nov 18, 2019 – Nov 19, 2019 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bluetooth: bcm: Set HCI_QUIRK_USE_BDADDR_PROPERTY for default addresses

Some devices ship with the controller default address, like the Orange Pi 3 (BCM4345C5).

Allow the bootloader to set a valid address through the device tree.

---
 drivers/bluetooth/btbcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +1 -1
index 2d2e6d862068..e1471777486e 100644
@@ -79,7 +79,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
 	    !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
 		bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
 			    &bda->bdaddr);
-		set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
+		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
 	}
 
 	kfree_skb(skb);
Signature · 1 line
2.24.0
maintainer
#1 lore raw

Hi Andre,

Quoted 15 lines

Some devices ship with the controller default address, like the Orange Pi 3 (BCM4345C5).

Allow the bootloader to set a valid address through the device tree.

---
drivers/bluetooth/btbcm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +0 -0
index 2d2e6d862068..e1471777486e 100644

drivers/bluetooth/btbcm.c int btbcm_check_bdaddr(struct hci_dev *hdev) · line 83

Quoted 6 lines
drivers/bluetooth/btbcm.c +1 -1
@@ -79,7 +79,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
 	    !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
 		bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
 			    &bda->bdaddr);
-		set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
+		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
 	}

I am not sure the change is this simple. What happens if you run on a boot-loader that doesn’t provide the address and has an invalid address.

When I allowed HCI_QUIRK_USE_BDADDR_PROPERTY to be added, I stated clearly that the intent was that userspace can handle the address setup and this was pretty much just for the existing hardware where we have some magic boot-loader to do this.

Anyhow, I am fine allowing this here as well. However the HCI_QUIRK_USE_BDADDR_PROPERTY needs to be set unconditionally in the hdev->setup routine. And in case there still is an invalid address we need to stick with invalid address. Right now the code in hci_dev_do_open() operates differently.

Regards

Marcel

#2 lore raw

Hi Marcel,

Quoted 26 lines · Marcel Holtmann

Hi Andre,

Quoted 15 lines

Some devices ship with the controller default address, like the Orange Pi 3 (BCM4345C5).

Allow the bootloader to set a valid address through the device tree.

---
drivers/bluetooth/btbcm.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +0 -0
index 2d2e6d862068..e1471777486e 100644

drivers/bluetooth/btbcm.c int btbcm_check_bdaddr(struct hci_dev *hdev) · line 83

Quoted 6 lines
drivers/bluetooth/btbcm.c +1 -1
@@ -79,7 +79,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
 	    !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
 		bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
 			    &bda->bdaddr);
-		set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
+		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
 	}

I am not sure the change is this simple. What happens if you run on a boot-loader that doesn’t provide the address and has an invalid address.

Quoted 3 lines

When I allowed HCI_QUIRK_USE_BDADDR_PROPERTY to be added, I stated clearly that the intent was that userspace can handle the address setup and this was pretty much just for the existing hardware where we have some magic boot-loader to do this.

Anyhow, I am fine allowing this here as well. However the HCI_QUIRK_USE_BDADDR_PROPERTY needs to be set unconditionally in the hdev->setup routine. And in case there still is an invalid address we need to stick with invalid address. Right now the code in hci_dev_do_open() operates differently.

Okay, will send a v2 with the quirk set in btbcm_finalize() (like HCI_QUIRK_STRICT_DUPLICATE_FILTER).

Thanks!
Andre