Broadcom/Apple Bluetooth driver for Apple Silicon
Subsystems (8)
v4 cover Broadcom/Apple Bluetooth driver for Apple Silicon
Hi,
v1: https://lore.kernel.org/asahi/[email protected]/
v2: https://lore.kernel.org/asahi/[email protected]/
v3: https://lore.kernel.org/asahi/[email protected]/
Here's v4 of the Apple/Broadcom Bluetooth series. Not many changes this
time: I rebased on 6.1, added Rob's r-b tags and fixed bcm4377_send_ptb for newer firmware versions where that command claims to fail but is still sent by macOS.
Best,
Sven
Sven Peter (7):
dt-bindings: net: Add generic Bluetooth controller
dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
arm64: dts: apple: t8103: Add Bluetooth controller
Bluetooth: hci_event: Ignore reserved bits in LE Extended Adv Report
Bluetooth: Add quirk to disable extended scanning
Bluetooth: Add quirk to disable MWS Transport Configuration
Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCIe boards
.../devicetree/bindings/net/bluetooth.txt | 5 -
.../net/bluetooth/bluetooth-controller.yaml | 29 +
.../net/bluetooth/brcm,bcm4377-bluetooth.yaml | 81 +
.../{ => bluetooth}/qualcomm-bluetooth.yaml | 6 +-
.../bindings/soc/qcom/qcom,wcnss.yaml | 8 +-
MAINTAINERS | 2 +
arch/arm64/boot/dts/apple/t8103-j274.dts | 4 +
arch/arm64/boot/dts/apple/t8103-j293.dts | 4 +
arch/arm64/boot/dts/apple/t8103-j313.dts | 4 +
arch/arm64/boot/dts/apple/t8103-j456.dts | 4 +
arch/arm64/boot/dts/apple/t8103-j457.dts | 4 +
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi | 8 +
drivers/bluetooth/Kconfig | 12 +
drivers/bluetooth/Makefile | 1 +
drivers/bluetooth/hci_bcm4377.c | 2514 +++++++++++++++++
include/net/bluetooth/hci.h | 21 +
include/net/bluetooth/hci_core.h | 4 +-
net/bluetooth/hci_event.c | 2 +-
net/bluetooth/hci_sync.c | 2 +
19 files changed, 2700 insertions(+), 15 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml
create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml
rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)
create mode 100644 drivers/bluetooth/hci_bcm4377.cSignature · 1 line
2.25.1
PATCH v4 1/7 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.
---
.../devicetree/bindings/net/bluetooth.txt | 5 ----
.../net/bluetooth/bluetooth-controller.yaml | 29 +++++++++++++++++++
.../{ => bluetooth}/qualcomm-bluetooth.yaml | 6 ++--
.../bindings/soc/qcom/qcom,wcnss.yaml | 8 ++---
4 files changed, 35 insertions(+), 13 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/net/bluetooth.txt
create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml
rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)Documentation/devicetree/bindings/net/bluetooth.txt deleted +0 -5
@@ -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/bluetooth/bluetooth-controller.yaml new file +29 -0
@@ -0,0 +1,29 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/bluetooth/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 + 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/qualcomm-bluetooth.yaml renamed from Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml +3 -3
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml# +$id: http://devicetree.org/schemas/net/bluetooth/qualcomm-bluetooth.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Qualcomm Bluetooth Chips
@@ -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
@@ -42,15 +42,13 @@ properties: bluetooth: type: object additionalProperties: false + allOf: + - $ref: /schemas/net/bluetooth/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
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=689494
---Test result---
Test Summary:
CheckPatch FAIL 6.26 seconds GitLint FAIL 1.97 seconds SubjectPrefix FAIL 2.59 seconds BuildKernel PASS 33.98 seconds BuildKernel32 PASS 30.00 seconds Incremental Build with patchesPASS 146.18 seconds TestRunner: Setup PASS 506.50 seconds TestRunner: l2cap-tester PASS 17.12 seconds TestRunner: iso-tester PASS 16.02 seconds TestRunner: bnep-tester PASS 6.33 seconds TestRunner: mgmt-tester PASS 103.02 seconds TestRunner: rfcomm-tester PASS 10.09 seconds TestRunner: sco-tester PASS 9.42 seconds TestRunner: ioctl-tester PASS 10.55 seconds TestRunner: mesh-tester PASS 7.71 seconds TestRunner: smp-tester PASS 9.46 seconds TestRunner: userchan-tester PASS 6.54 seconds
Details
##############################
Test: CheckPatch - FAIL - 6.26 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v4,1/7] 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? #115:
.../{ => bluetooth}/qualcomm-bluetooth.yaml | 6 ++--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, 71 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/13022301.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.
[v4,3/7] arm64: dts: apple: t8103: Add Bluetooth controller\WARNING:UNDOCUMENTED_DT_STRING: DT compatible string vendor "pci14e4" appears un-documented -- check ./Documentation/devicetree/bindings/vendor-prefixes.yaml #210: FILE: arch/arm64/boot/dts/apple/t8103-jxxx.dtsi:83:
+ compatible = "pci14e4,5f69";
total: 0 errors, 1 warnings, 68 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/13022303.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 - 1.97 seconds
Run gitlint with rule in .gitlint
[v4,1/7] dt-bindings: net: Add generic Bluetooth controller
15: B1 Line exceeds max length (93>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml" 16: B1 Line exceeds max length (91>80): " rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)"
[v4,2/7] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
14: B1 Line exceeds max length (95>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml"
##############################
Test: SubjectPrefix - FAIL - 2.59 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject
---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz
maintainerHi Tedd,
Quoted 30 lines · On Thu, Oct 27, 2022 at 9:20 AM <[email protected]> wrote:
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=689494---Test result---
Test Summary:
CheckPatch FAIL 6.26 seconds GitLint FAIL 1.97 seconds SubjectPrefix FAIL 2.59 seconds BuildKernel PASS 33.98 seconds BuildKernel32 PASS 30.00 seconds Incremental Build with patchesPASS 146.18 seconds TestRunner: Setup PASS 506.50 seconds TestRunner: l2cap-tester PASS 17.12 seconds TestRunner: iso-tester PASS 16.02 seconds TestRunner: bnep-tester PASS 6.33 seconds TestRunner: mgmt-tester PASS 103.02 seconds TestRunner: rfcomm-tester PASS 10.09 seconds TestRunner: sco-tester PASS 9.42 seconds TestRunner: ioctl-tester PASS 10.55 seconds TestRunner: mesh-tester PASS 7.71 seconds TestRunner: smp-tester PASS 9.46 seconds TestRunner: userchan-tester PASS 6.54 seconds
Quoted 7 lines
Details
##############################
Test: CheckPatch - FAIL - 6.26 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v4,1/7] 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
We might want to fix this to install the ply module.
Quoted 49 lines
ModuleNotFoundError: No module named 'ply'
WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), doesMAINTAINERSneed updating? #115:.../{ => bluetooth}/qualcomm-bluetooth.yaml | 6 ++--WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See:
Documentation/devicetree/bindings/submitting-patches.rstWARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See:
Documentation/devicetree/bindings/submitting-patches.rsttotal: 0 errors, 3 warnings, 71 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/13022301.patch has style problems, please review.
NOTE: Ignored message types:
UNKNOWN_COMMIT_IDNOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.[v4,3/7] arm64: dts: apple: t8103: Add Bluetooth controller\WARNING:UNDOCUMENTED_DT_STRING: DT compatible string vendor "pci14e4" appears un-documented -- check
./Documentation/devicetree/bindings/vendor-prefixes.yaml#210: FILE:arch/arm64/boot/dts/apple/t8103-jxxx.dtsi:83:
+ compatible = "pci14e4,5f69";total: 0 errors, 1 warnings, 68 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/13022303.patch has style problems, please review.
NOTE: Ignored message types:
UNKNOWN_COMMIT_IDNOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.##############################
Test: GitLint - FAIL - 1.97 seconds
Run gitlint with rule in .gitlint
[v4,1/7] dt-bindings: net: Add generic Bluetooth controller
15: B1 Line exceeds max length (93>80): " create mode 100644Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml" 16: B1 Line exceeds max length (91>80): " renameDocumentation/devicetree/bindings/net/{=>bluetooth}/qualcomm-bluetooth.yaml(96%)"[v4,2/7] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
14: B1 Line exceeds max length (95>80): " create mode 100644Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml"
Quoted 6 lines
##############################
Test: SubjectPrefix - FAIL - 2.59 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject
"Bluetooth: " is not specified in the subject
@Sven you can probably ignore these errors since not all patches are bluetooth specific these are probably a false positives.
@Tedd Btw, for new drivers the CI won't be able to build test so I wonder if we should have a special Kconfig option that select all the drivers so we don't have to keep updating the ci.config everytime a new driver is introduced?
Signature · 1 line
Luiz Augusto von Dentz
PATCH v4 2/7 dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
In reply to Sven PeterThese 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.
--- .../net/bluetooth/brcm,bcm4377-bluetooth.yaml | 81 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml
Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml new file +81 -0
@@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/bluetooth/brcm,bcm4377-bluetooth.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom BCM4377 family PCIe Bluetooth Chips + +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. + +allOf: + - $ref: bluetooth-controller.yaml# + +properties: + compatible: + enum: + - pci14e4,5fa0 # BCM4377 + - pci14e4,5f69 # BCM4378 + - pci14e4,5f71 # BCM4387 + + reg: + maxItems: 1 + + 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@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]; + }; + };
MAINTAINERS +1 -0
@@ -1903,6 +1903,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/bluetooth/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
PATCH v4 3/7 arm64: dts: apple: t8103: Add Bluetooth controller
In reply to Sven PeterAdd bluetooth controller nodes and the required brcm,board-type properties to be able to select the correct firmware to all board device trees.
--- arch/arm64/boot/dts/apple/t8103-j274.dts | 4 ++++ arch/arm64/boot/dts/apple/t8103-j293.dts | 4 ++++ arch/arm64/boot/dts/apple/t8103-j313.dts | 4 ++++ arch/arm64/boot/dts/apple/t8103-j456.dts | 4 ++++ arch/arm64/boot/dts/apple/t8103-j457.dts | 4 ++++ arch/arm64/boot/dts/apple/t8103-jxxx.dtsi | 8 ++++++++ 6 files changed, 28 insertions(+)
arch/arm64/boot/dts/apple/t8103-j274.dts +4 -0
@@ -21,6 +21,10 @@ aliases { }; }; +&bluetooth0 { + brcm,board-type = "apple,atlantisb"; +}; + &wifi0 { brcm,board-type = "apple,atlantisb"; };
arch/arm64/boot/dts/apple/t8103-j293.dts +4 -0
@@ -17,6 +17,10 @@ / { model = "Apple MacBook Pro (13-inch, M1, 2020)"; }; +&bluetooth0 { + brcm,board-type = "apple,honshu"; +}; + &wifi0 { brcm,board-type = "apple,honshu"; };
arch/arm64/boot/dts/apple/t8103-j313.dts +4 -0
@@ -17,6 +17,10 @@ / { model = "Apple MacBook Air (M1, 2020)"; }; +&bluetooth0 { + brcm,board-type = "apple,shikoku"; +}; + &wifi0 { brcm,board-type = "apple,shikoku"; };
arch/arm64/boot/dts/apple/t8103-j456.dts +4 -0
@@ -21,6 +21,10 @@ aliases { }; }; +&bluetooth0 { + brcm,board-type = "apple,capri"; +}; + &wifi0 { brcm,board-type = "apple,capri"; };
arch/arm64/boot/dts/apple/t8103-j457.dts +4 -0
@@ -21,6 +21,10 @@ aliases { }; }; +&bluetooth0 { + brcm,board-type = "apple,santorini"; +}; + &wifi0 { brcm,board-type = "apple,santorini"; };
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi +8 -0
@@ -11,6 +11,7 @@ / { aliases { + bluetooth0 = &bluetooth0; serial0 = &serial0; serial2 = &serial2; wifi0 = &wifi0;
@@ -77,4 +78,11 @@ wifi0: network@0,0 { local-mac-address = [00 00 00 00 00 00]; apple,antenna-sku = "XX"; }; + + bluetooth0: bluetooth@0,1 { + compatible = "pci14e4,5f69"; + reg = <0x10100 0x0 0x0 0x0 0x0>; + /* To be filled by the loader */ + local-bd-address = [00 00 00 00 00 00]; + }; };
Signature · 1 line
2.25.1
PATCH v4 4/7 Bluetooth: hci_event: Ignore reserved bits in LE Extended Adv Report
In reply to Sven PeterBroadcom 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.
These bits are reserved according to the Bluetooth spec anyway such that we can just drop them 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--- include/net/bluetooth/hci.h | 1 + net/bluetooth/hci_event.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +1 -0
@@ -2580,6 +2580,7 @@ struct hci_ev_le_conn_complete {#define LE_EXT_ADV_DIRECT_IND 0x0004#define LE_EXT_ADV_SCAN_RSP 0x0008#define LE_EXT_ADV_LEGACY_PDU 0x0010 +#define LE_EXT_ADV_EVT_TYPE_MASK 0x007f#define ADDR_LE_DEV_PUBLIC 0x00#define ADDR_LE_DEV_RANDOM 0x01
net/bluetooth/hci_event.c +1 -1
@@ -6494,7 +6494,7 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, void *data, info->length))break ; - evt_type =__le16_to_cpu (info->type); + evt_type =__le16_to_cpu (info->type) &LE_EXT_ADV_EVT_TYPE_MASK ; 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
PATCH v4 5/7 Bluetooth: Add quirk to disable extended scanning
In reply to Sven PeterBroadcom 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)--- 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
@@ -263,6 +263,16 @@ enum {* during the hdev->setup vendor callback. */ HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN , + +/* +* 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
@@ -1689,7 +1689,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
PATCH v4 6/7 Bluetooth: Add quirk to disable MWS Transport Configuration
In reply to Sven PeterBroadcom 4378/4387 controllers found in Apple Silicon Macs claim to support getting MWS Transport Layer Configuration,
< HCI Command: Read Local Supported... (0x04|0x0002) plen 0
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 68
Read Local Supported Commands (0x04|0x0002) ncmd 1
Status: Success (0x00)[...]
Get MWS Transport Layer Configuration (Octet 30 - Bit 3)]
[...]
, but then don't actually allow the required command:
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 15
Get MWS Transport Layer Configuration (0x05|0x000c) ncmd 1
Status: Command Disallowed (0x0c)
Number of transports: 0
Baud rate list: 0 entries
00 00 00 00 00 00 00 00 00 00--- include/net/bluetooth/hci.h | 10 ++++++++++ net/bluetooth/hci_sync.c | 2 ++ 2 files changed, 12 insertions(+)
include/net/bluetooth/hci.h +10 -0
@@ -273,6 +273,16 @@ enum {* during the hdev->setup vendor callback. */ HCI_QUIRK_BROKEN_EXT_SCAN , + +/* +* When this quirk is set, the HCI_OP_GET_MWS_TRANSPORT_CONFIG command is +* disabled. This is required for some Broadcom controllers which +* erroneously claim to support MWS Transport Layer Configuration. +* +* This quirk can be set before hci_register_dev is called or +* during the hdev->setup vendor callback. +*/ + HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, };/* HCI device flags */
net/bluetooth/hci_sync.c +2 -0
@@ -4260,6 +4260,8 @@ static int hci_get_mws_transport_config_sync(struct hci_dev *hdev) {if (!(hdev->commands[30 ] &0x08 ))return 0 ; +if (test_bit (HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG , &hdev->quirks)) +return 0 ;return __hci_cmd_sync_status (hdev,HCI_OP_GET_MWS_TRANSPORT_CONFIG ,0 ,NULL ,HCI_CMD_TIMEOUT );
Signature · 1 line
2.25.1
Luiz Augusto von Dentz
maintainerRe: [PATCH v4 6/7] Bluetooth: Add quirk to disable MWS Transport Configuration
Hi Sven,
Quoted 53 lines · Sven Peter
Broadcom 4378/4387 controllers found in Apple Silicon Macs claim to support getting MWS Transport Layer Configuration,
< HCI Command: Read Local Supported... (0x04|0x0002) plen 0
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 68Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00)[...]
Get MWS Transport Layer Configuration (Octet 30 - Bit 3)]
[...], but then don't actually allow the required command:
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 15Get MWS Transport Layer Configuration (0x05|0x000c) ncmd 1 Status: Command Disallowed (0x0c) Number of transports: 0 Baud rate list: 0 entries 00 00 00 00 00 00 00 00 00 00Signed-off-by Sven Peter <[email protected]>--- include/net/bluetooth/hci.h | 10 ++++++++++ net/bluetooth/hci_sync.c | 2 ++ 2 files changed, 12 insertions(+)include/net/bluetooth/hci.h +10
-0@@ -273,6 +273,16 @@ enum {* during the hdev->setup vendor callback. */ HCI_QUIRK_BROKEN_EXT_SCAN , + +/* +* When this quirk is set, the HCI_OP_GET_MWS_TRANSPORT_CONFIG command is +* disabled. This is required for some Broadcom controllers which +* erroneously claim to support MWS Transport Layer Configuration. +* +* This quirk can be set before hci_register_dev is called or +* during the hdev->setup vendor callback. +*/ + HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, };/* HCI device flags */ net/bluetooth/hci_sync.c +0
-0
net/bluetooth/hci_sync.c static int hci_get_mws_transport_config_sync(struct hci_dev *hdev) · line 4264
Quoted 5 lines
net/bluetooth/hci_sync.c +2
-0@@ -4260,6 +4260,8 @@ static int hci_get_mws_transport_config_sync(struct hci_dev *hdev) {if (!(hdev->commands[30 ] &0x08 ))return 0 ; +if (test_bit (HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG , &hdev->quirks)) +return 0 ;
Let's add a macro that tests both the command and the quirk so we don't have to test them separately.
Quoted 5 lines
net/bluetooth/hci_sync.c +0
-1return __hci_cmd_sync_status (hdev,HCI_OP_GET_MWS_TRANSPORT_CONFIG ,0 ,NULL ,HCI_CMD_TIMEOUT ); --2.25.1
Signature · 1 line
Luiz Augusto von Dentz
Re: [PATCH v4 6/7] Bluetooth: Add quirk to disable MWS Transport Configuration
Hi Luiz,
Quoted 50 lines · Luiz Augusto von Dentz
Hi Sven,
Quoted 47 lines · Sven Peter
Broadcom 4378/4387 controllers found in Apple Silicon Macs claim to support getting MWS Transport Layer Configuration,
< HCI Command: Read Local Supported... (0x04|0x0002) plen 0
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 68Read Local Supported Commands (0x04|0x0002) ncmd 1 Status: Success (0x00)[...]
Get MWS Transport Layer Configuration (Octet 30 - Bit 3)]
[...], but then don't actually allow the required command:
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 15Get MWS Transport Layer Configuration (0x05|0x000c) ncmd 1 Status: Command Disallowed (0x0c) Number of transports: 0 Baud rate list: 0 entries 00 00 00 00 00 00 00 00 00 00Signed-off-by Sven Peter <[email protected]>--- include/net/bluetooth/hci.h | 10 ++++++++++ net/bluetooth/hci_sync.c | 2 ++ 2 files changed, 12 insertions(+)include/net/bluetooth/hci.h +10
-0@@ -273,6 +273,16 @@ enum {* during the hdev->setup vendor callback. */ HCI_QUIRK_BROKEN_EXT_SCAN , + +/* +* When this quirk is set, the HCI_OP_GET_MWS_TRANSPORT_CONFIG command is +* disabled. This is required for some Broadcom controllers which +* erroneously claim to support MWS Transport Layer Configuration. +* +* This quirk can be set before hci_register_dev is called or +* during the hdev->setup vendor callback. +*/ + HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, };
Quoted 14 lines
net/bluetooth/hci_sync.c static int hci_get_mws_transport_config_sync(struct hci_dev *hdev) · line 4264
Quoted 11 lines
include/net/bluetooth/hci.h +0
-0/* HCI device flags */ net/bluetooth/hci_sync.c +2
-0@@ -4260,6 +4260,8 @@ static int hci_get_mws_transport_config_sync(struct hci_dev *hdev) {if (!(hdev->commands[30 ] &0x08 ))return 0 ; +if (test_bit (HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG , &hdev->quirks)) +return 0 ;Let's add a macro that tests both the command and the quirk so we don't have to test them separately.
Sure, I'll add a macro for v5.
Best,
Sven
PATCH v4 7/7 Bluetooth: hci_bcm4377: Add new driver for BCM4377 PCIe boards
In reply to Sven PeterBroadcom 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.
--- MAINTAINERS | 1 + drivers/bluetooth/Kconfig | 12 + drivers/bluetooth/Makefile | 1 + drivers/bluetooth/hci_bcm4377.c | 2514 +++++++++++++++++++++++++++++++ 4 files changed, 2528 insertions(+) create mode 100644 drivers/bluetooth/hci_bcm4377.c
MAINTAINERS +1 -0
@@ -1911,6 +1911,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
@@ -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
@@ -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 +2514 -0
2,514 lines not on this page · raw message
Signature · 1 line
2.25.1