Skip to content

T6050 sleep: select irq/spmi/smc/sio/rtkit handling by hardware, not board - #2440

Draft
RyanTheTide wants to merge 6 commits into
integration/aurorafrom
spec-m5neo/t6050-sleep-gates
Draft

RyanTheTide wants to merge 6 commits into
integration/aurorafrom
spec-m5neo/t6050-sleep-gates

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem: the T6050 (M5 Pro/Max) deep-sleep handling in the AIC, SMC and SIO drivers is switched on by board name (J714s, J716c), the SPMI gen4 recovery by a list of four boards, and the PMP v2 CoreAnalytics ack by the J714s alone. These are the boards it was run on, not a hardware property, so a board that gains a sleep description (K116s in #2201, K114c in #2089) also needs code edits.

Change: a small helper in <linux/soc/apple/sleep.h>, apple_t6050_sleep_described(), is true when the device tree has an available apple,t6050-sleep node. The AIC save/restore, the SMC saved-context path and the SIO T6050 description now use it. Only the J714s and J716c trees have that node, so on every board in the tree today nothing changes. The SPMI gen4 FIFO drain is the controller's behaviour, so it now applies to every gen4 controller. The PMP v2 ack now applies wherever apple,t6050-pmp-v2 runs.

Testing: W=1 compile of irq-apple-aic.o, spmi-apple-controller.o, macsmc.o, apple-sio.o and rtkit.o (release config, clang) at base and with this branch: all build, no code warnings before or after. DTBs: every T6050/T8142/T8152 .dts compiled with cpp+dtc and checked for the selecting node (table below).

Still to run: none of this has run on T6050 hardware yet. @DjDeveloperr @erikwb, could you give a J714s and J716c row (one deep sleep plus resume, and the checks below)? A K116s row from whoever has one would show the board gains the handling once it has #2201. This is a draft until those rows are in.

Related: #2384 also edits macsmc.c (the J813 check just below this one) and sleep.h. The hunks do not overlap, and git merge-tree with its head 8407d40 merges cleanly.

Details: per-gate table, DT evidence, kept gates, rows to run
Gate (at 0abc2f3) Old selector New selector Boards before Boards after
irq-apple-aic.c:343 j714s, j716c apple,t6050-sleep available J714s, J716c J714s, J716c
spmi-apple-controller.c:243 j714s, j716c, j813, j815 every gen4 controller (apple,t8142-spmi) J714s, J716c, J813, J815 all T6050 + T8142 trees
macsmc.c:650 t6050 && (j714s or j716c) && t6050-smc t6050-smc && apple,t6050-sleep J714s, J716c J714s, J716c
apple-sio.c:705 j714s apple,t6050-sleep J714s J714s, J716c (the SIO only probes on J714s: only J714s has the sio alias the boot loader enables it by)
rtkit.c:2277 pmp-v2 && j714s pmp-v2 J714s J714s, J714c, K116s (trees with the PMP enabled)

Which DTBs have an available apple,t6050-sleep node: J714s and J716c only (J716c: t6050-j716c-sleep.dtsi ships it disabled and t6050-j716c-sleep-full.dtsi enables it). None of J714c, J716s, J775c, J775d, J873s, K114c, K114s, K116c, K116s. T8142 J813 has apple,t8142-sleep, J815 has no sleep node.

Behaviour differences, and why they are safe:

  • SPMI: this only changes anything after a failed exchange. Before, every later command on that controller failed until reboot. Now the driver waits one command timeout and reads out at most 64 stale words. If the FIFO does not empty, it keeps the failure as before. Boards that gain it: J714c, J716s, J775c, J775d, J873s, K114c, K114s, K116c, K116s, J704. J815 keeps it, even though it has no sleep node, which shows the drain is not tied to the sleep.
  • PMP v2 ack: only the exact all-zero CoreAnalytics event gets the zero ack. Before, that event got the "refused auxiliary buffer request" error and no answer. All other words are handled as before.

Kept on purpose:

  • macsmc.c:653: the J714s wake-reason table is that board's SMC numbering. It is board data, not a capability.
  • gpio-macsmc.c:531 (J716s N1 power line on the J713 reg-on path) and macsmc-input.c:259 (J716s lid settle) are not about the T6050 sleep. The first is board wiring that shares a T8132 board list; the second is a workaround for something measured on one board. They are not in this PR.

Hardware rows (once on a T6050 board with the sleep):

  • dmesg | grep -i -E 'aic|spmi.*recovered|macsmc|sio' after one echo mem > /sys/power/state with mem_sleep = deep: same lines as on the current tip.
  • J714s/K116s with PMP: dmesg | grep 'endpoint 7' shows no "refused auxiliary buffer request" after about 10 min of uptime.
  • J616s (T6040), M1 Pro, M2, Neo (T8140): not reached (no apple,t6050-sleep node, no gen4 SPMI, no PMP v2). Boot and check there are no new SPMI/AIC messages.

Original work: the T6050 sleep handling is DjDeveloperr's; the J716c extension is Erik Bourget's; the M5 Air SPMI extension is from @m0d16l14n1.

Assisted-by: LLM (Claude:Opus 5.5)

Several drivers select their T6050 (M5 Pro and Max) deep-sleep handling
with a list of boards, the ones the sleep has run on (J714s, J716c). What
those boards have in common is in the device tree: an available
sleep-controller node, compatible "apple,t6050-sleep". No other board in
the tree has one; a board gains it with its sleep description.

Add apple_sleep_described(compatible), true when an available node with
that compatible exists, and apple_t6050_sleep_described() for
"apple,t6050-sleep". Both are static inline and independent of
CONFIG_APPLE_SOC_SLEEP, as the board checks they replace are.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The AIC3 save and restore over a T6050 deep sleep were registered on the
J714s and the J716c, by board name. The reason is the sleep: its last
steps mask every interrupt and acknowledge events by hand, so the
controller's configuration has to be saved and put back around it.

Register them where the device tree describes that sleep
(apple,t6050-sleep). In the tree today that is the J714s and the J716c
only, the boards the list named, so nothing changes; another board gets
them with its sleep description.

Fixes: 55b73f1 ("irqchip/apple-aic: keep the T6050 controller over a J716c deep sleep too")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
After a failed exchange a generation 4 controller drains its reply FIFO
(a late reply, or a stray word read in a reply's place) before the next
command, so no old reply can answer a new command. This was enabled on
the J714s, J716c, J813 and J815 by board name, because their deep sleep
writes the PMU on the same queue. Every other generation 4 machine
refused all later commands after one failed exchange, until reboot.

The drain is the controller's FIFO behaviour, not a property of the
board, and the J815 already shows it is not tied to a sleep description
(it has none in the tree). Do it on every generation 4 controller
("apple,t8142-spmi", the T6050 and T8142 machines).

On a machine where no exchange fails nothing changes. The machines that
gain it (J714c, J716s, J775c, J775d, J873s, K114c, K114s, K116c, K116s,
J704) behave differently only after a failed exchange: they wait one
command timeout and read out at most 64 words, and keep the failure if
the FIFO does not empty, instead of failing every later command.

Fixes: e6b75c3 ("spmi: apple: J714s: recover from a failed exchange on a generation 4 controller")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…tion

The SMC's saved-context transport for the T6050 firmware sleep was set
up on a machine that is "apple,t6050" and "apple,j714s" or "apple,j716c".
It belongs to the sleep, so set it up for an "apple,t6050-smc" where the
device tree describes that sleep (apple,t6050-sleep): the J714s and the
J716c in the tree today, so nothing changes.

The J714s wake-reason table stays keyed on the board: it is that board's
SMC numbering (its SD reader and keyboard bits), board data rather than
a capability.

Fixes: 30f95ff ("mfd: macsmc: the T6050 saved-context path on the J716c")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…tion

The T6050 SIO description (stopped by the sleep's commit, channel words
from the DT) was in force on the J714s only, and the node was taken by
its generic compatible elsewhere. Its commit stop belongs to the T6050
sleep, so use it where the device tree describes that sleep
(apple,t6050-sleep).

Today the SIO only probes on the J714s: every T6050 tree ships the node
disabled, and the boot loader enables it through the "sio" alias, which
only the J714s has. The J716c, the one other board with the sleep
described, has the same split SIO description, disabled and without
the alias. So nothing changes on any board.

Fixes: ed190a0 ("dma: apple-sio, soc: apple: T6050 SIO, AOP and AOP2 for the sleep")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…r it runs

The T6050 PMP v2 firmware sends an all-zero CoreAnalytics event on its
auxiliary buffer endpoint some minutes after it starts. On the J714s it
is acknowledged; on every other board the driver logs "refused auxiliary
buffer request" and leaves the firmware without an answer. The event is
part of the firmware's protocol, not of the board, so acknowledge it
wherever "apple,t6050-pmp-v2" runs.

This changes behaviour on the other boards whose tree enables the PMP
(J714c and K116s): that one exact message gets the zero acknowledgement
instead of the refusal. Every other word on the endpoint is handled as
before.

Fixes: 6a9d6bf ("soc: apple: rtkit: J714s: acknowledge the PMP's CoreAnalytics event")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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.

1 participant