Skip to content

arm64: dts: apple: t6041-j575c: let userspace set the fan speeds - #2898

Merged
RyanTheTide merged 1 commit into
aurora-silicon:integration/aurorafrom
7robertodantas:j575c-fan-control
Nov 23, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:integration/aurorafrom
7robertodantas:j575c-fan-control

Conversation

@7robertodantas

@7robertodantas 7robertodantas commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

The J575c (Mac Studio, M4 Max) fans are monitor-only: fanX_target is read-only, and every boot logs

macsmc-hwmon macsmc-hwmon: Fan F0Ac: optional keys not found: mode F0Md
macsmc-hwmon macsmc-hwmon: Fan F1Ac: optional keys not found: mode F1Md

This SMC has no F0Md/F1Md. Its key list has F0md/F1md (ui8, readable and writable), the T6050 spelling,
and no Ftst unlock key. This PR names those keys in the J575c fan nodes and marks both fans
apple,fan-manual-control, as the J614c/J616c and J714s already are. DT only.

The SMC keeps driving the fans until userspace writes a target, and writing 0 hands a fan back (#2448 semantics).

Tests (J575c)

Kernel 7.3.0-1-106 = integration/aurora f5fae3c (macsmc-hwmon.c and hwmon-fan-dual.dtsi are identical
there and on e892113). One-shot trial Stage 2 whose J575c DTB differs from the
f5fae3c build only by this change (decompiled diff: the two apple,fan-mode strings and the two flags).

Check Result
fan1_target, fan2_target 0644; the "optional keys not found" lines are gone; no macsmc-hwmon messages
fan 1 -> 2000 rpm, then 0 2000 rpm within 10 s; after 0, back to the SMC's 1000 rpm (fan 2 stayed with the SMC)
both -> 3000 rpm, then 0 2994 / 2990 rpm; after 0, both back to 1000 rpm
fan 1 held at 2000, one s2idle (20 s, PMU RTC wake) resumed with the SMC in control (1004 rpm, target 1000); suspend_stats success
after these cycles, 15 min all-core load (stress-ng x16, 84 W) the SMC raised both fans on its own, 1000 -> 1569 rpm, die up to 99 C (96 C at the end); stress-ng 1953 bogo ops/s, the same as without the change

Review round (kernel 7.3.0-1-108 = integration/aurora e892113, this commit's base; one-shot Stage 2 whose J575c
DTB differs from the e892113 build only by this change):

Check Result
both -> 3625 rpm (F0Mx/F1Mx), then 5000, then 0 3637 / 3639 rpm; 5000 clamped to 3625 (same speeds); after 0, both back to 1000 rpm
both held at 1000 rpm (F0Mn/F1Mn), 15 min all-core load (stress-ng x16, 84-85 W) die 96 C at 5 min, 104 C at 10 min, 106-107 C over the last 3 min, peak 108 C: below the first cpu-die trip (112 C), so no cooling device engaged, clocks 4512/2592/4512 MHz throughout, stress-ng 1957 bogo ops/s; no SMC trip, shutdown or override of the held fans; after 0 the SMC took them to 2500 rpm
fan 1 held at 2000, reboot next boot (stock DTB, no fan control): both fans with the SMC, 1000 rpm
fan 1 held at 2000, poweroff, power on next boot (stock DTB, no fan control): both fans with the SMC, 1000 rpm
regression counts (trial boot) 0 failed units; SELinux not enabled (0 avc: lines); same 6 kernel error lines and same warnings as the base DTB on the same kernel (ASM3142 cold-boot firmware probe, DCP lane count); no macsmc-hwmon lines

The reboot/poweroff rows show the fan is not left in manual mode; they cannot tell the driver's shutdown hook apart
from the SMC resetting the fan mode itself.

J775D keeps its fans read-only only because they have not been tested this way yet (7a479d4 left J716s and
J775D out until then), not because of a known hardware difference. The commit message now says so.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at 0144e55.

Looks correct to me. One row is still missing, for the case this flag newly allows.

  1. The code path is sound. The key spelling matches the other T6050-style SMCs (j714s/j775d). Writes are clamped to the SMC's own F0Mn/F0Mx (macsmc-hwmon.c:560-570), so no limit lives in the DT. Manual requests are dropped at suspend, shutdown and unbind (:1665, :1705, :1713). No board gate, since the key name is per-SMC data in the board DT.
  2. Row owed: a fan held manually at its minimum under sustained load. The 15 min stress-ng run happened with the SMC in control, which is the case that already worked. Once a fan is in manual mode the SMC stops raising it, so the only protection left is CPU/GPU throttling. Please hold both fans at F0Mn/F1Mn (1000 rpm) under the same x16 84 W load for 15 min. Record the die temperature plateau, the clock/power the CPU throttles to, and that the SMC never trips or shuts down. This is the worst thing a userspace fan daemon can do, and it is now reachable on a desktop that runs at 99 C on auto.
  3. Two smaller rows, both listed as untested: (a) both fans at 3625 rpm (F0Mx), to confirm the clamp's upper end is accepted; (b) a fan held at 2000 across reboot and poweroff, to show the restore path hands it back on this SMC with no Ftst. Same code as on J614c/J616c, but those SMCs have Ftst and this one doesn't.
  4. Nit: t6050-j775d.dts says its Studio fans stay read-only for userspace. One sentence in the commit message on why J575c gets manual control and J775D doesn't (untested, or a real difference?) would help the next reader.

The commit trailers are fine.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at 0144e55. No blocker: DT only, the same shape as the J714s/J716s/K116s fan nodes, and the driver already handles it.

What I checked:

  • macsmc_hwmon reads apple,fan-mode through macsmc_hwmon_parse_key(), so a key the SMC doesn't have is logged and dropped. Manual control is only enabled when the min, max, target and mode keys all resolve (macsmc-hwmon.c:1139-1151). A wrong spelling therefore falls back to monitor-only with a warning; it cannot leave a fan writable without its mode key.
  • The board has no Ftst, so unlock_key stays 0 (:1659-1662). That matches the T6050 boards that use the lower-case F0md/F1md spelling.
  • Release is unchanged and shared with the J614c/J616c: writing 0 hands the fan back, the restore action runs at unbind, and your s2idle row shows the SMC back in control after resume.
  • Merges cleanly on the current integration/aurora tip; one commit with the author's Signed-off-by only.

Small points, not blocking:

  • This is now the fourth board file that only renames the mode key to the lower-case form. Neither spelling is a property of the board: it is whichever key the SMC lists. macsmc_hwmon_parse_key() already asks the SMC whether a key exists, so the driver could try F%dMd and then F%dmd and drop the per-board apple,fan-mode overrides. That is a follow-up for the driver, not something for this PR.
  • Still untested, as you say: a fan at its 3625 rpm maximum, and a reboot or shutdown with a fan held manual (the restore path).

Assisted-by: LLM (Claude:Opus 5.5)

@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.

Formal §1–§6 pre-PR checklist review at 0144e55b5e564331a0e8c9ceeb5f3fdbc9f6cd13 (dt-checks and host-tests: green).

The DT-only change in arch/arm64/boot/dts/apple/t6041-j575c.dts is clean and matches t6050-j714s.dts (F0md/F1md + apple,fan-manual-control, no Ftst), and macsmc-hwmon clamps writes to SMC-reported F0Mn/F0Mx while restoring auto control on suspend/shutdown/unbind. Before enabling userspace manual fan control on this desktop, two §3/§5 verification gaps remain:

Blockers

  1. §3 / §5 Missing worst-case manual-minimum thermal safety row:
    The 15 min 84 W all-core stress-ng run was performed with the SMC in automatic control, where the die already reached 99 °C while the SMC ramped both fans to 1569 rpm. Because apple,fan-manual-control newly allows userspace to pin both fans at F0Mn/F1Mn (1000 rpm) under load, please run a sustained 15 min all-core load on J575c with both fans held manually at minimum (1000 rpm), recording the die temperature plateau, CPU throttle behavior, and confirming no SMC thermal trip or shutdown.
  2. §5 Missing restore/clamp test rows & explicit regression counts:
    • Test reboot and poweroff with a fan held manual (listed as untested; J614c/J616c have Ftst, whereas J575c has no Ftst unlock key) and confirm F0Mx (3625 rpm) upper-clamp acceptance.
    • Include explicit §5 regression counts on the J575c boot (0 SELinux denials, 0 failed units, 0 new kernel errors; currently only "no macsmc-hwmon messages" is noted).

Non-blocking notes

  • Add a brief sentence in the commit message explaining why J575c enables userspace manual fan control while J775D keeps fans read-only (untested vs hardware difference).
  • Follow-up (out of scope for this PR): now that multiple boards only override apple,fan-mode to F0md/F1md, macsmc-hwmon could dynamically probe F%dMd then F%dmd.

Checklist summary

  • §1 No model gating: Pass (DT-only per-SMC key description).
  • §2 Production-ready: Pass (default cmdline, dt-checks green).
  • §3 Safety: Driver clamps to SMC-reported F0Mn/F0Mx and restores auto mode on suspend/shutdown/unbind; blocked on J575c manual-minimum sustained-load thermal verification and reboot/poweroff restore proof on this no-Ftst SMC.
  • §4 Clean-room & attribution: Pass (human author/committer + human Signed-off-by: only, zero AI trailers in commit, Assisted-by: in PR body).
  • §5 Evidence: Good J575c basic manual/auto/s2idle/auto-load table; blocked on manual-minimum thermal soak, reboot/poweroff restore + max-RPM check, and explicit §5 regression counts.
  • §6 Naming: Pass.

Assisted-by: LLM (Gemini 4 Neon)

The J575c SMC has no F0Md/F1Md fan mode keys: it spells them F0md/F1md,
as the T6050 SMC does, so macsmc-hwmon drops the mode key at probe
("Fan F0Ac: optional keys not found: mode F0Md") and fanX_target stays
read-only. Name the keys this SMC has and mark both fans
apple,fan-manual-control, as the J614c/J616c already are.

This SMC has no Ftst unlock key either; the fans are in automatic mode
and take the manual mode write directly. The SMC drives the fans until
userspace writes a target, and writing 0 hands a fan back.

The J775D Mac Studio uses the same key spelling but keeps its fans
read-only for userspace only because they have not been tested this way
yet (the J714s change, 7a479d4, left J716s and J775D out until
then), not because of a known hardware difference.

Tested on a J575c (7.3.0-1-106, integration/aurora f5fae3c) with a
one-shot Stage 2 whose J575c DTB differs only by this change: both
fanX_target are 0644 and the probe message is gone; fan 1 set to 2000
rpm ran at 2000 and returned to the SMC's 1000 rpm after 0 was written;
both fans set to 3000 ran at 2994/2990 and returned the same way; with
fan 1 held at 2000 an s2idle cycle handed it back to the SMC. After
these cycles, a 15 min all-core load (84 W, die up to 99 C) had the SMC
raise both fans from 1000 to 1569 rpm on its own. No macsmc-hwmon
messages in the kernel log.

Then on 7.3.0-1-108 (integration/aurora e892113, this commit's base)
with this commit's DTB: both fans set to their 3625 rpm maximum ran at
about 3640 rpm, and 5000 was clamped to 3625. With both fans held at
their 1000 rpm minimum, the same 15 min all-core load (84-85 W) took
the die to 96 C after 5 min, 104 C after 10 min and 106-108 C over the
last 3 min. That is below the first cpu-die trip (112 C), so no cooling
device engaged and the clocks stayed at 4512/2592/4512 MHz with the same
throughput as under SMC control; the SMC did not trip, shut down or
override the held fans, and took them to 2500 rpm on its own after 0
was written. With fan 1 held at 2000 rpm, both a reboot and a poweroff
followed by power-on came up with the fans under SMC control (1000 rpm)
on a boot whose device tree has no fan control. 0 failed units, and the
same kernel errors and warnings as with the base DTB.

Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
@7robertodantas

Copy link
Copy Markdown
Contributor Author

Thanks both. The rows you asked for are done on the J575c. The commit is the same DT change; only its message changed (J775D note and the new rows). It is still on e892113 and still merges cleanly on the current integration/aurora.

Setup: kernel 7.3.0-1-108 = plain integration/aurora e892113 (this commit's base), one-shot Stage 2 whose J575c DTB differs from the e892113 build only by this change (decompiled diff: the two apple,fan-mode strings and the two flags).

  1. Both fans held at their minimum (1000 rpm) under the 84 W load, 15 min (stress-ng x16 matrixprod, as before; the script would have handed the fans back at TCMz >= 110 C, but it never got there):

    Time under load TCMz (die max) Total system power
    5 min 96 C 82 W
    10 min 104 C 84 W
    12-15 min 106-107 C (peak 108 C) 84-85 W
    • Throttling: none. 108 C is below the first cpu-die trip (112 C), so no cooling device left state 0 and every sample of the run had the clusters at 4512/2592/4512 MHz. stress-ng did 1957 bogo ops/s (1953 with the SMC in control).
    • The SMC did not trip, shut down or raise the held fans (1009-1015 rpm all the way). Kernel log: no thermal, critical or shutdown lines.
    • It was still creeping up (+1 C over the last 3 min), so it is close to a plateau, not proven flat. A longer hold would reach the 112 C trip and power_allocator would start throttling. I stopped at the 15 min you asked for and didn't run that case.
    • After 0 was written, the SMC took both fans to 2500 rpm on its own.
  2. Maximum: both fans set to 3625 (F0Mx/F1Mx) ran at 3637/3639 rpm. 5000 was accepted and clamped to 3625 (same speeds). 0 returned both to 1000 rpm.

  3. Reboot and poweroff with fan 1 held at 2000 rpm: both times the next boot came up with both fans under SMC control at 1000 rpm (checked at 26 s uptime after the reboot, and after power-on). That boot used the stock DTB, which has no apple,fan-manual-control, so it could not have handed the fan back itself.

    • Caveat: a next-boot check cannot tell whether the driver's shutdown hook wrote the mode key, or whether the SMC resets fan mode across a reboot or poweroff anyway. Either way the fan is not left in manual mode.
  4. Regression counts (the trial boot): 0 failed units; SELinux is not enabled on this Arch install (0 avc: lines); kernel errors and warnings are the same as on the same kernel with the base DTB: 6 err lines, the cold-boot ASM3142 firmware probe (-2) and two DCP lane-count lines, and identical warning lines. No macsmc-hwmon lines.

  5. J775D: the commit message now says why J575c gets the flag and J775D doesn't. #7a479d4a41c9 (J714s) left J716s and J775D read-only until their fans were tested this way, so the reason is untested, not a known hardware difference.

Agreed on the follow-up: probing F%dMd and then F%dmd in the driver would drop these per-board overrides. That's for a separate PR.

Assisted-by: LLM (Claude:Opus 5.5)

@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.

Formal §1–§6 pre-PR checklist re-review at b56051f86b40ffa508c85767af3af723c6ede09c (dt-checks and host-tests: green; MERGEABLE / clean).

All blockers from the prior review at 0144e55b have been resolved cleanly on J575c (7.3.0-1-108 / integration/aurora e892113c7 + exact DTB diff):

  • §1 No model gating: Pass — DT-only per-SMC key override (F0md/F1md + apple,fan-manual-control on fan-F0Ac/fan-F1Ac), matching t6050-j714s.dts. Commit message now clearly notes J775D remains read-only only because it has not been tested this way yet.
  • §2 Production-ready: Pass — works on default kernel command line with no hacks; dt-checks and host-tests pass.
  • §3 Safety: Pass — zero hardcoded thermal/RPM limits in DT (macsmc-hwmon clamps to SMC-reported F0Mn/F0Mx and restores auto control on write-0/suspend/shutdown/unbind). Worst-case 15 min 84–85 W all-core load with both fans pinned at minimum (1000 rpm) peaked at 108 °C (below the 112 °C cpu-die trip), with 0 SMC trips/shutdowns/overrides, and writing 0 immediately handed control back (SMC ramped to 2500 rpm). Both reboot and poweroff with fan 1 held at 2000 rpm returned both fans to SMC control (1000 rpm) on next boot with stock DTB.
  • §4 Clean-room & attribution: Pass — single commit b56051f8 with human author/committer and human Signed-off-by: only, zero AI trailers in commit message, Assisted-by: at end of PR body.
  • §5 Evidence: Pass — complete J575c hardware verification covering min/mid/max (3625 -> 3637/3639 rpm), upper clamp (5000 -> 3625), auto release (0 -> 1000 rpm), s2idle restore, 15 min auto load, 15 min manual-minimum load, reboot/poweroff restore, and regression counts (0 failed units, SELinux disabled / 0 avc: lines, identical 6 baseline kernel error lines / warnings, 0 macsmc-hwmon messages).
  • §6 Naming: Pass.

Ready to merge.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide
RyanTheTide merged commit fccf8a5 into aurora-silicon:integration/aurora Nov 23, 2026
2 checks passed
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