Broadcom/Apple Bluetooth driver for Apple Silicon
Subsystems (8)
v3 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]/
Here's v3 of the Apple/Broadcom Bluetooth series. Again most changes are to the device tree bindings. I've also included the changes to the dts files that I forgot for the last two versions.
Additionally I had to introduce another quirk since these controllers also claim to support MWS Pattern Configuration but then simply disallow that command. This used to be silently ignored by the bluetooth core but fails during setup now since b82a26d8633cc89367fac75beb3ec33061bea44a.
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 Pattern 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 | 2513 +++++++++++++++++
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, 2699 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 v3 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.
---
changes from v2:
- added new bluetooth subdirectory and moved files there
- removed minItems from local-bd-address
- dropped [email protected], [email protected] and [email protected] due to bouncing emails from the CC list
changes from v1:
- removed blueetooth.txt instead of just replacing it with a deprecation note
- replaced references to bluetooth.txt
.../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=678304
---Test result---
Test Summary:
CheckPatch FAIL 4.96 seconds GitLint FAIL 0.94 seconds SubjectPrefix FAIL 0.92 seconds BuildKernel PASS 46.10 seconds BuildKernel32 PASS 41.23 seconds Incremental Build with patchesPASS 195.83 seconds TestRunner: Setup PASS 684.65 seconds TestRunner: l2cap-tester PASS 21.17 seconds TestRunner: iso-tester PASS 21.91 seconds TestRunner: bnep-tester PASS 8.38 seconds TestRunner: mgmt-tester PASS 133.37 seconds TestRunner: rfcomm-tester PASS 13.04 seconds TestRunner: sco-tester PASS 12.12 seconds TestRunner: smp-tester PASS 11.98 seconds TestRunner: userchan-tester PASS 8.66 seconds
Details
##############################
Test: CheckPatch - FAIL - 4.96 seconds
Run checkpatch.pl script with rule in .checkpatch.conf
[v3,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? #125:
.../{ => 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/12980751.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.
[v3,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 #212: FILE: arch/arm64/boot/dts/apple/t8103-jxxx.dtsi:81:
+ 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/12980754.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 - 0.94 seconds
Run gitlint with rule in .gitlint
[v3,1/7] dt-bindings: net: Add generic Bluetooth controller
25: B1 Line exceeds max length (93>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/bluetooth-controller.yaml" 26: B1 Line exceeds max length (91>80): " rename Documentation/devicetree/bindings/net/{ => bluetooth}/qualcomm-bluetooth.yaml (96%)"
[v3,2/7] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
25: B1 Line exceeds max length (95>80): " create mode 100644 Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml"
##############################
Test: SubjectPrefix - FAIL - 0.92 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
Re: [PATCH v3 1/7] dt-bindings: net: Add generic Bluetooth controller
In reply to Sven PeterQuoted 16 lines · Sven Peter
Bluetooth controllers share the common local-bd-address property. Add a generic YAML schema to replace bluetooth.txt for those.
Signed-off-by Sven Peter <[email protected]>---
changes from v2:
- added new bluetooth subdirectory and moved files there
- removed minItems from local-bd-address
- dropped [email protected], [email protected] and [email protected] due to bouncing emails from the CC listchanges from v1:
- removed blueetooth.txt instead of just replacing it with a deprecation note
- replaced references to bluetooth.txt
Quoted 9 lines
.../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%)PATCH v3 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.
---
changes from v2:
- extended example to include parent pcie node to make node name validation work
- moved to bluetooth/ subdirectory
- added maxItems to reg and dropped description
- moved bluetooth-controller.yaml reference after description
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
.../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
@@ -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/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
Re: [PATCH v3 2/7] dt-bindings: net: Add Broadcom BCM4377 family PCIe Bluetooth
Quoted 20 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.Signed-off-by Sven Peter <[email protected]>---
changes from v2:
- extended example to include parent pcie node to make node name validation work
- moved to bluetooth/ subdirectory
- added maxItems to reg and dropped description
- movedbluetooth-controller.yamlreference after descriptionchanges 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
Quoted 4 lines
.../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
PATCH v3 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.
---
new commit in v3
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"; +}; + /* * Force the bus number assignments so that we can declare some of the * on-board devices and properties that are populated by the bootloader
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"; +}; + /* * Remove unused PCIe ports and disable the associated DARTs. */
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"; +}; + /* * Remove unused PCIe ports and disable the associated DARTs. */
arch/arm64/boot/dts/apple/t8103-j456.dts +4 -0
@@ -21,6 +21,10 @@ aliases { }; }; +&bluetooth0 { + brcm,board-type = "apple,capri"; +}; + &i2c0 { hpm2: usb-pd@3b { compatible = "apple,cd321x";
arch/arm64/boot/dts/apple/t8103-j457.dts +4 -0
@@ -21,6 +21,10 @@ aliases { }; }; +&bluetooth0 { + brcm,board-type = "apple,santorini"; +}; + /* * Force the bus number assignments so that we can declare some of the * on-board devices and properties that are populated by the bootloader
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi +8 -0
@@ -11,6 +11,7 @@ / { aliases { + bluetooth0 = &bluetooth0; serial0 = &serial0; serial2 = &serial2; wifi0 = &wifi0;
@@ -75,4 +76,11 @@ wifi0: network@0,0 { /* To be filled by the loader */ local-mac-address = [00 00 00 00 00 00]; }; + + 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 v3 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---
changes from v2:
- removed quirk and apply mask unconditionally since only bit 0-6 are used according to the spec
changes from v1:
- adjusted the commit message a bit to make checkpatch happy
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
@@ -2576,6 +2576,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
@@ -6481,7 +6481,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 v3 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)---
no changes since v2
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
@@ -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
@@ -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
PATCH v3 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---
new commit in v3 since this now fails loudly since 6.0-rc4
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
@@ -3939,6 +3939,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
PATCH v3 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.
---
no changes since v2
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 | 2513 +++++++++++++++++++++++++++++++ 4 files changed, 2527 insertions(+) create mode 100644 drivers/bluetooth/hci_bcm4377.c
MAINTAINERS +1 -0
@@ -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
@@ -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 +2513 -0
2,513 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 11 lines · Sven Peter
Hi,
v1: https://lore.kernel.org/asahi/[email protected]/
v2: https://lore.kernel.org/asahi/[email protected]/Here's v3 of the Apple/Broadcom Bluetooth series. Again most changes are to the device tree bindings. I've also included the changes to the dts files that I forgot for the last two versions.
Additionally I had to introduce another quirk since these controllers also claim to support MWS Pattern Configuration but then simply disallow that command. This
Apologies! This was supposed to be "MWS Transport Layer Configuration" instead of "MWS Pattern Configuration". I just miscounted bits originally and forgot to update the cover letter. The actual commit has the correct name though.
Sven