Skip to content

BCM4388 (M4 Pro Wi-Fi/Bluetooth): calibration, BD address, join preference, capability parsing, BT probe order - #369

Merged
RyanTheTide merged 9 commits into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/bcm4388
Oct 23, 2026
Merged

RyanTheTide merged 9 commits into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/bcm4388

Conversation

@jgoyvaerts

Copy link
Copy Markdown
Contributor

Fixes for the Broadcom BCM4388 combo chip of the M4 Pro MacBook Pro.

  • Niklas Sheth's commit, carried unchanged: BCM4388 needs only the beamforming calibration.
  • Follow-up of ours: his early return for BCM4388 skips the local-bd-address read on this tree (aurora reads it
    after the calibration properties), so skip only the non-beamforming check and fall through to the common path.
  • brcmfmac: match the firmware "cap" list as whole tokens (strnstr() matched "sae" inside "sae_ext" and missed a
    final "sae").
  • brcmfmac: if the firmware rejects the RSSI-delta + RSSI join preference pair (BCM4388 returns -EBADE), set the
    plain RSSI preference alone.
  • hci_bcm4377: on BCM4388, defer the Bluetooth probe until PCI function 0 (Wi-Fi) is bound; the deferred probe is
    retried when brcmfmac binds, so the module can autoload instead of being ordered by userspace.

Hardware tested on: Apple MacBook Pro (16-inch, M4 Pro, 2024), J616s / T6040, macOS 26.x firmware, booted by our own loader (not aurora's m1n1) with our private T6040 device tree.

How tested: Daily use on the J616s: Wi-Fi associates (WPA2/WPA3-SAE), Bluetooth LE mouse and audio work, and
hci_bcm4377 autoloads after brcmfmac. The resulting hci_bcm4377.c is byte-identical to our tested tree.

Not tested / limits: Other BCM4377/4378/4387 machines were not tested (the BT deferral and the calibration change only act
for id 0x4388; the brcmfmac token parser and join-preference fallback act everywhere).

Credits: Niklas Sheth (GravityLinux) for the BCM4388 calibration change (commit carried unchanged, his authorship and message).

Base: integration/aurora (44d5afc). Built and checked there (aurora's defconfig, W=1 on every touched object, checkpatch --strict). Hardware testing was done on our daily tree, which is based on aurora-wip (Linux 7.1.12) and runs this code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K4TC3f2CpzFxhnEziL9wcg

niklassheth and others added 9 commits October 20, 2026 21:28
BCM4388 always uploads the beamforming calibration through
bcm4388_send_calibration(). Do not reject its device-tree configuration
when the unused non-beamforming calibration property is absent.

Keep the beamforming blob mandatory and retain the existing calibration
requirements for other chips. Calibration still comes exclusively from
the device tree; this does not add a firmware-file fallback.

Validation: the hci_bcm4377 driver object builds for arm64 with LLVM.

Assisted-By: OpenAI Codex (GPT-6 Astra)
Signed-off-by: Niklas Sheth <[email protected]>
Signed-off-by: Jonathan Goyvaerts <[email protected]>
bcm4377_probe_of() returns early for BCM4388 once the beamforming
calibration is found, so the local-bd-address property, which is read
after the calibration properties, is never read on that chip and the
address the bootloader provides is ignored.

Skip only the non-beamforming calibration check for BCM4388 and fall
through to the common path. A missing beamforming calibration now also
logs the same error as on the other chips.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
The "cap" iovar returns a space-separated list of capability names.
brcmf_feat_firmware_capabilities() looked each name up with strnstr(),
so "sae" was listed as "sae " to keep it from matching "sae_ext". That
fails when "sae" is the last token, which has no trailing space, and
any other short name can still match inside a longer one.

Split the list into tokens and compare each one exactly. Read one byte
less than the buffer so the reply is always NUL-terminated.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
brcmf_c_set_joinpref_default() sets two join preferences: an RSSI delta
that favours 5 GHz, then plain RSSI. The BCM4388 firmware rejects that
pair with a firmware error (-EBADE), which leaves the firmware with no
join preference set from the host at all.

If the pair is rejected, set the plain RSSI preference alone. The
BCM4388 accepts it.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
The BCM4388 Bluetooth function only comes up once the Wi-Fi function
(function 0 of the same device) is bound and has started the chip.
Probing it earlier fails, so userspace had to keep hci_bcm4377 from
autoloading and load it after brcmfmac bound. Defer the probe until
function 0 is bound instead; the deferred probe is retried when
brcmfmac binds, so the driver can autoload.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
This reverts commit 1db5dc6. The change is Michael Reeves' patch
"wifi: brcmfmac: Fall back to RSSI-only default join preferences",
posted to linux-wireless on 2026-09-25, carried here under the wrong
author. A following commit applies his original with his authorship.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
This reverts commit 1fb3690. The change is Michael Reeves' patch
"wifi: brcmfmac: Match complete firmware capability names", posted to
linux-wireless on 2026-09-25, carried here under the wrong author. The
next commit applies his original with his authorship.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
BCM4388 firmware advertises "hp2p" without advertising "p2p". Substring
matching incorrectly treats "hp2p" as P2P support, causing userspace to
attempt Wi-Fi Direct interface creation that the firmware rejects.

Match complete whitespace-separated capability names instead. Remove the
trailing-space workarounds for SAE and FBT and reserve a terminating
byte outside the firmware response buffer.

Fixes: ec64241 ("brcmfmac: obtain feature info using 'cap' firmware command")
Signed-off-by: Michael Reeves <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[jg: dropped the FBT hunk; this tree has no BRCMF_FEAT_FBT entry]
Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
BCM4388 firmware rejects the default join preference containing a 5 GHz
RSSI boost with -EBADE, but accepts an RSSI-only preference.

Retry with RSSI-only selection only after -EBADE. Log other errors
without retrying.

Signed-off-by: Michael Reeves <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jonathan Goyvaerts <[email protected]>
Assisted-by: LLM
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Correction: "match firmware capabilities as whole tokens" and "fall back to a plain RSSI join preference" are Michael Reeves' patches 02/13 and 03/13 of his BCM4388 series on linux-wireless (https://lore.kernel.org/r/[email protected]), and they were carried here under my name by mistake. I added reverts plus his originals with his authorship on top, so the code is unchanged. If you squash-merge, please keep him as the author of those two.

@RyanTheTide
RyanTheTide merged commit 3c16a31 into aurora-silicon:integration/aurora Oct 23, 2026
@jgoyvaerts
jgoyvaerts deleted the m4pro/bcm4388 branch October 24, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants