Skip to content

mfd: macsmc: notifications, power supply and input on the T8152 J804 - #2111

Draft
LiamRay11 wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
LiamRay11:j804/smc
Draft

LiamRay11 wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
LiamRay11:j804/smc

Conversation

@LiamRay11

Copy link
Copy Markdown

Summary

The T8152 SMC registers only its hwmon cell, because notifications, GPIO and power management are not qualified on T8152. On the MacBook Pro (M6, J804), the SMC answers the same battery, adapter, lid and power-button keys as earlier Apple silicon laptops. This PR enables them on apple,j804 only. Other T8152 machines (J873g, J833ct) keep the telemetry-only profile.

Changes

  1. dt-bindings: mfd: apple,smc: the apple,t8152-smc description no longer says read-only telemetry only. The schema is unchanged.
  2. mfd: macsmc: the telemetry-only early return now also requires !of_machine_is_compatible("apple,j804"). On J804 the probe:
    • enables notifications (NTAP) and the wakeup source
    • registers the T6050 cell profile: input, power and hwmon
    • registers the described cells: the pcIO outputs (apple,smc-pcio-gpio, as "macsmc-gpio"), the low GPIO bank, and reboot and RTC only if the DT has nodes for them (J804 has none yet)

Why the T6050 profile and not the regular one

The regular apple_smc_devs list always adds a gP "macsmc-gpio" cell (apple,smc-gpio), even without a node. With the J804 pcIO node, apple_smc_add_described_devices() then registers a second "macsmc-gpio" device. The duplicate name fails with -EEXIST and takes the whole SMC probe down with it. The T6050 profile has no gP cell and leaves GPIO, reboot and RTC to the described cells, which is what J804 needs.

Why a machine check

The SMC compatible is the same on every T8152 board, so the J804 is selected by its machine compatible. gpio-macsmc does the same for the J700 pcIO path (of_machine_is_compatible("apple,j700")). If reviewers prefer a DT-driven switch, two options are a board-level SMC compatible with apple,t8152-smc as fallback, or a boolean property on the SMC node. Either needs a binding change, so this PR keeps the existing pattern.

Deviation from the bring-up patch

The bring-up tree gated all of T8152 off the telemetry path, registered the regular cell list with a single apple,smc-gpio cell, and added apple,j804 to the J700 pcIO path of gpio-macsmc. That path hardcodes the J700 lines 8 and 19, which are wrong for J804. Upstream now has the generic apple,smc-pcio-gpio provider with apple,output-commands, so J804 describes its output in DT (see the dt-board PR) and gpio-macsmc is not changed.

Testing

On hardware: MacBook Pro 14-inch (M6, J804), 2026-11-16, tested by LiamRay11.

  • What ran: kernel 7.3.0 built from integration/aurora bf423bf0e with all nine J804 linux PRs merged (t8152-mailboxes, dart-gen3, dt-board, centauri, g18-fast-retire, cfg80211-stale-scan, smc, cs42l84-jack, and an NVMe PR that is not sent yet), plus retest-only device-tree changes that are not part of these PRs: SSD nodes (ANS mailbox, SART, NVMe), PCIe port 0 with the N1 Wi-Fi, the USB0 gadget console, and a read-only NVRAM partition. Those nodes were needed to reach the root filesystem and SSH.
  • Booted through aura on the installed root filesystem. A systemctl reboot from this kernel (watchdog restart) returned to the installed system.

Results for this PR (draft):

  • The SMC probes with the T6050 cell profile and the pcIO output (no duplicate "macsmc-gpio" device).
  • macsmc-power reports AC (online) and the battery (status, capacity, cycle count).
  • 177 hwmon inputs.
  • The "Apple SMC power/lid events" input device registers. Lid and power-key events were not exercised (that needs the owner at the machine), and neither was sleep/wake through them. That is why this stays a draft.

Earlier, on an older base (integration/aurora f5fa539) with the bring-up variant (regular cell list, gP GPIO cell, J700 pcIO path): a lid close suspended through logind's lid switch, and the lid and the power button woke the machine from s2idle.

Checks on this base: drivers/mfd/macsmc.o builds with W=1 without warnings. apple,smc.yaml passes dt_binding_check. The macsmc KUnit test was not run.

integration/aurora has since moved to 677be395b; this branch still merges into it without conflicts.

Known limitations

  • The SMC wake-reason names used for T8152 are the T8140 table, which is not verified on T8152.
  • Reboot and RTC are not described for J804 yet, so they are not registered.
  • The fan stays under firmware control; the J804 tree only monitors it.

Dependencies

j804/dt-board describes the SMC node and its pcIO/hwmon children. The driver change itself has no dependency.

🤖 Generated with Claude Code

LiamRay11 and others added 2 commits November 16, 2026 10:46
The apple,t8152-smc description says the SMC offers read-only hardware
monitoring. On the MacBook Pro (M6, J804) the driver also enables
notifications, power and input, and the device tree may describe pcIO
outputs. Say so in the description. The schema is unchanged.

Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The T8152 SMC registers only its hwmon cell, as notifications, GPIO
and power management are not qualified there. On the MacBook Pro (M6,
J804) the SMC answers the same battery, adapter, lid and power button
keys as on earlier Apple silicon laptops, so on that board enable
notifications (NTAP) and register the input, power and hwmon cells.

The J804 uses the T6050 cell profile rather than the regular one. Its
GPIOs are pcIO outputs, described in the device tree and registered as
"macsmc-gpio" from apple_smc_described_devs. The regular profile always
adds a 'gP' "macsmc-gpio" cell as well, and the second device with
that name fails to register (-EEXIST), which fails the whole SMC probe.
Reboot and RTC are registered only if the device tree describes them;
the J804 tree does not yet.

The SMC compatible is the same on every T8152 board, so the J804 is
told apart by its machine compatible, as gpio-macsmc does for the
J700's pcIO path. Other T8152 machines keep the telemetry-only profile.

Tested with an earlier version of this change on an earlier base
(integration/aurora f5fa539), which used the regular cell profile and
a 'gP' GPIO cell instead of the pcIO outputs: macsmc-power reports the
AC adapter and the battery (status, health, cycle count, voltage,
design energy), a lid close suspends the machine through logind's lid
switch, and the lid and the power button wake it from suspend-to-idle.
This version, with the pcIO outputs, has not run on the J804. The
T8152 wake-reason names are not verified.

Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Test report, 2026-11-17: Apple Mac mini M6 (J873g/T8152, board 0x24). PR revision tested: 0664ebfdbf2715113295a4350a4d05dfc25f6e6d.

Host validation used the combined #2105–2108/#2110–2112 series (54742c617db4 on 677be395b9d2) with Clang 22. All changed driver objects built with W=1 and no new warnings; two pre-existing DART unused-helper warnings were unchanged.

macsmc.o built with Clang 22 and W=1 with no new warnings. The extended notification/power/input profile is J804-specific. It was not exercised on this J873g mini, so these results provide build coverage only for the new board-specific behavior.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, LiamRay11. Moving J804's pcIO output to apple,smc-pcio-gpio and explaining the duplicate "macsmc-gpio" -EEXIST are both clear and useful.

The one code ask is the machine check at drivers/mfd/macsmc.c:712-721 (!of_machine_is_compatible("apple,j804")). We select behaviour by hardware properties, not by the board it was tested on. Here a hardware property is already available: each cell in the T6050 profile detects its own hardware. macsmc-input returns -ENODEV unless the SMC has MSLD (lid) or bHLD (power button), macsmc-power registers only the battery and AC supplies whose keys answer, and GPIO, reboot and RTC register only when the DT describes them. So the suggested shape is:

  • Drop the T8152 telemetry-only early return and the machine check, and use the described profile for apple,t8152-smc as you already do for J804 (described = t6050 || t8152).
  • Reword the binding and the comment above apple_smc_telemetry_devs so they no longer say J804 only. The fan still stays under firmware control, because no cell writes fan keys.

That turns on notifications and the power button on the J873g and J833ct too, so the rows are:

  • J804: evtest on "Apple SMC power/lid events" shows SW_LID 1/0 on close/open and KEY_POWER on a short press. /sys/class/power_supply/ lists the battery (capacity, status, cycle count) and AC (online follows the cable). The hwmon input count is unchanged (177). hwclock -r once the RTC node is described.
  • J873g (@sithglan, if you can): evtest shows KEY_POWER on a short press, no lid switch, no new SMC errors in dmesg, and the same hwmon count as before.

After that we will run the macsmc no-regression rows on our A18 Pro (Neo) and M4 Pro.

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