Skip to content

soc: apple: sleep: T8122 firmware-sleep data, without gates - #2746

Draft
satchlj wants to merge 6 commits into
integration/aurorafrom
soc-apple/t8122-sleep-data
Draft

satchlj wants to merge 6 commits into
integration/aurorafrom
soc-apple/t8122-sleep-data

Conversation

@satchlj

@satchlj satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf.

The gate-free part of #2572: T8122's firmware-sleep data on the shared Apple sleep framework, its apple,t8122-sleep node in t8122.dtsi, its Kconfig and KUnit coverage, and the macsmc and asahi g17 sleep hooks it needs.

Selection. The sleep controller's compatible alone. No board match, no firmware-version check, no module parameter: the trial knobs from #2572 (t8122_wdt_secs, t8122_wdt_clear, t8122_disp_off, t8122_console, t8122_keep_debug_link, t8122_witness_full, t8122_witness_sep_asc, t8122_match, t8122_atc_off, t8122_wake_mask, t8122_quiet, t8122_dry_regs, and the framework's new untested_hold) are fixed at their defaults.

Behaviour. The SoC is marked untested, so the framework keeps its sleep commit off, as for every untested SoC: a firmware sleep runs the dry path and returns. Nothing commits on the default command line, on any T8122 board (J433, J434, J504, J613, J615).

Not in this PR. The DCP cold stop keyed on the 26.6 firmware and the commit enablement stay in #2572 (draft) until a real resume works on J613. Today every trial commit there ends in a watchdog cold reset, and whether the SoC powers down after the commit is still being measured.

Testing. Built with W=1 for arm64 (drivers/soc/apple/, drivers/mfd/, drivers/gpu/drm/asahi/), no errors. Not yet booted in this exact form; a default-cmdline boot and dry-run sleep on J613 is the next step.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

…work

The T8122 sleep controller's data on the shared Apple sleep framework,
selected by its compatible, its DT node, and the driver hooks it needs
(macsmc, asahi g17). The SoC is marked untested, so the framework keeps
its commit off as for every untested SoC; this adds no module parameter
and no board or firmware-version selection.

Signed-off-by: Satya Benson <satya@benson.earth>
…not armed

Drop the J613 prefix from the driver's messages and the comment that
named a removed parameter.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. Asking for a boot of this exact head (2465452) on a T8122 board from Ryan's lane (J615), default command line: does it boot to userspace, and does the sleep controller probe (apple-sleep ... sleep-controller lines, /sys/power/mem_sleep)?

What I see on J613 so far: booting this tree from RAM through the Aura chainload trial (an integration/aurora-tip kernel, with or without this PR's changes on top, under the fixed trial DT or the tree's own t8122-j613.dtb) resets the board about 3 minutes after the chainload starts, right at Aura's hand-over, with no Linux console output at all. Kernels on the older diagnostic base boot the same way with full output. So this may be a base-tree issue on that boot path rather than this PR; a normal installed boot on J615 would separate the two.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Read at 2465452. Splitting the gates out of #2572 was the right move, and the selection is now the sleep node's compatible only. The register data is your own measurement of a macOS sleep on the J613, so it's fine to have in the tree. My concern is with what lands, not where the numbers came from:

  • Nothing in this PR does anything on a default boot. The SoC is untested, so every sleep is the dry run. Deep sleep is offered only with apple_sleep.deep=1, a commit only with apple_sleep.untested_commit=1, and the match only with CONFIG_APPLE_SOC_SLEEP_T8122. What merges is ~1500 lines whose only effect is a dry run, plus the four-point witness against macOS's commit words (t8122_ps_macos[], t8122_witness_macos_dc(), the debug-console dump). That witness is qualification instrumentation. It belongs on the trial branch until a real resume works, and then only the parts the working sleep needs should land.
  • T8122_PS_* and the "every power word J613's device tree names" table repeat offsets that the PMGR power-state nodes in t8122.dtsi already carry in reg. The sleep code can take them from the tree (by phandle or by walking the pwrstate nodes), so the next T8122 board, or the next SoC, doesn't need a new table.
  • The Kconfig help still says "The driver binds only on J613". The description says the match is the compatible on every T8122 board. Please make the help match the code, since a board-limited bind is exactly what this PR says it has removed.
  • g17/sleep.c: M3_GFX_OFF_WAIT_MS = 3000 with a 20 ms poll. Say where 3 s comes from (the longest measured GFX power-off plus margin), or wait on the domain's state change instead of a fixed budget.

My suggestion: keep this as a draft beside #2572 and merge it together with the commit enablement once a J613/J615 resume is shown, with the witness reduced to what the working sleep logs. Until then, a default-cmdline boot showing the dry run refuses cleanly on J613 and J615 (nothing written, no new errors) is the row this head still owes.

Assisted-by: LLM (Claude:Opus 5.5)

…ith the node

The help still said the driver binds only on J613; the match is the
sleep controller's compatible.

Signed-off-by: Satya Benson <satya@benson.earth>
…nd say the bound is not measured

The 3 s only limits how long .prepare waits before it refuses; a GPU
still on refuses the sleep and nothing is forced.

Signed-off-by: Satya Benson <satya@benson.earth>
…l branch

Drop the four-point witness against macOS's commit words (the power-word
and macOS tables, the coprocessor control reads, the debug-console dump
and its progress marks): it is qualification instrumentation, not part
of the sleep. The DISP_CPU refusal and the per-SoC power lists stay.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. Status on your four points (head 4891dfe):

  1. Witness: removed (380 lines: the power-word and macOS tables, the coprocessor control reads, the debug-console dump and its progress marks). The DISP_CPU refusal and the per-SoC power lists stay. It remains on the trial branch.
  2. Kconfig: the help now says the match binds on any T8122 board whose DT enables the apple,t8122-sleep node.
  3. g17/sleep.c: the wait is readl_poll_timeout on GFX's own state change; the comment now says the 3 s is not a measured power-off time, only the bound before .prepare refuses (nothing is forced).
  4. Power words from the DT: agreed, and every offset in use resolves to a labelled apple,t8122-pmgr-pwrstate node in t8122-pmgr.dtsi. But several sit in the shared framework's const SoC data (.disp, .sep, .ans, .apcie_sys_gp, ps_macos_on/off), which the framework reads itself. Doing it properly means the framework naming power words by label and resolving them at probe, for every SoC on it, not a T8122-local table swap. I'd do that as its own framework PR first and rebase this onto it; say if you'd rather see it in here.

On the boot row this head owes: J613 RAM-trial boots of tip-based kernels are now run with the SEP initcall blacklisted (the tip's SEP driver has no read-only xART mode), confirmed per row by the SEP platform device being absent. That row will therefore not be the default command line, and it cannot cover a suspend with the SEP bound; I'll say so with the result.

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

J613 boot row on #2746 (RAM boot, SEP disabled, disk read-only): the driver bound, deep sleep was offered with apple_sleep.deep=1 (mem_sleep=[s2idle] deep, commit off), and the trial reached its end cleanly. No sleep was entered.

The trial delta, so the row isn't read as a default-config result:

  • the sleep node is status = "disabled" in t8122.dtsi and the J613 DTS doesn't enable it, so the row used a trial DTB with it enabled;
  • CONFIG_APPLE_SOC_SLEEP_T8122 isn't in asahi.config; it was turned on in the build only;
  • a trial-only commit (not part of this PR) adds a debug-cable console and a fixed WD1 time;
  • cmdline: initcall_blacklist=__apple_sep_init apple_sleep.deep=1 plus our trial arguments.

So on a default build this PR doesn't bind on J613, which matches its Kconfig help. Default-cmdline behaviour isn't shown by this row.

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

One more gap for J613, beyond the disabled node: with the sleep node enabled in the tree's own t8122-j613.dtb, probe fails with -ENODEV: no display coprocessor 0. No J613 DT file here sets apple,display-coprocessors or apple,debug-port on the sleep node. Adding both (to dcp@28ec00000 and spmi@2e4908000/usb-pd@c) in the trial DTB makes it bind. The earlier J613 row bound only because its trial DTB already had them.

The T8122 sleep driver's probe needs the display coprocessor it lowers
(apple,display-coprocessors) and the port controller behind the debug
port (apple,debug-port). Without them, enabling the node on J613 fails
with -ENODEV. The node itself stays disabled in t8122.dtsi.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Pushed a4905c2: t8122-j613.dts now gives the sleep node apple,display-coprocessors = <&dcp> and apple,debug-port = <&hpm0>. Compile-checked; the node itself stays disabled in t8122.dtsi.

On "disabled in qualification": this isn't meant as a gate. The node and APPLE_SOC_SLEEP_T8122 become default-on when one row shows a Linux-entered deep sleep on J613 that both powers the SoC down and wakes back into Linux. Today a Linux commit is accepted, but there's no evidence the SoC powers down afterwards; that's the open question in the trials. Until then, enabling it would offer a deep sleep that doesn't return. If you'd rather it go in enabled now, with deep sleep still behind apple_sleep.deep=1 (off by default), I can flip both in this PR.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of a4905c2.

Earlier points:

  1. Witness: removed, thanks. Keeping the rest as a draft until a Linux-entered sleep powers the SoC down and wakes is fine with me. A few trial leftovers are still there, see below.
  2. Power words from the DT: not fixed (sleep-t8122.h:40-51, :92-101). Doing it as a framework PR first, with the power words named by label and resolved at probe for every SoC, and rebasing this onto it is the right order. Please do that rather than a T8122-only swap.
  3. Kconfig help: fixed.
  4. GFX wait: fixed (g17/sleep.c:758-762, :834).

New:

  • sleep-t8122.h:67-86 freezes the trial switches as constants: t8122_match (the & 2 and & 4 branches at :437-477 can't run), t8122_wake_mask = 0 (the wake arm at :256 and :495 is dead), t8122_quiet, t8122_dry_regs, t8122_keep_debug_link, t8122_atc_off, t8122_wdt_secs/_clear and t8122_disp_off. sleep.c:1164 adds sleep_untested_hold, which is always false, together with its hold path at :5491. Please take out the branches that can't run, and turn each value that stays into plain code with a comment saying why.
  • drivers/mfd/macsmc.c:20: the new #include <linux/moduleparam.h> and the blank line at :59 are all that is left in that file. Please drop them.
  • t8122.dtsi:555-586: the node still lists a dockchannel reg, and the comment still mentions "the late witness". Nothing maps dockchannel any more. The comment also says the node is "for a trial's device tree only", which doesn't fit what you said about it not being a gate.
  • There is no apple,t8122-sleep binding. T8140 and T6050 have one under Documentation/devicetree/bindings/soc/apple/, so dtbs_check will flag the new compatible and its apple,wake-enable, apple,display-coprocessors and apple,debug-port properties.
  • a4905c2 adds the probe references only to t8122-j613.dts. &dcp comes from t8122-dcp.dtsi and &hpm0 from the shared usbpd dtsi, so on J615 (and the J433/J434/J504) the node still fails probe with "no display coprocessor 0" once it is enabled. Please move apple,display-coprocessors to t8122.dtsi, and apple,debug-port to t8122-j613-j615.dtsi if J615's debug port is the same hpm0.

Assisted-by: LLM (Claude:Opus 5.5)

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.

2 participants