Repository navigation
T6050 sleep: select irq/spmi/smc/sio/rtkit handling by hardware, not board - #2440
Draft
RyanTheTide wants to merge 6 commits into
Draft
RyanTheTide wants to merge 6 commits into
RyanTheTide wants to merge 6 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 availableapple,t6050-sleepnode. 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 whereverapple,t6050-pmp-v2runs.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-treewith its head 8407d40 merges cleanly.Details: per-gate table, DT evidence, kept gates, rows to run
apple,t6050-sleepavailableapple,t8142-spmi)apple,t6050-sleepapple,t6050-sleepsioalias the boot loader enables it by)Which DTBs have an available
apple,t6050-sleepnode: J714s and J716c only (J716c:t6050-j716c-sleep.dtsiships it disabled andt6050-j716c-sleep-full.dtsienables it). None of J714c, J716s, J775c, J775d, J873s, K114c, K114s, K116c, K116s. T8142 J813 hasapple,t8142-sleep, J815 has no sleep node.Behaviour differences, and why they are safe:
Kept on purpose:
Hardware rows (once on a T6050 board with the sleep):
dmesg | grep -i -E 'aic|spmi.*recovered|macsmc|sio'after oneecho mem > /sys/power/statewithmem_sleep= deep: same lines as on the current tip.dmesg | grep 'endpoint 7'shows no "refused auxiliary buffer request" after about 10 min of uptime.apple,t6050-sleepnode, 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)