Skip to content

mfd: macsmc: T6050 power, reboot, RTC and sensors, and ac_power_mode - #941

Merged
DjDeveloperr merged 4 commits into
integration/aurorafrom
j716c/t6050-smc
Nov 9, 2026
Merged

DjDeveloperr merged 4 commits into
integration/aurorafrom
j716c/t6050-smc

Conversation

@erikwb

@erikwb erikwb commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

On T6050 the SMC only registered input, power and hwmon, so a kernel that owns the machine had no restart, power-off or RTC: poweroff halted Linux and left the machine on.

  • DJ's T6050 consumer profile: pcIO GPIO outputs, power-supply identity and charging policy. This is his commit from mfd: macsmc: Support T6050 power and pcIO consumers #479, without its APIF test scripts; its one conflict is with b8e84d0, which already stopped the probe-time charge writes for every SMC, so the T6050 exception for them isn't needed.
  • The reboot and RTC cells, registered only where the DT has their nodes.
  • hwmon: discovered temperatures can join the SoC die zone (it used to fail probe with -EINVAL when both properties were set).
  • macsmc-reboot's ac_power_mode attribute, changing only the PMU's two policy bits: off, restore, and on at connect.

Commits by Dj and Jeff Queisser. On J716c (MacBook Pro 16-inch, M5 Max) this runs as part of the full T6050 stack (j716c/t6050-platform): the machine boots to userspace from NVMe with all 18 CPUs, N1 Wi-Fi up and CPU frequency scaling active.

Created with Claude Opus 5.5 in Claude Code.

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

Works on the M5 Pro (MacBook Pro 14", J714sAP, T6050), bare metal. This head (ae0ce64), three boots:

  • RTC: macsmc-rtc is rtc0, sets the system clock, and reads the right time.
  • Reboot: reboot -f gives Preparing for reboot (rest), Preparing SMC for atomic mode and Issuing restart (phra), and the machine restarts (the debug link drops within a second).
  • ac_power_mode: present, since the T6050 DT gives the reboot node its pm_setting cell. It reads off restore [always], and writing restore, then always, reads back each time. I left it as found.
  • Power and sensors: macsmc-ac (online), macsmc-battery (Full, 100), 277 hwmon inputs, macsmc-gpio, and the lid/power input.

Not tested: poweroff (this rig can't power the machine back on).

Merge note: this head conflicts with current integration/aurora in apple,smc-pcio-gpio.yaml, apple,smc.yaml, gpio-macsmc.c and macsmc.c. Integration has d19e2e0's and 962c176's pcIO binding and newer macsmc changes. For the test I resolved them keeping both sides.

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

This conflicts with current integration/aurora in the apple,smc and apple,smc-pcio-gpio bindings, drivers/gpio/gpio-macsmc.c and drivers/mfd/macsmc.c (the T6050 compatibles added in e0b7106 and later). Could you rebase it? No CI has run on this branch yet; the push after the rebase will run dt-checks and the host tests.

DjDeveloperr and others added 4 commits November 9, 2026 09:49
Add the T6050 SMC consumer profile, described pcIO GPIO outputs, power-supply identity sizing, and charging policy. Preserve the newer shared SRAM accessor and metadata serialization.

Source snapshot: t6050-gpu ee68abb105200e99636a5edfc647a5cfc1d89954
Integration base: 9cbdd07

Signed-off-by: Dj <hey@djdev.me>
Signed-off-by: Erik Bourget <erik@ebourget.net>
The T6050 profile (Aurora's t6050/smc) registers input, power and hwmon
only, so a T6050 kernel that owns the machine (J775D on bare metal) had
no SMC restart or power-off and no RTC: poweroff halted Linux and left
the machine on.

Add macsmc-reboot and macsmc-rtc to the T6050 profile as cells that are
registered only where the device tree has their child node, the rule
the pcIO outputs and the second GPIO bank already follow; those two
blocks become one table and one helper. A T6050 device tree without
reboot or rtc children registers exactly what it did,
and other SMCs are unchanged (same cells in the same order; the
registration failure messages now name the cell).

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Erik Bourget <erik@ebourget.net>
apple,soc-die-keys adds a "SoC die <key>" channel per listed key for the
macsmc_soc_die zone, and apple,discover-temperatures refuses to run once
any temperature channel exists, so a machine that discovers its
temperatures (T8142, J775D) could not have the zone: the probe failed
with -EINVAL.

With discovery, a listed key now adds no channel; the channel discovery
creates for it (labelled with the key) is marked for the zone instead.
Machines that set only one of the two properties are unchanged.

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Erik Bourget <erik@ebourget.net>
Expose the PMU's power-on policy byte as the ac_power_mode attribute
Asahi's downstream driver had, with a third mode. The byte has two
policy bits: bit 0 keeps the machine off when power returns after a loss,
bit 5 keeps it off when power is connected. Asahi's driver wrote the whole
byte (0x02 restore, 0x03 off), which clears bit 5: on machines whose PMU
powers on at connect that write means "always", the opposite of "off".
Change only the two bits and leave the rest to the PMU:

  off      bit 0 and bit 5 set
  restore  bit 5 set, bit 0 clear
  always   bit 5 clear (bit 0 set)

The pm_setting cell is optional; the attribute appears only with it.
The binding takes it as a fifth cell, as the t600x/t602x device trees
already list it.

Based on Asahi's ac_power_mode (marcan).

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Erik Bourget <erik@ebourget.net>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Rebased onto integration/aurora (8d98b7a), as asked in the review. The old head ae0ce64 is kept as backup/j716c/t6050-smc-pre-rebase-20261109. Authors and Signed-off-by lines are unchanged.

What changed in the conflict resolution (git range-diff):

  • c0684cc: integration already has apple,smc-pcio-gpio.yaml (d19e2e0) and the pcIO oneOf in apple,smc.yaml, so this commit no longer adds them. gpio-macsmc.c keeps integration's J700 pcIO path beside the new apple,smc-pcio-gpio output chip, and the chip returns -ENODEV when a board gives no apple,output-commands.
  • ae0ce64: integration's SMC binding already has the reboot node's pm_setting cell, so only the driver and ABI parts remain.
  • a90718d is patch-identical, and b472f09 changes only in context.

On this head, gpio-macsmc.c, macsmc.c, macsmc-reboot.c and macsmc-power.c are byte-identical to the M5 Pro's default SSD kernel (test/m5-integration), where RTC, phra restart, ac_power_mode and the power supplies were checked. macsmc-hwmon.c differs from it only by integration's own newer hwmon changes (#1331 and earlier); this PR's hwmon commit is patch-identical. CI is running on the new head now.

🤖 Generated with Claude Code

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Retested before merging on the M5 Pro (J714sAP, bare metal, SSD boot), kernel 7.3.0-m5-merge: the M5's integration kernel with this round's rebased heads in place of the old ones (every PR's own patch identical to what is merged; logs in work/m5-pr-merge-20261109). CI green.

Before merging, this round (these 14 PRs, #1323 and the rebased #1254/#1306/#938/#1316/#1199) was test-merged in order onto integration/aurora f9cf6f9 with no conflicts: apple-dt-check.sh 414 → 414 warning lines (0 new) over 137 DTBs, all 20 changed bindings pass, and a local host-test run fails only where integration itself fails with this host's newer toolchain. A full arm64 build of the same set on 8d98b7a was clean.

  • macsmc-rtc is rtc0 with the right time; ac_power_mode reads off restore [always]; AC (online) and battery (Full, 100) supplies, 282 hwmon inputs; systemctl reboot restarts the machine through the SMC (4 reboots in the session).

🤖 Generated with Claude Code

@DjDeveloperr
DjDeveloperr merged commit 040be05 into integration/aurora Nov 9, 2026
2 checks passed
@DjDeveloperr DjDeveloperr mentioned this pull request Nov 9, 2026
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