Repository navigation
Conversation
This was referenced Nov 14, 2026
Each step the bring-up added to the commit, the wake return and the suspend callbacks got a parameter to switch it off again. All of them are on in the configuration that sleeps and wakes on the J616s: the generic PMGR quiesce with the GPU's TVMs, the early release of the stopped CPUs, the wait on the DISP_INT and DISP_EXT complexes, the AGX residency gate, the keep-alive bits, the external debug release before a core's last WFI, the SIO power words raised again after the wake, the second storage lane's SYS domain, ANS's fabric bridge, the wake stub, the ATC complexes and the GP PCIe ports, the display power words, the PMS DCP voters, the PMC display interfaces, and the DCS words' dynamic power gating and automatic mode in .begin. A display pipe's CPU word never counted as on. Remove the parameters and run the steps always, with the same writes in the same order. The DCS words that do not read on before they are put in automatic mode are now named in a warning; nothing logged them before. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…alues Seven steps were steered by a mask or a mode parameter, each bit one stage of the bring-up. The values the J616s sleeps and wakes with are the defaults: - the axi2af bridges are re-armed where a domain's power word reads target 0xf and is on; - the AOP island's power words are put back at the wake, those that were on before the sleep at a manual target 0xf; - the storage PCIe is quiesced in this order: the shared PHY to sleep, APCIE_PHY_SW clock-gated, the PLL off, and APCIE_GP is left clock-gated instead of off; - the fabric power words are raised to automatic mode with target 0xf, the four ATC commons are raised under FAB2_SOC, and every ATC port that has not asked for its clock gate gets the PHY's sleep entry; - the wake raises the storage PCIe domains in order with both fabric bridges, APCIE_PHY_SW and the reference PLL wait, and leaves APCIE_SYS_GP at a manual target; - both GP PCIe ports get their clocks back at the wake; - SMC key pmVC is written 0x101 in .begin. Remove the parameters, the stages that were off (the T8140 order of the PHY and clock quiesce and of the wake raise, the automatic level write and the hand-held fabrics, the record of the PCIe quiesce) and keep the rest as plain code with the same writes in the same order. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…nd dumps The bring-up watched a sleep through instrumentation that outlived it: - progress marks written into the PMU's RTC comparator from the driver, from the PM core's per-device hook and from a panic notifier, and the wake alarm saved and put back around them. They were off by default (a mark takes the alarm's place), so the alarm was never touched; - records in the PMU's scratch memory: the map of power words that are on, the ATC PHY blocks, the AOP island at the wake, the storage PCIe raise, the pmVC key. Nothing in the kernel reads them back; - the reads that only fed them: the comparator at probe, the A2D, AOP and ANE state at probe and in a dry run, the axi2af mask and the AOP's ASC control word in the commit and at the wake, and the pmVC key before and after its write; - the parameters that logged the ATC PHY blocks or wrote pmVC on demand, and the debugfs file that wrote a display power word. Remove them, with the parameters, windows, struct members and the syscore and panic hooks that served nothing else. Every poll keeps its place and its bound; its result is dropped where only a mark took it. The barriers that came before each mark of the wake return stay, as t6040_wake_sync(), so that the order and the timing of that path are as tested. apple_sleep_bringup_mark() stays as an empty function for the display and GPU drivers that still call it. What the wake needs is kept as plain code. The SIO power words that were on at the commit are saved in memory and raised again; only that range is read now, not every power word of the SoC. The AOP island's words are put back as before. A failed storage PCIe raise, a GP PCIe clock that does not come back and an AOP power word that stays off were only visible in a record: each is a warning after the wake now, as is a failed pmVC write. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
A sleep and wake of the J616s logged some sixty lines from this driver at info level: the blocker list of a suspend that was not refused, the state of every display group, the coprocessor count, each power word raised again after the wake, the axi2af domains that were on or gated, the PMC interfaces put back, the mailbox's resume count, and at probe the S2R state, the keep-alive bits, the GP PCIe windows and the wake stub. Print at info, warn or error only what a user has to see: why a suspend is refused, what a dry run finds, and what went wrong (a display power word that stays on, an SIO power word that does not come back, a wdt block the wake stub cannot restart). The rest goes to debug level. The keep-alive bits are no longer read at probe: they were read for the log alone. The line of a display group that is off and the blocker list of a suspend that goes ahead are dropped or moved to debug as well; a refusal still prints both. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
With the parameters and the instrumentation gone, several comments still described them: the PMC votes and the PTD request of the display pipes, which the driver only reads or restores, the power word helpers of the T8140 order, and stages named after the bring-up steps that found them. Say what the code does: the file header names the commit and the wake return and the four parameters that are left, sleep_wd_secs gives its real default of 30 s, the comments on the kept steps name the hardware and what was measured on the J616s, and the comment on the display power words stands at its function again. A second definition of PS_BUSY goes. The Kconfig help says what a sleep with allow_entry does. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Two module parameters guarded what the driver puts back after a firmware-driven suspend: resume_cached let a block with a register cache take part, and resume_all let a block marked apple,resume-restore-all get every pin and its global word back. Both were on, and the J616s wakes with its keyboard, trackpad and panel only that way. The driver now always does both. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Nothing calls apple_sleep_bringup_mark() any more and the T6040 controller keeps no marks: remove its empty definition and the declaration. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…it point Dry run 1 suspended the devices without marking the suspend as a firmware-driven one. The PMU RTC refuses such a deep sleep in its .prepare, as it has no way to bring an alarm back from it, so the run ended there with -EBUSY and never parked a CPU. The other two levels cover everything it was meant to show: both park the CPUs and hold them at the commit point. Remove it and number the remaining levels 1 and 2. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…e code One named the T8140 driver's routine by a pull request number, the other said the driver waits for more data on the T6040 commit and wake. Both are known and in this file; say why it is a controller of its own instead. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The driver takes what differs between SoCs from lists: power words, the order that was measured, wake sources. A SoC whose sleep entry and wake return differ in more than that has no place in it. Add one pointer to the match data, a part with its own probe and an optional restore from a hibernation image. Where it is set the driver's probe hands over to it before any of its own conditions, and the driver's new restore callback calls the part's. A part also carries its own two answers for the coprocessor and enclave registry, and the driver binds them around the part's probe, as it binds its own for a SoC that it sleeps from its lists. No SoC sets a part yet, and the T8140 sleep is unchanged: its probe only gains the test, and its restore returns 0. The boot object's mailbox layout moves to the private header that such a part shares. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
A SoC's part keeps its own state and suspend operations, and the registry of coprocessors and of the enclave has to serve it as it serves the driver's own sequences. The last check, the enclave's stop and the two stop passes take the device to log for and where to note a ready ANS, instead of the driver's state. The check that every registered coprocessor is ready moves out of the refusal into a function of its own, and the registry can list itself for a debugfs file. The T8140 sequences are unchanged: the same calls in the same order with the same log lines. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The SMC's driver tells this driver how the lid reads at each wake, and the USB host's which hub ports may wake the system. The display and the port controllers ask for both, and act on the answers: the internal panel stays dark for a closed lid, a port is armed for wake. A SoC's part whose sleep was never run with either must not start to take them just by being built into this driver. Let it say so at its probe: apple_sleep_lid_closed_at_wake() then returns -ENODATA and apple_sleep_usb_port_can_wake() false, as both do in a kernel without the driver. No part sets it yet, and nothing changes on the T8140. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 sleep controller's node is in the SoC's file, so every T6040 board has it, while its sleep has been run on the J616s alone. It maps fixed T6040 blocks and installs suspend operations that make deep the default state and then refuse it without t6040_sleep.allow_entry, which is of no use on a board nobody has tested, and distribution kernels build the controller. Disable the node in t6040.dtsi and enable it in t6040-j616s.dts. On the J614s and the J773s the controller no longer binds: suspend-to-idle stays their sleep, and the debugfs preflight file is gone there. The interrupt controller saved its configuration for a sleep on every apple,t6041-aic3 whenever the controller was built. Key that on the enabled node as well, so that the other machines with this AIC keep their suspend and hibernation paths as they were. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 controller was a driver of its own, t6040-sleep.c, next to the generic sleep driver: two platform drivers, two sets of suspend operations and two bindings to the registry in one kernel, of which one binds. Make it a part of the generic driver. The file becomes sleep-t6040.c in the same object, matched through apple,t6040-sleep with its own probe and restore. It keeps its state, its suspend operations and every sequence as they were, suspend-to-idle passing through untouched and deep offered only with t6040_sleep.allow_entry included. Its platform driver and its own walks of the registry go: it calls the generic driver for the readiness check, the last checks, the enclave's stop, the stop passes and the preflight listing, in the order it had. Its two answers to the registry are the part's, bound by the generic driver, and are what they were: the commit stops the coprocessors only in a real entry at EL2, and every enclave is taken. It tells the generic driver at probe that it takes neither the lid at the wake nor the USB wake ports, which were stubs for it when its sleep was tested. The dry run level moves to the generic driver, which exports apple_sleep_power_loss() and apple_sleep_last_steps() and answers them by the level a part sets: 0 unless a dry run of the T6040 is in progress, so on the T8140 both are pm_suspend_via_firmware() as before. Seen from outside: the parameters keep their t6040_sleep. prefix and the debugfs directory its name. The device's log lines carry the driver name apple-sleep now, and the refusals that come from the registry are the generic driver's lines with that prefix instead of "t6040-sleep:" ones; two debug lines about the registry are gone. The stop passes note ANS as the generic driver's do, for every ready ANS, which differs only for one that is ready and already stopped, and its driver clears that as it readies it. APPLE_T6040_SLEEP stays the switch of the part and now depends on APPLE_SOC_SLEEP; it keeps its dependency on a built-in SMC driver, whose key the part writes. The SEP's capability test and its host test go back to the one symbol, and the match data test knows the second compatible and skips the lists of a SoC that has a part. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 part had its own copy of the boot object's mailbox layout and magic. Use the one the generic driver has in the private header. The compiled code is the same. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 part repeated the generic driver's definitions of the power word, the CPU start block, the watchdog, the PMU's SPMI queue, the PCIe block that ANS shares and the sleep system registers, all with the same values. Move the generic driver's blocks of them to the private header as they are and drop the part's copies, with the ASC ones it no longer uses. What the generic driver takes from its per-SoC data stays with the part as its own values: the PMU write command with its USID, the boot stage register and value, the response vector's enable for the sleep. So does the complex timeout. The compiled code of both files is the same. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 part had a copy of the generic driver's PMU register write over the SPMI controller's AP queue, with a test for the mapping in front. Move the write to the private header, on the controller's base and with the PMU's USID as an argument, and call it from both. The device accesses, their order and the reply poll are the same in both. The compiler now keeps the controller's base in a register where it used to load it again from the driver's state after each access, so the two commit functions are a few loads shorter. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 part had copies of the two helpers that take a window and its tunable table from the node a loader fills for the storage PCIe block. Let the generic driver's pair take the device instead of its own state, declare it in the private header and use it from the part. Both run at probe only. The windows, the tunable properties and the order they are taken in are the same for the T8140 and for the T6040. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The file's opening comment still explained why the T6040 controller was a driver of its own next to the generic one, and several comments named functions the generic driver no longer has. Describe the part as it is now, with suspend-to-RAM offered only to a system booted with t6040_sleep.allow_entry=1, name the generic driver's functions, and say in sleep.c that a SoC may bring a part. List the private header next to the driver's sources. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The drivers/soc/apple/sleep-t6040.c part of "soc: apple: sleep: t6040, drm: apple: say what the wake leaves undone", which goes with the sleep controller changes; the rest of that commit is with the display changes. Four comments still read as open work: a register of each CPU complex that could be written at the wake, the energy accumulators that could be set again, and the conditional retention of the display domains. The J616s wakes with all 14 CPUs and its displays without them. Say what could be done there, that this driver does not, and what was measured. The comment over the display power words also described a device tree without the apple,display-power node as the present state; the boot object publishes it. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…e and the WD2 arm The T6040 part still had its own copies of three helpers the T8140 sequences have as well: raising a power word (the target, then AUTO_ENABLE once it reads on), writing a tunable table only where a word changes, and arming WD2. Each pair was the same statements on a different base pointer. Keep one inline copy of each in sleep-internal.h and call it from both. No access, value or order changes on either SoC; the compiler inlines them differently into their callers than before. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…uest A comment on the wake stub still pointed at the T8132 one by a pull request number. Name the stub. No functional change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The S2R state printed at debug level reads the hardware S2R-lo entry counter in MiniPMGR. It was mapped and unmapped around each read, and one caller is the dry run at the commit point, which runs with interrupts off and one CPU up: ioremap() and iounmap() may sleep there. Map the counter once at probe with the other fixed windows and read it through that mapping. The registers read and their order are the same; the dry run no longer maps or unmaps anything. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The refusal log of .begin said whether the device tree has an s2r-mailbox property, while the blocker count asks whether a mailbox with the boot object's magic is mapped. After a bad magic, or a mailbox dropped at a hibernation restore, the log read "s2r-mailbox yes" next to the blocker it counted. Log the mapped mailbox. Its comment spoke of interrupts being off; its only caller is .begin. When the first regmap read of a display CPU word fails, the warning printed the polled value uninitialised: start it at 0. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The PM core reaches .begin and .enter of a suspend to RAM only after .valid accepted the state (sleep_state_supported(), on every path into suspend_devices_and_enter()), and .valid accepts it only with allow_entry, a read-only parameter. .begin still tested allow_entry, and .enter tested it again together with apple_sleep_power_loss(), which is true on the one path that reaches it: dry run level 0 after .begin set pm_suspend_via_firmware(). Drop the three tests. Say in the comments that a dry run, a suspend to RAM as well, needs allow_entry too, so the CPU power ops registered at probe cover it; .begin only tries again if that registration failed. No register access changes. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…dd nothing - struct t6040_sleep_watch.name was written at probe and never read. - ans_bridge_quiesced kept whether the commit found ANS's fabric bridge armed, only for one debug line after the wake. The bridge is still quiesced as before; t6040_ans_bridge_quiesce() returns nothing. - t6040_sleep_total_blockers() was a one-line wrapper with one caller. - t6040_tunable_apply_changed() tested for a NULL table that cannot be NULL there: the storage PCIe raise runs only with apcie_st.valid, which requires both PHY-IP tables. - The BUILD_BUG_ON() on the size of t6040_axi2af[] compared the array with the size it was declared with. Size the array by its initialiser, so that the check catches a missing or extra domain. No register access changes. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…light The preflight mapped the PMP's PTD block (68 KiB) and the DART's GAPF block at probe only to print six of their registers, under offsets with no names. Both blocks belong to other drivers, which can show their own state. Drop the two windows and their lines; nothing on the sleep path used them. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6041 stop and wake spell the PMGR power-state word, the second stop bit of CPU_CONTROL and the GAPF bank as bare numbers (0xf0, 0x30f, BIT(11), BIT(28), 0x0f0000ff, 0xfffffcf0, 0x300, BIT(5), 0x12, 0x1ff, 0x20, 0x24, 0x500578540). Name them: the power-state fields as the PMGR power domain driver has them, the CPU_CONTROL bit as dcp-lifecycle.h does, and the GAPF bank's slice count, configuration and lock words and its slices. The GAPF definitions move ahead of their first user, which wrote the internal DCP's slice address out. No functional change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Several comments of the T6041 sleep and the external display paths carry measurement logs, test results, step labels that exist nowhere else, a monitor model, a commit hash, the boot loader's name and the names of internal mechanisms. Say instead what the firmware and the hardware expect. Two statements were wrong and go: the CPU word's children are not written back "before the GAPF protection returns", and the DCP DART's streams do not bring "GAPF protection again": the T6040 DARTs have no GAPF slice of their own, so nothing protects the slices the stop released until the next boot. The comment on the restart notifier's priority named the GPU's drain at -10; -10 is the GPU's thaw, the drain runs at 20. Comments only. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
A successful T6040 suspend-to-RAM prints about fourteen info lines for the internal DCP and as many for each external one: power and GAPF words before and after, DART and AFK results, every restart step. Print those at debug level, as the T8140 sleep does, and keep one info line per DCP for a firmware that is back. A CPU power word that does not settle is reported as a warning. The coprocessor register dumps and the progress of a resume from disk go to debug level as well. The firmware restart and the external link hand-back run for a suspend-to-RAM as for a hibernation: their messages no longer say "hibernation", and a failed restart no longer claims the display was left to the boot loader, which is true only after a resume from disk. The prepare of an external DCP refuses "the sleep", not "hibernation". The S4 power-off that skips the teardown is a normal event: log it at debug level on the device, not at emergency level. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
checkpatch asks for a comment on the mb() after the CPU power word write of the T6041 wake and on the release that withdraws a DPTX port when a session is dropped for a resume from disk. Give both, drop a double blank line in the T6041 stop and shorten a comment line in apple_drv.c to 100 columns. No functional change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The comment on the T604X UHBR select and ATC enable registers named a teardown sequence and a test machine, and broke a sentence over short lines. Say what is written and when, in one paragraph. Comment only. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Across a T6040 suspend-to-RAM the stop of a display coprocessor saves the power words of its pipe's sub-blocks, which follow the CPU's power word, and its wake writes back those that were on and now read off. The loop always covered eleven words. That is the internal pipe's count (DISP_CPU +0x8 to +0x58). An external pipe has seven (DISPEXT0 +0x358 to +0x388, DISPEXT1 +0x4a8 to +0x4d8), as the sleep controller's apple,check-ps-b4-sleep lists them, and the test meant to keep the external processors out of the loop read a flag that is only set for the T6030 external processor. So the HDMI processor (DISPEXT0) also saved, and on a wake could write, ATC0_COMMON, ATC0_CIO, ATC0_PCIE and ATC0_CIO_PCIE at +0x390 to +0x3a8: the power domains of the first Type-C port, which belong to the PMGR power-state driver and the devices behind them. With one of them on at the stop and not yet on again when the display processor resumes, the display driver raises it behind genpd's back. The USB-C processor (DISPEXT1) did the same to the SYS, FE and CPU power words of DISPEXT2 at +0x4e0 to +0x4f0, the power of another display coprocessor on a board that uses it. The same flag chose the GAPF slice whose clock protection is cleared around a write of the CPU power word: every coprocessor cleared the slice of the internal one's DART. The release of all protected slices that follows hid that. Give each pipe its number of sub-blocks and its DART's slice, next to its power word offsets, and use them for the save, the restore and the slice. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
A display coprocessor whose firmware restart failed is given up on: its messages are dropped from then on and it drives no display until the reboot. The stop of the next T6040 suspend-to-RAM powers its CPU off like any other, and the wake then ran the warm restart on it again. If that handshake fails, the same error is logged at every wake. If it succeeds, a firmware runs that nobody listens to: the pause, resume and power calls to its endpoints time out one after the other, and an external processor is then reported back, with the HDMI converter, the DP PHY and the link set up for it. Raise its power words at the wake, so that the stop of the next sleep can reach the coprocessor's registers again, and leave its CPU stopped. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The stop of a T6040 suspend-to-RAM disables the link work of the internal display processor (Type-C reconnect and relink, HDMI settle, link recovery, Thunderbolt events), so that none of it reaches a firmware about to idle. Nothing enabled it again: the wake's restart of the internal firmware does not, and a stop that fails gets no resume at all. Each sleep disabled the work items once more, and from the first sleep of a boot on they never ran again. The internal pipe of the J616s has no external link, so nothing showed. Stop it once, under the flag the external processors already use for theirs, and enable it when the warm restart has the firmware back. A stop that fails or a firmware that does not return leaves it stopped, and the stop of the next sleep finds it so. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The internal display processor refused every later sleep of the boot once its firmware had crashed (-EBUSY from the stop). One whose restart had failed at an earlier wake ran the whole stop sequence against a firmware it no longer talks to, timed out in it and was refused the same way from then on. Only the external processors had a way through: their CPU powered off, nothing else. Take the internal one the same way when its pipe is down. The power word of its CPU must not go down over sub-blocks that are on, and only a firmware takes a lit pipe down, so a dead firmware that left its pipe powered still refuses the sleep, now with a message that says so. A crashed internal firmware is given up on at that stop and the wake leaves it stopped: started again, it could power the pipe and then fail, and the next sleep would be refused for good. The panel stays off until the reboot, as before, and the machine goes on sleeping and waking. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
pmc-dcp holds the number of powered display coprocessors. The wake from a T6040 suspend-to-RAM counts each one in when its domains are up and writes the count, but the stop never counted it out. After the first sleep of a boot all three stayed counted: the first wake wrote 1, 2, 3 as the processors returned, every later wake wrote 3 three times, the first two of them with one and two processors powered. Count a processor out when the power word of its CPU has gone down. Nothing is written then: the sleep controller zeroes the voter before the sleep, as it does on T8140, whose stop forgets the processor the same way. Every wake now writes what the first one did. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The warm restart after a T6040 suspend-to-RAM released the RTKit receive side in case it was still held for a hibernation image and, for an external processor, in case it was held for a sleep that keeps the firmware running. Neither can be held there. The hold for an image is taken at freeze and power-off only. It is dropped by the thaw, by the restore that follows a failed power-off, or by the cold start in the restored kernel, which the suspend notifier flushes before any later sleep. The other hold is taken by dcp_hold_for_sleep() for the H17P, 27.x and T8132 firmware only, not for the desktop 26.x firmware these processors run. No functional change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The stop of a T6040 suspend-to-RAM began with the backlight suspend of the 14.7 firmware and the drain of pending brightness presents. Only the desktop 26.x firmware reaches this function. The first acts on a 14.7 panel only. The second returns at once for a processor that was not adopted running or whose firmware does not present the level with its frames, and both hold for the two T6041 entries. No functional change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 suspend-to-RAM code asked the device tree twice for the compatible to learn whether a processor takes part, and told the two external processors apart by the physical base of their coprocessor registers, with the power word offsets, the number of sub-blocks and the GAPF slice of each in a switch. Put them in a table of the T6041 hw data, one entry per pipe, and take a processor's entry by its display endpoint (apple,dcp-endpoint: 0 the internal pipe, 1 DISPEXT0, 2 DISPEXT1), which the binding already gives every external processor. A table in the hw data is what says a processor takes part. An external processor without the property, or with an endpoint the table does not have, gets no entry and is left alone as one with an unknown base was. The three processors of the J616s get the offsets, counts and slices they had. No functional change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Every stop and every wake of a T6040 suspend-to-RAM looked up the apple,display-power node and mapped and unmapped its "ps" and "pmc-dcp" windows, the GAPF bank and, separately, the one slice of it that belongs to the coprocessor's DART: four mappings per processor and cycle, in callbacks that have no use for a failed mapping. The stop also mapped "pmc-dcp" only to learn that the wake would find it. Look the pipe's power words up and map the three ranges once at probe, with the mapping types they had, and release them with the device. A processor without power words or without either window keeps nothing, and its stop and wake leave the power words alone as before. The slice is reached through the bank. The register accesses of the stop and the wake and their order stay as they were. No functional change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
Every stop and every wake of a T6040 suspend-to-RAM warned once per display coprocessor that an AFK endpoint was "not paused" or "not resumed" with -95: endpoint 0x25 on the external processors, 0x2c on the internal one. The firmware advertises these endpoints and has sent no compact message on them. The pause and resume requests are compact packets and are not sent to such an endpoint at all: the error comes from the host side, before anything reaches the firmware. That made six warnings per sleep for endpoints left exactly as they were. Count these endpoints in the debug summary and keep the warning for requests that were sent and went unanswered. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
A suspend gives up the link of an external display, and the resume
commit of its CRTC can come before the sink has answered again. The
firmware then fails the mode set ("setmode failed", "Modeset done, but
pipe not enabled"), which the driver logged as
[drm] *ERROR* [CRTC:65:crtc-1] mode set failed: -5
On a J616s with an HDMI display this came with every suspend to idle,
2 s after the wake, and now and then after a suspend to RAM. The
display was back 5 s later, when the firmware reported the sink and
the hotplug brought a mode set that worked.
Return the quiet -EPIPE of a pipe without a link when the connector of
an external pipe is reported disconnected. The hotplug that reports
the sink back sets the mode, as it did after the failed one.
J616s, HDMI and USB-C DP displays: two suspends to idle and two to RAM
without the error, both displays back after each.
Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The DCP's hibernation notifier handles the end of a restore and of an aborted hibernation, but not PM_RESTORE_PREPARE, and nothing says why. The restored kernel rebuilds its firmware session on the DCP firmware state the boot loader left for it. A kernel that loads an image with this driver bound would have started the DCP itself and left it in a different state. Refusing the restore here would block a resume that the boot kernel does not need to be stopped from, and cannot be exercised without a restore, so only the requirement is written down. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The T6040 PHY exported its tunnel pixel clock as apple_atc_dp_tunnel_rate() only when phy-apple-atc is not built. With both PHY drivers in one kernel the T6040 tunnel had no provider: the ATC driver's symbol refuses a PHY that is not its own, so the clock of a Thunderbolt DisplayPort tunnel was never started. Export apple_t6040_dp_tunnel_rate() unconditionally, as for T6050, and let the display fabric call it on T6040 and T6041 for the clock, and for the stop of a split tunnel. The rate call starts everything there, so the separate "open" step is left out on those SoCs. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The warm restart of the internal and of an external display processor repeat the same first half: the idled firmware is returned through the power-cycled return, its AFK endpoints are started again and the framebuffer's hard power state is put back on. Move that half into one helper; both callers keep their own preparation before it and their own steps after it, in the same order. dcp_hib_recommit() carried the whole recommit in one function of about ninety lines. Split it into the power-on step, the case of a CRTC that is off and the case of a CRTC that is on. The modeset locking and the retry stay in the caller, the power-on is made once per call as before. No change in behaviour. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
iomfb.c names nothing from linux/clk.h, linux/iommu.h, linux/kref.h or linux/soc/apple/dp-tunnel.h. Drop them. The object file is identical before and after. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…an error The drivers/gpu/drm/apple/dcp.c part of "soc: apple: rtkit: report an idle that kept the firmware's memory apart from an error", which goes with the display changes; the rest of that commit is with the hibernation core changes. A co-processor may acknowledge the idle request of its IOP side with a power state other than idle (the low byte 1 or 2): it is asleep with its firmware and memory kept, which is what the caller wants after the AP side has idled. apple_rtkit_idle() returned -EINVAL for it, the same value as a bad argument or a stale state, and the display driver had to accept -EINVAL as success. Return APPLE_RTKIT_IDLE_RETAINED (-EALREADY) for exactly that acknowledgment. Timeouts and failures of the AP side are returned as before. Every other caller of apple_rtkit_idle(), apple_rtkit_idle_with() and apple_rtkit_sleep_stop() treats any non-zero value as a failure and only forwards or prints it, so for them only the printed number changes. The display driver now accepts the new value instead of -EINVAL and fails on any other error, -EINVAL from the transport included. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The host test extracts dcp_route_clock_rate() from the display fabric and builds it on its own. The fabric now calls the T6040 PHY's own tunnel clock symbol on T6040 and T6041, so the test needs that helper and a model of the symbol. Extract dcp_fabric_t6040_tunnel_clock() with the other fabric functions, stub apple_t6040_dp_tunnel_rate() and add a case that runs both machines through DP IN 0 and 1: the rate reaches the T6040 symbol with the right adapter, neither the ATC nor the T6050 provider is called, and a clock that fails to start leaves the route's rate alone. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
The DP-to-HDMI converter's rails are SMC GPIOs that outlive a kernel, so the first probe looks at whether the converter was left powered and power-cycles it once. That check is per machine on purpose: struct apple_dcp is allocated again by every probe attempt, so a flag kept in it would let a deferred probe power-cycle a converter the attempt before had just powered, costing 250 ms and a second log line. Document that ownership at the flag and make the test-and-set atomic, so that two probes of the same machine cannot both take the first look. The sequence is otherwise unchanged. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
hdmi_converter_fresh records that the DP-to-HDMI converter was just
powered up for a link, so the next link start takes it as it is. It is
written by dcp_hdmi_converter_power() and by the connect path, and read
by the connect path, with different locking:
writer context hpd_mutex
dcp_hdmi_converter_power(false), unplug HPD irq thread not held
dcp_hdmi_converter_power(false), sleep sleep path not held,
HPD irq disabled
dcp_hdmi_converter_power(true), relink resume path not held,
HPD irq disabled
dcp_hdmi_converter_power(true), connect connect path held
clear after the check, connect connect path held
reader: test before powering, connect connect path held
The sleep and relink writers cannot overlap the HPD irq thread, which is
disabled (and so synchronised) around them. The unplug write can overlap
a connect in another context, so the flag was accessed concurrently
without a lock.
Taking hpd_mutex in dcp_hdmi_converter_power() is not an option: the
connect path calls it with the mutex held, and the function sleeps up to
450 ms (250 ms power-off, 100 ms settle) with the converter rails. The flag
is a single bool whose users order themselves by the callers above, so
mark every access with READ_ONCE() and WRITE_ONCE(). The generated code
is identical to before; HDMI behaviour does not change.
Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…ation The drivers/gpu/drm/apple/dcp.c part of "soc: apple: drop the restore callbacks' checks for an abandoned hibernation", which goes with the display changes; the rest of that commit is with the sleep controller changes. An abandoned hibernation resumed its devices with PMSG_RESTORE, so every restore callback that must not act on a state it never lost began with a pm_hibernate_is_restored() check, and most forwarded to their thaw. The PM core now sends PMSG_RECOVER there, which reaches the thaw callbacks, so the check and the forward go from macsmc, the RTKit helper, apple-dart, the sn201202x Type-C controller, the SPMI, GPIO and NVMe restore paths, both PCIe restore callbacks, the DCP and AOP restores, the t6040 USB2 PHY's two and the RTC; cs42l84's restore passes that the codec lost its state. Each callback runs for a restored kernel exactly as before. For an abandoned hibernation the old path was already the thaw or nothing, and the thaw now runs on its own: macsmc, the RTKit helper, apple-dart, sn201202x, NVMe and cs42l84 forwarded to the same function (cs42l84's resume asks pm_resume_via_firmware(), which hibernation_snapshot() has cleared); PCIe's restore_noirq did for a bridge without hibernation tunnelling what its thaw_noirq does, and the same call with it; the AOP, t6040, RTC, GPIO and SPMI restores did nothing and have no thaw. DCP keeps its power-off-failed branch (PMSG_RESTORE after a failed platform power-off, which only a platform with hibernation ops reaches) and loses the abandoned one, whose only other effect was a log line. One path changes: macsmc's thaw, after the SMC was handed over and the image could not be entered, calls apple_smc_restore() to start a new session, and its own check sent that back to the thaw, which did nothing. It now starts the session as the comment says it should. The flag keeps its other users, which are not restore callbacks: the AIC syscore resume, the dockchannel receive interrupt, the SEP's PM notifier. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
…em is back After a suspend-to-RAM the fixed HDMI output of a desktop 26.x processor is connected again from the restart work while the DRM resume sets the modes on the same processor. When the converter has not found its sink yet, the link was released and connected again up to three times right there, each connection waiting up to 2 s for its configuration, and the DRM resume waited behind it: "resume of devices" took 4.96-5.00 s instead of 3.2 s on the J616s with an HDMI and a DP display. Run those starts from a freezable work item when the link is set up again after a sleep, so they come once the system is back. A mutex keeps them apart from the starts of the HPD interrupt, and every path that stops the link (suspend-to-idle, the prepare of a hibernation or a T6040 suspend-to-RAM, unbind, remove) cancels a pending one first. The first connection stays where it was, so the order in which the external processors connect after a sleep does not change. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com>
fbalazsy
force-pushed
the
j616s/split-display
branch
from
November 14, 2026 18:46
5dc9f18 to
7509ddf
Compare
Contributor
Author
|
Closing: this stack is based on integration/aurora from 2026-11-14 and now conflicts with the sleep and spin-table work that landed since. I will rework the J616s (T6040) support on top of the current tree and open a new, smaller series. |
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.
Part 7/9 of the split of #1477 into smaller pull requests. Depends on #1913: GitHub cannot stack pull requests from a fork, so this one also carries the commits of #1903, #1904, #1909, #1910, #1911, #1912, #1913; its own are the last 53, from 5e66575 on (26 files changed, 3047 insertions(+), 85 deletions(-)).
The T6041 display coprocessors across hibernation and suspend-to-RAM, external displays kept on their pipes through a wake, the HDMI link of a desktop 26.x processor started once per plug, and the display crossbar.
Open item carried over from #1477: after hot re-cabling the HDMI half of a picture-by-picture monitor stayed dark once; not reproduced.
Tested: the stack as a whole on the J616s (hibernation and suspend-to-RAM; results in #1477, whose tree is the tree at the top of this stack). Each part of the stack was built on its own (asahi config, LLVM, Rust) for the directories the series touches, and runs the host tests, KUnit and the other checks here. The commits are those of #1477 restricted to this part's files, in the same order; where a commit of #1477 spanned parts, each piece says in its message which commit it comes from.
Not tested: this part on hardware without the parts above it in the stack; T8140 and the other SoCs whose paths these commits share; a dock on the current base; the KVM guest across the sleeps; a USB4/Thunderbolt device.