Skip to content

wifi: apple: centauri: tell the firmware the host is awake, so it stops trapping - #828

Closed
erikwb wants to merge 1 commit into
t6050/centauri-wififrom
j716c/n1-host-awake
Closed

erikwb wants to merge 1 commit into
t6050/centauri-wififrom
j716c/n1-host-awake

Conversation

@erikwb

@erikwb erikwb commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

The N1 Wi-Fi firmware on the M5 Max (J716c) can trap after a few hours connected. Its Alpha stage leaves its running state, a country command then loses its transport, and Wi-Fi stays down until reboot. The firmware treats a host that hasn't sent it a host power state as asleep: it powers the PHYs down and traps. This driver never sends one.

This is Joshua Warren's fix from the J813/J873 N1 driver, ported to the T6050 driver:

  • Before the first join of a firmware boot, the driver sends command 6 with a zero body (host power state awake), command 43 (packet lifetime) and command 52 (control profile).
  • Each command is sent once per firmware boot. If one fails, it's retried at the next join.
  • The host_setup module parameter (default on) turns this off.

Testing

  • Mac mini M6 (J873), Joshua's measurement: WPA2-PSK, 5 GHz. The firmware stayed in its running state for the whole test, about 17 minutes connected. Before, it trapped within 15 s in 14 of 14 variants. A 600 s iperf3 at 20 Mbit/s moved 1.40 GBytes without a stall.
  • MacBook Pro M5 Max (J716c): this change has run on the J716c daily kernels for a day. Every boot logs host power state awake: rc=0 status=0, and Wi-Fi works. A long soak hasn't been done, so the overnight trap isn't confirmed fixed.
  • Build: t6050/centauri-wifi doesn't build on its own. centauri_wifi.c there redefines centauri_alpha_irq, centauri_wifi_register and centauri_wifi_unregister without the Kconfig and header from t6050/centauri-core, with or without this commit. The same centauri_wifi.c builds W=1-clean in the J716c kernel, where centauri-core and centauri-wifi are combined.
  • checkpatch --strict: one warning, a 76-character line in the original commit description.

A stacked follow-up sends the host power state again after suspend-to-idle.

Created with Claude Opus 5.5 in Claude Code.

Without the host power state the Alpha firmware treats the host as asleep,
powers the PHYs down and traps (PHY5G irq_isr.c:105, PHY2G
power_manager.c:394, and in a log with a post-join frame also LMAC2G "PMGR -
Assert while waiting"). Before the first join of a firmware boot, send
command 6 with a zero body (host power state awake), command 43 (packet
lifetime) and command 52 (control profile). The host_setup parameter
(default on) turns this off.

Measured on a Mac mini M6 (J873), WPA2-PSK, 5 GHz: the firmware stayed
alive (stage 2) for the whole test, about 17 minutes connected; before, it
trapped within 15 s in 14 of 14 variants. A 600 s iperf3 at 20 Mbit/s moved
1.40 GBytes without a stall.

On a MacBook Pro M5 Max (J716c) the same firmware family trapped after
hours instead of seconds: overnight, the Alpha stage left 2, a country
command lost its transport, and Wi-Fi stayed down until reboot. This driver
sends none of the three commands either.

[Erik: ported from the J813/J873 N1 driver (linux-aurora 1242f12e876b)
to the T6050 APIF driver. That driver also has tx_config debugfs files
whose applied defaults this skips; this one has none, so each command is
sent once per firmware boot and retried on the next join if it fails.]

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Developed with Claude Code.
Signed-off-by: Erik Bourget <erik@ebourget.net>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: the change works on the M5 Pro (J714sAP, T6050), bare metal. It belongs in a different file now.

Since #938 the T6050 transport is centauri/t6050/centauri_wifi.c, and that copy doesn't send these commands. On integration, centauri/centauri_wifi.c (the file this PR changes on t6050/centauri-wifi) is the J813/J873 driver, which already has them. So I applied the same change to the T6050 file in #1316, stacked on #938, and tested that:

  • Before the first join: host power state awake: rc=0 status=0, TX packet lifetime defaults: rc=0, TX control profile defaults: rc=0. Then WPA2-PSK on 5 GHz connects, gets DHCP and passes traffic.
  • The commands sent right before a join, late in a healthy boot (load with host_setup=0, join, set host_setup=1, rejoin), didn't disturb that join. It connected on the first attempt.
  • host_setup=0 turns them off.

Not tested: the overnight soak (the trap took hours on J716c). #1316 can replace this PR once #938 lands; this branch doesn't build on its own, as the description says.

DjDeveloperr added a commit that referenced this pull request Nov 9, 2026
…ore a join

Without the host power state the N1 Alpha firmware treats the host as
asleep, powers the PHYs down and traps. Before the first join of a
firmware boot, send command 6 with a zero body (host power state awake),
command 43 (packet lifetime) and command 52 (control profile). Each is
sent once per firmware boot and retried at the next join if it fails.
The host_setup parameter (default on) turns this off.

This is Joshua Warren's fix from the J813/J873 N1 driver (linux-aurora
1242f12e876b), which Erik Bourget ported to the T6050 driver as
#828. #828 targets t6050/centauri-wifi's
centauri/centauri_wifi.c; with the T6050 transport now in centauri/t6050/,
the same change goes here.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Closing: the same host-awake change is merged for the T6050 driver as #1316 (008cc8a). Since #938, the T6050 transport lives in centauri/t6050/centauri_wifi.c, and on integration centauri/centauri_wifi.c (this PR's target) is the J813/J873 driver, which already sends these commands. Retested on the M5 Pro: host power state awake: rc=0 status=0, then the join and traffic.

🤖 Generated with Claude Code

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.

3 participants