Skip to contentSkip to conversation

Broadcom/Apple Bluetooth driver for Apple Silicon

PATCH Superseded Sven Peter 7 participants 18 messages Sep 7, 2022 – Sep 19, 2022

Subsystems (8)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Sven Peter

author
#0 lore raw

v2 cover Broadcom/Apple Bluetooth driver for Apple Silicon

Hi,

v1: https://lore.kernel.org/asahi/[email protected]/

Here's v2 of the Apple/Broadcom Bluetooth series. Most changes from v1 are only related to the device tree bindings. Other than that I fixed a few minor bugs and adjusted some commit messages to make checkpatch happier.

Best,

Sven

Sven Peter (5):
dt-bindings: net: Add generic Bluetooth controller
dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
Bluetooth: hci_event: Add quirk to ignore byte in LE Extended Adv
Report
Bluetooth: Add quirk to disable extended scanning
Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCI boards

 .../bindings/net/bluetooth-controller.yaml    |   30 +
 .../devicetree/bindings/net/bluetooth.txt     |    5 -
 .../bindings/net/brcm,bcm4377-bluetooth.yaml  |   78 +
 .../bindings/net/qualcomm-bluetooth.yaml      |    4 +-
 .../bindings/soc/qcom/qcom,wcnss.yaml         |    8 +-
 MAINTAINERS                                   |    2 +
 drivers/bluetooth/Kconfig                     |   12 +
 drivers/bluetooth/Makefile                    |    1 +
 drivers/bluetooth/hci_bcm4377.c               | 2515 +++++++++++++++++
 include/net/bluetooth/hci.h                   |   21 +
 include/net/bluetooth/hci_core.h              |    4 +-
 net/bluetooth/hci_event.c                     |    4 +
 12 files changed, 2671 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth-controller.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml
 create mode 100644 drivers/bluetooth/hci_bcm4377.c
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/5 dt-bindings: net: Add generic Bluetooth controller

Bluetooth controllers share the common local-bd-address property. Add a generic YAML schema to replace bluetooth.txt for those.

---
changes from v1:
- removed blueetooth.txt instead of just replacing it with a deprecation note
- replaced references to bluetooth.txt

checkpatch complains here because it thinks I do to many things at once, I think it's better to replace bluetooth.txt in single commit though. Let me know if you prefer this to be split into multiple commits instead.

.../bindings/net/bluetooth-controller.yaml | 30 +++++++++++++++++++

 .../devicetree/bindings/net/bluetooth.txt     |  5 ----
 .../bindings/net/qualcomm-bluetooth.yaml      |  4 +--
 .../bindings/soc/qcom/qcom,wcnss.yaml         |  8 ++---
 4 files changed, 35 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth-controller.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
Documentation/devicetree/bindings/net/bluetooth-controller.yaml new file +30 -0
new file mode 100644
index 000000000000..0ea8a20e30f9
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/bluetooth-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bluetooth Controller Generic Binding
+
+maintainers:
+  - Marcel Holtmann <[email protected]>
+  - Johan Hedberg <[email protected]>
+  - Luiz Augusto von Dentz <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "^bluetooth(@.*)?$"
+
+  local-bd-address:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minItems: 6
+    maxItems: 6
+    description:
+      Specifies the BD address that was uniquely assigned to the Bluetooth
+      device. Formatted with least significant byte first (little-endian), e.g.
+      in order to assign the address 00:11:22:33:44:55 this property must have
+      the value [55 44 33 22 11 00].
+
+additionalProperties: true
+
+...
Documentation/devicetree/bindings/net/bluetooth.txt deleted +0 -5
deleted file mode 100644
index 94797df751b8..000000000000
@@ -1,5 +0,0 @@
-The following properties are common to the Bluetooth controllers:
-
-- local-bd-address: array of 6 bytes, specifies the BD address that was
-  uniquely assigned to the Bluetooth device, formatted with least significant
-  byte first (little-endian).
Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml +2 -2
index f93c6e7a1b59..77eefa883d0a 100644
@@ -79,8 +79,7 @@ properties:
   firmware-name:
     description: specify the name of nvm firmware to load
 
-  local-bd-address:
-    description: see Documentation/devicetree/bindings/net/bluetooth.txt
+  local-bd-address: true
 
 
 required:
@@ -89,6 +88,7 @@ required:
 additionalProperties: false
 
 allOf:
+  - $ref: bluetooth-controller.yaml#
   - if:
       properties:
         compatible:
Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.yaml +3 -5
index 5320504bb5e0..a1417cf30a32 100644
@@ -42,15 +42,13 @@ properties:
   bluetooth:
     type: object
     additionalProperties: false
+    allOf:
+      - $ref: /schemas/net/bluetooth-controller.yaml#
     properties:
       compatible:
         const: qcom,wcnss-bt
 
-      local-bd-address:
-        $ref: /schemas/types.yaml#/definitions/uint8-array
-        maxItems: 6
-        description:
-          See Documentation/devicetree/bindings/net/bluetooth.txt
+      local-bd-address: true
 
     required:
       - compatible
Signature · 1 line
2.25.1
#2 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=674956

---Test result---

Test Summary:

CheckPatch                    FAIL      2.08 seconds
GitLint                       FAIL      2.87 seconds
SubjectPrefix                 FAIL      1.69 seconds
BuildKernel                   PASS      34.57 seconds
BuildKernel32                 PASS      30.39 seconds
Incremental Build with patchesPASS      112.15 seconds
TestRunner: Setup             PASS      502.59 seconds
TestRunner: l2cap-tester      PASS      17.04 seconds
TestRunner: iso-tester        PASS      15.74 seconds
TestRunner: bnep-tester       PASS      6.33 seconds
TestRunner: mgmt-tester       PASS      100.03 seconds
TestRunner: rfcomm-tester     PASS      9.84 seconds
TestRunner: sco-tester        PASS      9.41 seconds
TestRunner: smp-tester        PASS      9.38 seconds
TestRunner: userchan-tester   PASS      6.45 seconds

Details
##############################
Test: CheckPatch - FAIL - 2.08 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v2,1/5] dt-bindings: net: Add generic Bluetooth controller\Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #136:
new file mode 100644

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst

total: 0 errors, 3 warnings, 64 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12969309.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: GitLint - FAIL - 2.87 seconds
Run gitlint with rule in .gitlint
[v2,1/5] dt-bindings: net: Add generic Bluetooth controller
23: B1 Line exceeds max length (83>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth-controller.yaml"

[v2,2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
18: B1 Line exceeds max length (85>80): " create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml"

[v2,3/5] Bluetooth: hci_event: Add quirk to ignore byte in LE Extended Adv Report
1: T1 Title exceeds max length (81>80): "[v2,3/5] Bluetooth: hci_event: Add quirk to ignore byte in LE Extended Adv Report"

##############################
Test: SubjectPrefix - FAIL - 1.69 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject

---
Regards,
Linux Bluetooth

#3 lore raw

Re: [PATCH v2 1/5] dt-bindings: net: Add generic Bluetooth controller

In reply to Sven Peter
Quoted 11 lines · Sven Peter

Bluetooth controllers share the common local-bd-address property. Add a generic YAML schema to replace bluetooth.txt for those.

---
changes from v1:
- removed blueetooth.txt instead of just replacing it with a deprecation note
- replaced references to bluetooth.txt

Quoted 6 lines

checkpatch complains here because it thinks I do to many things at once, I think it's better to replace bluetooth.txt in single commit though. Let me know if you prefer this to be split into multiple commits instead.

.../bindings/net/bluetooth-controller.yaml | 30 +++++++++++++++++++

I propose to keep it in net/bluetooth subdirectory. In next patch you can move there other files.

Quoted 23 lines
 .../devicetree/bindings/net/bluetooth.txt     |  5 ----
 .../bindings/net/qualcomm-bluetooth.yaml      |  4 +--
 .../bindings/soc/qcom/qcom,wcnss.yaml         |  8 ++---
 4 files changed, 35 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth-controller.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
Documentation/devicetree/bindings/net/bluetooth-controller.yaml new file +10 -0
new file mode 100644
index 000000000000..0ea8a20e30f9
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/bluetooth-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bluetooth Controller Generic Binding
+
+maintainers:
+  - Marcel Holtmann <[email protected]>

Documentation/devicetree/bindings/net/bluetooth-controller.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/net/bluetooth-controller.yaml new file +10 -0
+  - Johan Hedberg <[email protected]>
+  - Luiz Augusto von Dentz <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "^bluetooth(@.*)?$"
+
+  local-bd-address:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minItems: 6

No need for minitems.

Best regards,
Krzysztof

author
#4 lore raw

Re: [PATCH v2 1/5] dt-bindings: net: Add generic Bluetooth controller

Hi,

Quoted 17 lines · Krzysztof Kozlowski
Quoted 16 lines · Sven Peter

Bluetooth controllers share the common local-bd-address property. Add a generic YAML schema to replace bluetooth.txt for those.

---
changes from v1:
- removed blueetooth.txt instead of just replacing it with a deprecation note
- replaced references to bluetooth.txt

checkpatch complains here because it thinks I do to many things at once, I think it's better to replace bluetooth.txt in single commit though. Let me know if you prefer this to be split into multiple commits instead.

Quoted 4 lines
Quoted 1 line

.../bindings/net/bluetooth-controller.yaml | 30 +++++++++++++++++++

I propose to keep it in net/bluetooth subdirectory. In next patch you can move there other files.

Sure, I can also already move net/qualcomm-bluetooth.yaml to the new subdirectory since I need to touch it in this commit anyway.

Quoted 28 lines
Quoted 28 lines
 .../devicetree/bindings/net/bluetooth.txt     |  5 ----
 .../bindings/net/qualcomm-bluetooth.yaml      |  4 +--
 .../bindings/soc/qcom/qcom,wcnss.yaml         |  8 ++---
 4 files changed, 35 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/bluetooth-controller.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
Documentation/devicetree/bindings/net/bluetooth-controller.yaml new file +14 -0
new file mode 100644
index 000000000000..0ea8a20e30f9
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/bluetooth-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bluetooth Controller Generic Binding
+
+maintainers:
+  - Marcel Holtmann <[email protected]>
+  - Johan Hedberg <[email protected]>
+  - Luiz Augusto von Dentz <[email protected]>
+
+properties:
Quoted 8 lines

Documentation/devicetree/bindings/net/bluetooth-controller.yaml line 20

Quoted 6 lines
Documentation/devicetree/bindings/net/bluetooth-controller.yaml new file +6 -0
+  $nodename:
+    pattern: "^bluetooth(@.*)?$"
+
+  local-bd-address:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minItems: 6

No need for minitems.

Ok, dropped.

Best,

Sven

author
#5 lore raw

PATCH v2 2/5 dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

In reply to Sven Peter

These chips are combined Wi-Fi/Bluetooth radios which expose a PCI subfunction for the Bluetooth part.
They are found in Apple machines such as the x86 models with the T2 chip or the arm64 models with the M1 or M2 chips.

---
changes from v1:
- added apple,* pattern to brcm,board-type
- s/PCI/PCIe/
- fixed 1st reg cell inside the example to not contain the bus number

.../bindings/net/brcm,bcm4377-bluetooth.yaml | 78 +++++++++++++++++++

 MAINTAINERS                                   |  1 +
 2 files changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +78 -0
new file mode 100644
index 000000000000..fb851f8e6bcb
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,bcm4377-bluetooth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM4377 family PCIe Bluetooth Chips
+
+allOf:
+  - $ref: bluetooth-controller.yaml#
+
+maintainers:
+  - Sven Peter <[email protected]>
+
+description:
+  This binding describes Broadcom BCM4377 family PCIe-attached bluetooth chips
+  usually found in Apple machines. The Wi-Fi part of the chip is described in
+  bindings/net/wireless/brcm,bcm4329-fmac.yaml.
+
+properties:
+  compatible:
+    enum:
+      - pci14e4,5fa0 # BCM4377
+      - pci14e4,5f69 # BCM4378
+      - pci14e4,5f71 # BCM4387
+
+  reg:
+    description: PCI device identifier.
+
+  brcm,board-type:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Board type of the Bluetooth chip. This is used to decouple
+      the overall system board from the Bluetooth module and used to construct
+      firmware and calibration data filenames.
+      On Apple platforms, this should be the Apple module-instance codename
+      prefixed by "apple,", e.g. "apple,atlantisb".
+    pattern: '^apple,.*'
+
+  brcm,taurus-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module does not
+      support beamforming.
+
+  brcm,taurus-bf-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module supports
+      beamforming.
+
+  local-bd-address: true
+
+required:
+  - compatible
+  - reg
+  - local-bd-address
+  - brcm,board-type
+
+additionalProperties: false
+
+examples:
+  - |
+    pcie {
+      #address-cells = <3>;
+      #size-cells = <2>;
+
+      bluetooth@0,1 {
+        compatible = "pci14e4,5f69";
+        reg = <0x100 0x0 0x0 0x0 0x0>;
+        brcm,board-type = "apple,honshu";
+        /* To be filled by the bootloader */
+        local-bd-address = [00 00 00 00 00 00];
+      };
+    };
MAINTAINERS +1 -0
index 8a5012ba6ff9..5cc9c2da1140 100644
@@ -1875,6 +1875,7 @@ F:	Documentation/devicetree/bindings/interrupt-controller/apple,*
 F:	Documentation/devicetree/bindings/iommu/apple,dart.yaml
 F:	Documentation/devicetree/bindings/iommu/apple,sart.yaml
 F:	Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
+F:	Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml
 F:	Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml
 F:	Documentation/devicetree/bindings/nvmem/apple,efuses.yaml
 F:	Documentation/devicetree/bindings/pci/apple,pcie.yaml
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

Quoted 23 lines · Sven Peter

These chips are combined Wi-Fi/Bluetooth radios which expose a PCI subfunction for the Bluetooth part.
They are found in Apple machines such as the x86 models with the T2 chip or the arm64 models with the M1 or M2 chips.

---
changes from v1:
- added apple,* pattern to brcm,board-type
- s/PCI/PCIe/
- fixed 1st reg cell inside the example to not contain the bus number

.../bindings/net/brcm,bcm4377-bluetooth.yaml | 78 +++++++++++++++++++

 MAINTAINERS                                   |  1 +
 2 files changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +0 -0
new file mode 100644
index 000000000000..fb851f8e6bcb

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 10

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,bcm4377-bluetooth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM4377 family PCIe Bluetooth Chips
+
+allOf:
+  - $ref: bluetooth-controller.yaml#

Put it before properties (so after description).

Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +8 -0
+
+maintainers:
+  - Sven Peter <[email protected]>
+
+description:
+  This binding describes Broadcom BCM4377 family PCIe-attached bluetooth chips
+  usually found in Apple machines. The Wi-Fi part of the chip is described in
+  bindings/net/wireless/brcm,bcm4329-fmac.yaml.

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
+
+properties:
+  compatible:
+    enum:
+      - pci14e4,5fa0 # BCM4377
+      - pci14e4,5f69 # BCM4378
+      - pci14e4,5f71 # BCM4387
+
+  reg:
+    description: PCI device identifier.

maxItems: X

Quoted 7 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +7 -0
+
+  brcm,board-type:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Board type of the Bluetooth chip. This is used to decouple
+      the overall system board from the Bluetooth module and used to construct
+      firmware and calibration data filenames.
+      On Apple platforms, this should be the Apple module-instance codename

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 45

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
+      prefixed by "apple,", e.g. "apple,atlantisb".
+    pattern: '^apple,.*'
+
+  brcm,taurus-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module does not
+      support beamforming.

Isn't it:
s/beamforming/beam forming/
?

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 53

Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +8 -0
+
+  brcm,taurus-bf-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module supports
+      beamforming.

Same here.

Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +8 -0
+
+  local-bd-address: true
+
+required:
+  - compatible
+  - reg
+  - local-bd-address
+  - brcm,board-type

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 71

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    pcie {
+      #address-cells = <3>;
+      #size-cells = <2>;
+
+      bluetooth@0,1 {

The unit address seems to be different than reg.

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 78

Quoted 7 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +7 -0
+        compatible = "pci14e4,5f69";
+        reg = <0x100 0x0 0x0 0x0 0x0>;
+        brcm,board-type = "apple,honshu";
+        /* To be filled by the bootloader */
+        local-bd-address = [00 00 00 00 00 00];
+      };
+    };

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

Quoted 75 lines · Krzysztof Kozlowski
Quoted 23 lines · Sven Peter

These chips are combined Wi-Fi/Bluetooth radios which expose a PCI subfunction for the Bluetooth part.
They are found in Apple machines such as the x86 models with the T2 chip or the arm64 models with the M1 or M2 chips.

---
changes from v1:
- added apple,* pattern to brcm,board-type
- s/PCI/PCIe/
- fixed 1st reg cell inside the example to not contain the bus number

.../bindings/net/brcm,bcm4377-bluetooth.yaml | 78 +++++++++++++++++++ MAINTAINERS | 1 +

2 files changed, 79 insertions(+)

create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +0 -0
new file mode 100644
index 000000000000..fb851f8e6bcb

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 10

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,bcm4377-bluetooth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM4377 family PCIe Bluetooth Chips
+
+allOf:
+ - $ref: bluetooth-controller.yaml#

Put it before properties (so after description).

Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +8 -0
+
+maintainers:
+ - Sven Peter <[email protected]>
+
+description:
+ This binding describes Broadcom BCM4377 family PCIe-attached bluetooth chips
+ usually found in Apple machines. The Wi-Fi part of the chip is described in
+ bindings/net/wireless/brcm,bcm4329-fmac.yaml.

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
+
+properties:
+ compatible:
+ enum:
+ - pci14e4,5fa0 # BCM4377
+ - pci14e4,5f69 # BCM4378
+ - pci14e4,5f71 # BCM4387
+
+ reg:
+ description: PCI device identifier.

maxItems: X

Quoted 13 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +13 -0
+
+ brcm,board-type:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: Board type of the Bluetooth chip. This is used to decouple
+ the overall system board from the Bluetooth module and used to construct
+ firmware and calibration data filenames.
+ On Apple platforms, this should be the Apple module-instance codename
+ prefixed by "apple,", e.g. "apple,atlantisb".
+ pattern: '^apple,.*'
+
+ brcm,taurus-cal-blob:
+ $ref: /schemas/types.yaml#/definitions/uint8-array
+ description: A per-device calibration blob for the Bluetooth radio. This
Quoted 8 lines

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 45

Quoted 4 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +4 -0
+ should be filled in by the bootloader from platform configuration
+ data, if necessary, and will be uploaded to the device.
+ This blob is used if the chip stepping of the Bluetooth module does not
+ support beamforming.

Isn't it:
s/beamforming/beam forming/
?

Doesn’t seem like it:
https://www.google.com/search?hl=en&q=beam%20forming

Best,
Martin

Quoted 14 lines

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 53

Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +8 -0
+
+ brcm,taurus-bf-cal-blob:
+ $ref: /schemas/types.yaml#/definitions/uint8-array
+ description: A per-device calibration blob for the Bluetooth radio. This
+ should be filled in by the bootloader from platform configuration
+ data, if necessary, and will be uploaded to the device.
+ This blob is used if the chip stepping of the Bluetooth module supports
+ beamforming.

Same here.

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

Quoted 8 lines · Martin Povišer
Quoted 8 lines
Quoted 7 lines

+ brcm,taurus-cal-blob:
+ $ref: /schemas/types.yaml#/definitions/uint8-array
+ description: A per-device calibration blob for the Bluetooth radio. This
+ should be filled in by the bootloader from platform configuration
+ data, if necessary, and will be uploaded to the device.
+ This blob is used if the chip stepping of the Bluetooth module does not
+ support beamforming.

Quoted 6 lines
Quoted 3 lines

Isn't it:
s/beamforming/beam forming/
?

Doesn’t seem like it:
https://www.google.com/search?hl=en&q=beam%20forming

OK, thanks :)

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

In reply to Krzysztof Kozlowski
Quoted 14 lines · Krzysztof Kozlowski
Quoted 13 lines · Sven Peter
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +13 -0
+
+  brcm,board-type:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Board type of the Bluetooth chip. This is used to decouple
+      the overall system board from the Bluetooth module and used to construct
+      firmware and calibration data filenames.
+      On Apple platforms, this should be the Apple module-instance codename
+      prefixed by "apple,", e.g. "apple,atlantisb".
+    pattern: '^apple,.*'
+
+  brcm,taurus-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
Quoted 8 lines

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 45

Quoted 4 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +4 -0
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module does not
+      support beamforming.

Isn't it:
s/beamforming/beam forming/
?

Nope, it's one word: https://en.wikipedia.org/wiki/Beamforming

- Hector

maintainer
#10 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

In reply to Krzysztof Kozlowski
Quoted 49 lines · Krzysztof Kozlowski
Quoted 23 lines · Sven Peter

These chips are combined Wi-Fi/Bluetooth radios which expose a PCI subfunction for the Bluetooth part.
They are found in Apple machines such as the x86 models with the T2 chip or the arm64 models with the M1 or M2 chips.

---
changes from v1:
- added apple,* pattern to brcm,board-type
- s/PCI/PCIe/
- fixed 1st reg cell inside the example to not contain the bus number

.../bindings/net/brcm,bcm4377-bluetooth.yaml | 78 +++++++++++++++++++

 MAINTAINERS                                   |  1 +
 2 files changed, 79 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +0 -0
new file mode 100644
index 000000000000..fb851f8e6bcb

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 10

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,bcm4377-bluetooth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM4377 family PCIe Bluetooth Chips
+
+allOf:
+  - $ref: bluetooth-controller.yaml#

Put it before properties (so after description).

Quoted 12 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +12 -0
+
+maintainers:
+  - Sven Peter <[email protected]>
+
+description:
+  This binding describes Broadcom BCM4377 family PCIe-attached bluetooth chips
+  usually found in Apple machines. The Wi-Fi part of the chip is described in
+  bindings/net/wireless/brcm,bcm4329-fmac.yaml.
+
+properties:
+  compatible:
+    enum:
Quoted 8 lines

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 28

Quoted 6 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +6 -0
+      - pci14e4,5fa0 # BCM4377
+      - pci14e4,5f69 # BCM4378
+      - pci14e4,5f71 # BCM4387
+
+  reg:
+    description: PCI device identifier.

maxItems: X

And drop the description.

Quoted 46 lines
Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +7 -0
+
+  brcm,board-type:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: Board type of the Bluetooth chip. This is used to decouple
+      the overall system board from the Bluetooth module and used to construct
+      firmware and calibration data filenames.
+      On Apple platforms, this should be the Apple module-instance codename

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 45

Quoted 10 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +10 -0
+      prefixed by "apple,", e.g. "apple,atlantisb".
+    pattern: '^apple,.*'
+
+  brcm,taurus-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module does not
+      support beamforming.

Isn't it:
s/beamforming/beam forming/
?

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 53

Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +8 -0
+
+  brcm,taurus-bf-cal-blob:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    description: A per-device calibration blob for the Bluetooth radio. This
+      should be filled in by the bootloader from platform configuration
+      data, if necessary, and will be uploaded to the device.
+      This blob is used if the chip stepping of the Bluetooth module supports
+      beamforming.

Same here.

Quoted 12 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +12 -0
+
+  local-bd-address: true
+
+required:
+  - compatible
+  - reg
+  - local-bd-address
+  - brcm,board-type
+
+additionalProperties: false
+
+examples:
Quoted 8 lines

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 71

Quoted 6 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +6 -0
+  - |
+    pcie {
+      #address-cells = <3>;
+      #size-cells = <2>;
+
+      bluetooth@0,1 {

The unit address seems to be different than reg.

Right, this says dev 0, func 1.

dtc can check this, but IIRC it would need 'device_type = "pci";' in the parent. So please add that, and verify you get a warning.

Rob

maintainer
#11 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

Quoted 21 lines · Rob Herring
Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Sven Peter

These chips are combined Wi-Fi/Bluetooth radios which expose a PCI subfunction for the Bluetooth part.
They are found in Apple machines such as the x86 models with the T2 chip or the arm64 models with the M1 or M2 chips.

---

Quoted 9 lines

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 71

Quoted 7 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +7 -0
+examples:
+  - |
+    pcie {
+      #address-cells = <3>;
+      #size-cells = <2>;
+
+      bluetooth@0,1 {

The unit address seems to be different than reg.

Quoted 1 line

Right, this says dev 0, func 1.

Actually, the reg value of 0x100 is correct. func is bits 8-10. dev starts in bit 11.

Rob

author
#12 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth

Quoted 22 lines · Rob Herring
Quoted 21 lines · Rob Herring
Quoted 18 lines · Krzysztof Kozlowski
Quoted 8 lines · Sven Peter

These chips are combined Wi-Fi/Bluetooth radios which expose a PCI subfunction for the Bluetooth part.
They are found in Apple machines such as the x86 models with the T2 chip or the arm64 models with the M1 or M2 chips.

---

Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml line 71

Quoted 7 lines
Documentation/devicetree/bindings/net/brcm,bcm4377-bluetooth.yaml new file +7 -0
+examples:
+  - |
+    pcie {
+      #address-cells = <3>;
+      #size-cells = <2>;
+
+      bluetooth@0,1 {

The unit address seems to be different than reg.

Quoted 4 lines
Quoted 1 line

Right, this says dev 0, func 1.

Actually, the reg value of 0x100 is correct. func is bits 8-10. dev starts in bit 11.

Yup, if I write the example as

  - |
    pcie@a0000000 {
      #address-cells = <3>;
      #size-cells = <2>;
      reg = <0xa0000000 0x1000000>;
      device_type = "pci";
      ranges = <0x43000000 0x6 0xa0000000 0xa0000000 0x0 0x20000000>;
      bluetooth@0,1 {
        compatible = "pci14e4,5f69";
        reg = <0x100 0x0 0x0 0x0 0x0>;
        brcm,board-type = "apple,honshu";
        /* To be filled by the bootloader */
        local-bd-address = [00 00 00 00 00 00];
      };
    };

then no warnings appear. If I instead use "bluetooth@0,2" I get the following warning:

Warning (pci_device_reg): /example-0/pcie@a0000000/bluetooth@0,2: PCI unit address format error, expected "0,1"

Sven

author
#13 lore raw

PATCH v2 3/5 Bluetooth: hci_event: Add quirk to ignore byte in LE Extended Adv Report

In reply to Sven Peter

Broadcom controllers present on Apple Silicon devices use the upper 8 bits of the event type in the LE Extended Advertising Report for the channel on which the frame has been received.
Add a quirk to drop the upper byte to ensure that the advertising results are parsed correctly.

The following excerpt from a btmon trace shows a report received on channel 37 by these controllers:

Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 55

      LE Extended Advertising Report (0x0d)
        Num reports: 1
        Entry 0
          Event type: 0x2513
            Props: 0x0013
              Connectable
              Scannable
              Use legacy advertising PDUs
            Data status: Complete
            Reserved (0x2500)
          Legacy PDU Type: Reserved (0x2513)
          Address type: Public (0x00)
          Address: XX:XX:XX:XX:XX:XX (Shenzhen Jingxun Software [...])
          Primary PHY: LE 1M
          Secondary PHY: No packets
          SID: no ADI field (0xff)
          TX power: 127 dBm
          RSSI: -76 dBm (0xb4)
          Periodic advertising interval: 0.00 msec (0x0000)
          Direct address type: Public (0x00)
          Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
          Data length: 0x1d
          [...]
        Flags: 0x18
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Harman International Industries, Inc. (87)
          Data: [...]
        Service Data (UUID 0xfddf):
        Name (complete): JBL Flip 5

---
changes from v1:
- adjusted the commit message a bit to make checkpatch happy

 include/net/bluetooth/hci.h | 11 +++++++++++
 net/bluetooth/hci_event.c   |  4 ++++
 2 files changed, 15 insertions(+)
include/net/bluetooth/hci.h +11 -0
index cf29511b25a8..62539c1a6bf2 100644
@@ -263,6 +263,17 @@ enum {
 	 * during the hdev->setup vendor callback.
 	 */
 	HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN,
+
+	/*
+	 * When this quirk is set, the upper 8 bits of the evt_type field of
+	 * the LE Extended Advertising Report events are discarded.
+	 * Some Broadcom controllers found in Apple machines put the channel
+	 * the report was received on into these reserved bits.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE,
 };
 
 /* HCI device flags */
net/bluetooth/hci_event.c +4 -0
index 485c814cf44a..b50d05211f0d 100644
@@ -6471,6 +6471,10 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data,
 			break;
 
 		evt_type = __le16_to_cpu(info->type);
+		if (test_bit(HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE,
+			     &hdev->quirks))
+			evt_type &= 0xff;
+
 		legacy_evt_type = ext_evt_type_to_legacy(hdev, evt_type);
 		if (legacy_evt_type != LE_ADV_INVALID) {
 			process_adv_report(hdev, legacy_evt_type, &info->bdaddr,
Signature · 1 line
2.25.1
#14 lore raw

Re: [PATCH v2 3/5] Bluetooth: hci_event: Add quirk to ignore byte in LE Extended Adv Report

Hi Sven,

Quoted 78 lines · Sven Peter

Broadcom controllers present on Apple Silicon devices use the upper 8 bits of the event type in the LE Extended Advertising Report for the channel on which the frame has been received.
Add a quirk to drop the upper byte to ensure that the advertising results are parsed correctly.

The following excerpt from a btmon trace shows a report received on channel 37 by these controllers:

Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 55

      LE Extended Advertising Report (0x0d)
        Num reports: 1
        Entry 0
          Event type: 0x2513
            Props: 0x0013
              Connectable
              Scannable
              Use legacy advertising PDUs
            Data status: Complete
            Reserved (0x2500)
          Legacy PDU Type: Reserved (0x2513)
          Address type: Public (0x00)
          Address: XX:XX:XX:XX:XX:XX (Shenzhen Jingxun Software [...])
          Primary PHY: LE 1M
          Secondary PHY: No packets
          SID: no ADI field (0xff)
          TX power: 127 dBm
          RSSI: -76 dBm (0xb4)
          Periodic advertising interval: 0.00 msec (0x0000)
          Direct address type: Public (0x00)
          Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
          Data length: 0x1d
          [...]
        Flags: 0x18
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Harman International Industries, Inc. (87)
          Data: [...]
        Service Data (UUID 0xfddf):
        Name (complete): JBL Flip 5

---
changes from v1:
- adjusted the commit message a bit to make checkpatch happy

 include/net/bluetooth/hci.h | 11 +++++++++++
 net/bluetooth/hci_event.c   |  4 ++++
 2 files changed, 15 insertions(+)
include/net/bluetooth/hci.h +11 -0
index cf29511b25a8..62539c1a6bf2 100644
@@ -263,6 +263,17 @@ enum {
         * during the hdev->setup vendor callback.
         */
        HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN,
+
+       /*
+        * When this quirk is set, the upper 8 bits of the evt_type field of
+        * the LE Extended Advertising Report events are discarded.
+        * Some Broadcom controllers found in Apple machines put the channel
+        * the report was received on into these reserved bits.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE,
 };
 
 /* HCI device flags */
net/bluetooth/hci_event.c +0 -0
index 485c814cf44a..b50d05211f0d 100644

net/bluetooth/hci_event.c static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data, · line 6477

Quoted 7 lines
net/bluetooth/hci_event.c +4 -0
@@ -6471,6 +6471,10 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data,
                        break;
 
                evt_type = __le16_to_cpu(info->type);
+               if (test_bit(HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE,
+                            &hdev->quirks))
+                       evt_type &= 0xff;
+

Don't think we really need to quirk in order to mask the reserved bits, according to the 5.3 spec only bits 0-6 are actually valid, that said the usage of the upper byte is sort of non-standard so I don't know what is broadcom/apple thinking that they could use like this, instead this should probably be placed in a vendor command or even add as part of the data itself with a vendor type.

Quoted 6 lines
net/bluetooth/hci_event.c +0 -1
                legacy_evt_type = ext_evt_type_to_legacy(hdev, evt_type);
                if (legacy_evt_type != LE_ADV_INVALID) {
                        process_adv_report(hdev, legacy_evt_type, &info->bdaddr,
--

2.25.1

Signature · 1 line
Luiz Augusto von Dentz
author
#15 lore raw

Re: [PATCH v2 3/5] Bluetooth: hci_event: Add quirk to ignore byte in LE Extended Adv Report

Hi Luiz,

Quoted 83 lines · Luiz Augusto von Dentz

Hi Sven,

Quoted 80 lines · Sven Peter

Broadcom controllers present on Apple Silicon devices use the upper 8 bits of the event type in the LE Extended Advertising Report for the channel on which the frame has been received.
Add a quirk to drop the upper byte to ensure that the advertising results are parsed correctly.

The following excerpt from a btmon trace shows a report received on channel 37 by these controllers:

Quoted 1 line

HCI Event: LE Meta Event (0x3e) plen 55

      LE Extended Advertising Report (0x0d)
        Num reports: 1
        Entry 0
          Event type: 0x2513
            Props: 0x0013
              Connectable
              Scannable
              Use legacy advertising PDUs
            Data status: Complete
            Reserved (0x2500)
          Legacy PDU Type: Reserved (0x2513)
          Address type: Public (0x00)
          Address: XX:XX:XX:XX:XX:XX (Shenzhen Jingxun Software [...])
          Primary PHY: LE 1M
          Secondary PHY: No packets
          SID: no ADI field (0xff)
          TX power: 127 dBm
          RSSI: -76 dBm (0xb4)
          Periodic advertising interval: 0.00 msec (0x0000)
          Direct address type: Public (0x00)
          Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
          Data length: 0x1d
          [...]
        Flags: 0x18
          Simultaneous LE and BR/EDR (Controller)
          Simultaneous LE and BR/EDR (Host)
        Company: Harman International Industries, Inc. (87)
          Data: [...]
        Service Data (UUID 0xfddf):
        Name (complete): JBL Flip 5

---
changes from v1:
- adjusted the commit message a bit to make checkpatch happy

 include/net/bluetooth/hci.h | 11 +++++++++++
 net/bluetooth/hci_event.c   |  4 ++++
 2 files changed, 15 insertions(+)
include/net/bluetooth/hci.h +11 -0
index cf29511b25a8..62539c1a6bf2 100644
@@ -263,6 +263,17 @@ enum {
         * during the hdev->setup vendor callback.
         */
        HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN,
+
+       /*
+        * When this quirk is set, the upper 8 bits of the evt_type field of
+        * the LE Extended Advertising Report events are discarded.
+        * Some Broadcom controllers found in Apple machines put the channel
+        * the report was received on into these reserved bits.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE,
 };
 
 /* HCI device flags */
net/bluetooth/hci_event.c +0 -0
index 485c814cf44a..b50d05211f0d 100644
@@ -6471,6 +6471,10 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data,
                        break;
 
Quoted 12 lines

net/bluetooth/hci_event.c static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data, · line 6477

Quoted 5 lines
net/bluetooth/hci_event.c +4 -0
                evt_type = __le16_to_cpu(info->type);
+               if (test_bit(HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE,
+                            &hdev->quirks))
+                       evt_type &= 0xff;
+

Don't think we really need to quirk in order to mask the reserved bits, according to the 5.3 spec only bits 0-6 are actually valid, that said the usage of the upper byte is sort of non-standard so I don't know what is broadcom/apple thinking that they could use like this, instead this should probably be placed in a vendor command or even add as part of the data itself with a vendor type.

Sure, I'll just mask them unconditionally then for v3.

I originally thought it was a strange bug in their firmware but then I found their btmon-like tool called "PacketLogger" which actually decodes that byte and shows it in the UI as "Channel". It seems to be intentional :/

Best,

Sven

author
#16 lore raw

PATCH v2 4/5 Bluetooth: Add quirk to disable extended scanning

In reply to Sven Peter

Broadcom 4377 controllers found in Apple x86 Macs with the T2 chip claim to support extended scanning when querying supported states,

< HCI Command: LE Read Supported St.. (0x08|0x001c) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 12

      LE Read Supported States (0x08|0x001c) ncmd 1
        Status: Success (0x00)
        States: 0x000003ffffffffff

[...]
LE Set Extended Scan Parameters (Octet 37 - Bit 5) LE Set Extended Scan Enable (Octet 37 - Bit 6)
[...]

, but then fail to actually implement the extended scanning:

< HCI Command: LE Set Extended Sca.. (0x08|0x0041) plen 8

        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
        PHYs: 0x01
        Entry 0: LE 1M
          Type: Active (0x01)
          Interval: 11.250 msec (0x0012)
          Window: 11.250 msec (0x0012)
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
        Status: Unknown HCI Command (0x01)

---
changes from v1:
- adjusted the commit message a bit to make checkpatch happy

 include/net/bluetooth/hci.h      | 10 ++++++++++
 include/net/bluetooth/hci_core.h |  4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +10 -0
index 62539c1a6bf2..05a13b0c5ff1 100644
@@ -274,6 +274,16 @@ enum {
 	 * during the hdev->setup vendor callback.
 	 */
 	HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_EVT_TYPE,
+
+	/*
+	 * When this quirk is set, the HCI_OP_LE_SET_EXT_SCAN_ENABLE command is
+	 * disabled. This is required for some Broadcom controllers which
+	 * erroneously claim to support extended scanning.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_EXT_SCAN,
 };
 
 /* HCI device flags */
include/net/bluetooth/hci_core.h +3 -1
index e7862903187d..29d1254f9856 100644
@@ -1681,7 +1681,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 
 /* Use ext scanning if set ext scan param and ext scan enable is supported */
 #define use_ext_scan(dev) (((dev)->commands[37] & 0x20) && \
-			   ((dev)->commands[37] & 0x40))
+			   ((dev)->commands[37] & 0x40) && \
+			   !test_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &(dev)->quirks))
+
 /* Use ext create connection if command is supported */
 #define use_ext_conn(dev) ((dev)->commands[37] & 0x80)
 
Signature · 1 line
2.25.1
author
#17 lore raw

PATCH v2 5/5 Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCI boards

In reply to Sven Peter

Broadcom BCM4377/4378/4387 are dual WiFi/Bluetooth boards found in Apple machines. This driver adds support for the Bluetooth function which exposes a shared memory IPC protocol over PCIe to tunnel HCI traffic.

---
changes from v1:
- fixed suspend/resume on some of these chips
- use DMI matching for the 4377 Apple machines instead of just hardcoding apple,formosa in case we ever see more variants of this chip.

 MAINTAINERS                     |    1 +
 drivers/bluetooth/Kconfig       |   12 +
 drivers/bluetooth/Makefile      |    1 +
 drivers/bluetooth/hci_bcm4377.c | 2515 +++++++++++++++++++++++++++++++
 4 files changed, 2529 insertions(+)
 create mode 100644 drivers/bluetooth/hci_bcm4377.c
MAINTAINERS +1 -0
index 5cc9c2da1140..f7977fc3f82b 100644
@@ -1883,6 +1883,7 @@ F:	Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
 F:	Documentation/devicetree/bindings/power/apple*
 F:	Documentation/devicetree/bindings/watchdog/apple,wdt.yaml
 F:	arch/arm64/boot/dts/apple/
+F:	drivers/bluetooth/hci_bcm4377.c
 F:	drivers/clk/clk-apple-nco.c
 F:	drivers/dma/apple-admac.c
 F:	drivers/i2c/busses/i2c-pasemi-core.c
drivers/bluetooth/Kconfig +12 -0
index e30707405455..71732e51516f 100644
@@ -274,6 +274,18 @@ config BT_HCIBCM203X
 	  Say Y here to compile support for HCI BCM203x devices into the
 	  kernel or say M to compile it as module (bcm203x).
 
+
+config BT_HCIBCM4377
+	tristate "HCI BCM4377/4378/4387 PCIe driver"
+	depends on PCI
+	select FW_LOADER
+	help
+	  Support for Broadcom BCM4377/4378/4387 Bluetooth chipsets attached via
+	  PCIe. These are usually found in Apple machines.
+
+	  Say Y here to compile support for HCI BCM4377 family devices into the
+	  kernel or say M to compile it as module (hci_bcm4377).
+
 config BT_HCIBPA10X
 	tristate "HCI BPA10x USB driver"
 	depends on USB
drivers/bluetooth/Makefile +1 -0
index 3321a8aea4a0..e0b261f24fc9 100644
@@ -6,6 +6,7 @@
 obj-$(CONFIG_BT_HCIVHCI)	+= hci_vhci.o
 obj-$(CONFIG_BT_HCIUART)	+= hci_uart.o
 obj-$(CONFIG_BT_HCIBCM203X)	+= bcm203x.o
+obj-$(CONFIG_BT_HCIBCM4377)	+= hci_bcm4377.o
 obj-$(CONFIG_BT_HCIBPA10X)	+= bpa10x.o
 obj-$(CONFIG_BT_HCIBFUSB)	+= bfusb.o
 obj-$(CONFIG_BT_HCIDTL1)	+= dtl1_cs.o
drivers/bluetooth/hci_bcm4377.c new file +2515 -0

2,515 lines not on this page · raw message

Signature · 1 line
2.25.1