1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00
openmptcprouter/6.12/target/linux/bcm27xx/patches-6.12/950-0323-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch
Ycarus (Yannick Chabanois) bdb9b0046f Add bcm27xx 6.12 test support
2024-12-20 14:17:26 +01:00

40 lines
1.6 KiB
Diff

From 2e81dce58bb7151806bde4f9cabffbd45aa340f8 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 25 Apr 2023 11:49:41 +0100
Subject: [PATCH 323/697] Bluetooth: hci_sync: Add fallback-bd-address prop
The kernel Bluetooth framework understands that devices may not
be programmed with valid Bluetooth addresses. It also has the ability
to override a Bluetooth address with the value of the local-bd-address
DT property, but it ignores the validity of the existing address when
doing so.
Add a new boolean property, fallback-bd-address, which indicates that
the given local-bd-address property should only be used if the device
does not already have a valid BDADDR.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
net/bluetooth/hci_sync.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4861,6 +4861,7 @@ static const struct {
*/
static int hci_dev_setup_sync(struct hci_dev *hdev)
{
+ struct fwnode_handle *fwnode = dev_fwnode(hdev->dev.parent);
int ret = 0;
bool invalid_bdaddr;
size_t i;
@@ -4889,7 +4890,8 @@ static int hci_dev_setup_sync(struct hci
test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
if (!ret) {
if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) &&
- !bacmp(&hdev->public_addr, BDADDR_ANY))
+ !bacmp(&hdev->public_addr, BDADDR_ANY) &&
+ (invalid_bdaddr || !fwnode_property_present(fwnode, "fallback-bd-address")))
hci_dev_get_bd_addr_from_property(hdev);
if (invalid_bdaddr && bacmp(&hdev->public_addr, BDADDR_ANY) &&