Skip to content

T6050: firmware-driven deep sleep on the K116s (16-inch M5 Pro, firmware 27.2) - #2201

Open
axboe wants to merge 38 commits into
aurora-silicon:integration/aurorafrom
axboe:k116s-sleep-27.2
Open

axboe wants to merge 38 commits into
aurora-silicon:integration/aurorafrom
axboe:k116s-sleep-27.2

Conversation

@axboe

@axboe axboe commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Thomas, this is the 27.2 sleep as one change, as asked for on #2070. It sits on #2187, which brings the 27.2 call numbering and the 27.2 sleep transport for the J716c; the first commit here that touches the display assumes it. The branch is based on #2187's head, so its three commits show up here until it is merged; the 35 after them are this series (the first of those is a one-line host test fix that belongs with #2187).

With this series the K116s enters the firmware-driven deep sleep and wakes by RTC alarm or by opening the lid, with panel, NVMe, Wi-Fi and Bluetooth back.

What is in it

v5 (2026-11-21): rebased onto integration/aurora a84637d. The port controllers' side of the USB commit is in through #2640, so that commit is the dwc3 line alone, and the K116s's three controllers ask for apple,sleep-ssps-rules and apple,reset-on-failed-probe. The saved-context commit keeps the J714s's wake table (#2231 selects by it). The no-alarm commit is also up alone as #2698 and leaves here when that is in.

v4 (2026-11-19): the merged-mode limit gets its own property on the external display coprocessors (three commits on top of v3).

v3 (2026-11-19): second round of review: one predicate, the SMC wake reason names in the device tree, the wake mode set on firmware events, our SPMI commit dropped for #2309. v2 removed the board lists. See the comments below for what changed.

Firmware 27.2 pieces

  • Secure port handshake. On 27.2 the internal DCP has a secure mailbox port (ADT dcp-exclave-mailbox). While nothing answers it, the firmware acknowledges the AP idle and never the IOP idle. The port's AP idle now goes between the two, at the late stop and in the wake's stop/restart cycle. RTKit gets a hook for that step (apple_rtkit_v27_set_after_ap(), apple_rtkit_idle_strict_with()), and of_update_property() is exported so the driver can add the port to its live node.
  • A492 filler. 27.0's A442 takes 0xaa filler; 27.2's A492 reads it as an index count and rejects the call. Zeros are sent on the renumbered builds.
  • Busy endpoint. A DCPEXT endpoint that is still taking a late service announce answers -EBUSY to the close for a moment. It is waited out for up to 300 ms.
  • Mode set in the wake. The panel's first mode set waits for the video interface to be open again and for the firmware's hotplug report, and is then sent, on firmware with the renumbered method table (27.2 and later). On 27.0 the mode is kept as before.
  • ANS log buffer. The 27.2 ANS asks for its syslog buffer in the wake, which the buffer hold refused. A first buffer for an endpoint that has none is served under the hold.
  • No RTC alarm. A sleep with no alarm armed is no longer refused, so a lid close sleeps. Also soc: apple: sleep: T6050: a sleep with no RTC alarm armed is not refused #2698.

Selection by the sleep's description

A helper tells whether a T6050 machine describes the sleep in its device tree (an enabled apple,t6050-sleep node), and the drivers use it in place of their board lists: sleep controller, AIC, SMC, RTKit (PMP), SIO, NVMe, PCIe, DART, the combo PHY, dwc3, the GPU, and the display driver. The CPU topology check uses the CPU inventory alone.

Device tree and bindings

The PMU's RTC, the video encoder's power states (VENC0_SYS left on by iBoot blocks the sleep), an #ifndef so a board without the USB4 router can include the J714s's SoC values, and the K116s sleep description. Only the last commit enables the sleep.

Testing

K116s, firmware 27.2. Kernel: integration/aurora a84637d + #2187 + #2309 + this series + my other K116s commits.

Known gaps

  • AOP crash. One AOP coprocessor crash (exception.c:59) in 1 of 38 wakes. Not understood.
  • Charger wakes. A port's wake with the lid closed is a dark wake since soc: apple: sleep, mfd: macsmc: T6050: a port's wake with the lid closed is a dark wake #2445. With the lid open it is a full wake.
  • Wi-Fi line at entry. apple_centauri_t6050 0000:01:00.0: firmware country update failed: -125 as the suspend starts, at the RTC-alarm sleep of the v5 run and in 60 of my 64 saved alarm-sleep logs since 2026-11-16; not at the four lid entries of that run. A country update is in flight when Wi-Fi is stopped and is canceled. It is the Wi-Fi driver's, not this series', and Wi-Fi is back after the wake each time.
  • Thunderbolt. The CIO sleep part is not enabled on this board; no USB4 router is described.
  • Other boards. On a J714s, Isaac ran the no-alarm commit alone (2 of 2 lid sleeps, see below). Otherwise not tested on a J714s or J716c beyond building. What changes there is listed in the v2 comment: a sleep with no RTC alarm is accepted, a first buffer under the ANS hold is served, the J716c acknowledges the PMP's empty CoreAnalytics event, and a J714s on 27.2 would take the wake's mode set.
  • Bindings. apple,secure-mbox names the DCP's secure port apart from mboxes, because the boot loader hands the display over only to a node with a single mailbox. Its binding is added here, with the T6050 secure port's compatible and the empty form of apple,pinctrl-skip-pins.

For #2070

With this in, v27_sleep_known can admit 27.2 on a T6050 whose internal DCP has the secure port described. 27.3 stays unknown.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for putting the 27.2 sleep together as one series; the testing write-up is very useful.

Our convention is to select behaviour by a hardware or firmware property, not by the list of boards it was tried on, and the admissions extend those lists with apple,k116s in about fifteen drivers, for example drivers/dma/apple-sio.c:705-706, drivers/mfd/macsmc.c:651-655, drivers/nvme/host/apple-m5-sleep.h:173-174, drivers/usb/typec/tipd/spmi.c:746-754, drivers/soc/apple/sleep.c:1896-1897, drivers/gpu/drm/apple/dcp.c:511-512.

Two of them carry firmware behaviour: the ANS log buffer under the hold (drivers/soc/apple/rtkit.c:569) and the secure port path (drivers/gpu/drm/apple/dcp-v27-sleep.inc:1456). Those should follow the firmware version or the presence of the secure port (dcp->secure_rtk, from dcp-exclave-mailbox), so J714s and J716c on 27.2 get them too.

For the admissions, could the SoC sleep data or a DT property on each node (for example the sleep description itself) select them? A generic name instead of apple,k116s-secure-mbox would fit the same idea. We can run rows on other machines.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for putting this together as one series. #2075's findings are all covered here.

A review note on how the new behaviour is selected, before this merges. Most commits add apple,k116s to an existing of_machine_is_compatible() board list, and a few add K116s-only branches. Where the reason is the firmware or a block the board has, keying on that property makes each change reach every T6050 board that needs it, instead of growing the lists:

  • Secure DCP port (dcp_v27_sleep_prepare(), the secure_rtk && !k116s test): the reason is the dcp-exclave-mailbox port that 27.2 publishes. dcp->secure_rtk already tracks that, so the board test can go. A J714s or J716c on 27.2 needs the same handling.
  • ANS first log buffer under the hold (rtkit-v27-late.inc): the commit says the reason is 27.2's ANS asking for its syslog buffer in the wake. A first buffer for a log endpoint replaces none on any board, so this could key on "no buffer mapped yet for this endpoint" alone.
  • v27_wake_modeset and t6050_alarm_optional: both are new module parameters, and both default to the new behaviour. If the new behaviour is right (the panel's first mode set after the video interface reopens, and no RTC alarm needed when the SMC wake sources are armed), it can be the code path itself. The parameters keep a second path alive that nothing tests.
  • apple_sleep_validate_cpu_topology(): the K116s exception in the soc->machine test would fit better as the board in the SoC data's machine list, or as a check on the CPU inventory only (boot MPIDR and CPU count are already compared).
  • Board lists in sio, macsmc, g17 sleep, atc combo, DCPEXT: if the J714s profile is simply right for every T6050 board with that hardware, apple,t6050 plus the device's own compatible is enough. Where a board really differs (K116s pins, PMP sram-keep, panel open delay), the DT values in this PR already carry it.

None of this changes what the K116s does at runtime. It changes which other T6050 boards pick it up.

@RyanTheTide

Copy link
Copy Markdown
Contributor

One addition to the notes above, so the hardware side is clear as well. The 30 s RTC sleeps cover the alarm path; the series also makes lid and keyboard wakes possible (t6050_alarm_optional), so the K116s row we would like to see at the posted head is:

  • rtcwake -m mem -s 30 three times (as you already ran);
  • three lid close/open sleeps with no alarm armed, and three wakes by the power key;
  • after each resume: dmesg --level=err,warn free of DCP, RTKit, NVMe, AOP and DART errors, the panel lit, a USB device on a USB-C port re-enumerated, Wi-Fi passing ping -c 5, Bluetooth paired device back;
  • with a charger attached, one sleep to note whether the spurious "USB-C plug" wake still happens.

On the selection point: #2089 changes the T6050 sleep entry's machine string to apple,t6050 (sleep-t6050.h:3740), which would make the K116s exception in apple_sleep_validate_cpu_topology() (sleep.c:1896-1897) unnecessary. Keying that check on the CPU inventory alone works for both PRs.

The rtkit, dcp and drivers/of changes are shared, so once the row is in we can run no-regression rows on our A18 Pro and M4 Pro.

@axboe

axboe commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Ryan, thanks for the review. The series is reworked along those lines; the branch is force-pushed as v2. Nothing in it names the K116s in a driver any more, and the K116s does the same things at run time as before.

How the paths are selected now

  • Board lists. New helpers in linux/soc/apple/sleep.h: apple_t6050_sleep_described() is true on a T6050 machine with an enabled apple,t6050-sleep node, and apple_t6050_pro_sleep_described() is the same without the J716c's own compatible. The drivers use them in place of their lists:
    • described: AIC, SPMI recovery, the SMC's saved lane, NVMe, the radio's PCIe host, the display DARTs' V27 provider, the combo PHY, dwc3, the port controllers' SSPS rules, the G17 provider.
    • the M5 Pro's description only (where the list was the J714s alone): SIO, the ISP DART's sleep, the SMC's wake reason names, the port controllers' J714s start, dcp_j714s_ext() and v27_j714s.
      A board opts in by describing the sleep; the K116s does so in the last commit.
  • Secure DCP port. The board test is gone: the V27 sleep takes any coprocessor with secure_rtk. The property is now apple,secure-mbox. It is still separate from mboxes, because aura's handoff accepts only a single mailbox there (kboot_display_handoff.c, the len == 4 checks on mboxes); the binding says so. If aura learns to accept the second entry, the property and the live-tree update can both go.
  • ANS log buffer. Keyed on the endpoint having no buffer yet: apple_rtkit_common_rx_get_buffer() serves a first buffer under the hold, for any endpoint; a request for an endpoint that has one is refused as before.
  • t6050_alarm_optional. The parameter is gone; no armed alarm is no refusal.
  • v27_wake_modeset. The parameter is gone. The kept-mode branch is not a dead second path, though: display-sleep-merge-tests.py compiles it and has a mutation for it, and it is what the J714s runs on 27.0. So the new behavior is keyed on the firmware: with the renumbered method table (27.2 and later, iomfb_v27_methods_renumbered()) the first mode set waits for the video interface and is sent; on 27.0 the mode is kept as before.
  • apple_sleep_validate_cpu_topology(). Checks the CPU inventory alone (boot MPIDR and CPU count); no machine test. Works with or without arm64: dts: apple: t6050-k114c: add the deep-sleep controller node #2089.
  • PMP CoreAnalytics ack. Follows pmp_registry_v2 alone.

What this changes on other boards

  • A J714s on firmware 27.2: the panel's first mode set after a V27 wake waits for the video interface and is sent. On 27.0 nothing changes.
  • J714s, J716c: a sleep with no RTC alarm armed is accepted.
  • J714s, J716c: a first buffer request under the ANS hold is served instead of failing the wake.
  • J716c and any other board with a registry-v2 PMP: the empty CoreAnalytics event on endpoint 7 is acknowledged.
  • A J714s or J716c booted with a device tree that lacks the sleep node no longer takes the sleep's paths in those drivers. With the trees in integration/aurora nothing changes for them.

Where I would like your view

  • The wake's mode set: keyed on 27.2 because that is what the K116s runs; I have not separated "needed on 27.2" from "harmless on 27.2". If you would rather make it the only path, the kept-mode test needs changing with it.
  • The SMC's wake reason names and the port controllers' J714s start now follow "the M5 Pro's sleep description". The names are really the ADT's smc-pmu event numbering; if you would rather have them in the device tree, I can move them.
  • apple_t6050_pro_sleep_described() tells the J716c apart by its compatible. If you prefer one predicate and a property on the node for what differs, say so.

Checks

checkpatch is clean except the msleep(5) note in the mode-set commit and the MAINTAINERS note for the new .dtsi. dt_binding_check and dtbs_check add no warning for the K116s.

Test row

K116s, firmware 27.2. Kernel for the first two items: integration/aurora 0abc2f3 + #2187 + this v2 + my other K116s commits.

  • rtcwake -m mem -s 30, three times, at this head: 3 of 3 resumed on the same boot.
  • After each of those resumes: panel enabled; the USB stick on a USB-C port present with its block device; ping -c 5 to the gateway 5 of 5. dmesg --level=err,warn has nothing from DCP, RTKit, NVMe, AOP or DART. What it has: IRQn: set affinity failed(-38) from the CPUs going offline, three Unable to change power state ... device inaccessible lines for the N1's root port and functions before the host re-enumerates them, and the Wi-Fi driver's firmware country update failed: -125 at the entry.
  • Lid close/open with no alarm armed: not rerun at this head. The journal has 17 lid wakes since 2026-11-16 on earlier heads of this series, among them sleeps of 7.7 h and 9.8 h.
  • Power key and keyboard: both wake the machine from a sleep with the lid open; I have used both. Not rerun, and only one power-key wake is in the journal.
  • Bluetooth: not tested; it is not used on this machine. The controller re-enumerates after each wake.
  • Charger attached: the spurious wake still happens. 18 "USB-C plug" wakes are logged, five of them in six hours on a third-party charger that drops and renegotiates its contract under the sleep's load. The SMC has no mask for it (macOS writes none); a follow-up series takes such a wake with the lid closed as a dark wake, and I will send it separately.

Since 2026-11-16 the journal has 113 deep-sleep wakes on this machine across the heads of this work: 75 by RTC alarm, 17 by the lid, 18 for the charger, 2 for Wi-Fi/Bluetooth and 1 by the power key.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for v2, this is a big step: the board lists are gone from most drivers, the PMP CoreAnalytics ack now follows pmp_registry_v2 alone, and the ANS first-buffer rule keys on the endpoint's state. On your three questions, plus a few points in the new code:

  1. apple_t6050_pro_sleep_described(): yes, please use one predicate and put what differs on the sleep node as a property. Telling the J716c apart by apple,t6050-j716c-sleep is still a board name used as a feature flag, and a K114c (arm64: dts: apple: t6050-k114c: add the deep-sleep controller node #2089) or another Max described with the Pro file would take the Pro paths.
  2. SMC wake-reason names: yes, please move them to the device tree (they are the ADT's smc-pmu event numbering).
  3. Wake mode set (iomfb_template.c): keying on the 27.2 method table is fine. Could the 5 ms poll (up to 1500 ms) and the fixed msleep(40) wait on the events instead, i.e. a completion signalled when the panel's video interface opens and another for the firmware's hotplug report with a valid mode? Then the timing comes from the firmware, not from constants.
  4. dcp_v27_secure_idle_atomic(): the udelay(2000) after a timed-out idle has no stated source. Please give one, or treat the timeout as a failure.
  5. SPMI: spmi: apple: recover every generation 4 controller from a failed exchange #2309 runs the generation 4 recovery on every generation 4 controller, so the spmi commit here can be dropped (or rebased onto it). In tipd_sleep_ssps_rules() the boards already carry apple,sleep-ssps; keying on that property would also remove the J813/J815 names.

Row still open at the v2 head on the K116s: three lid close/open sleeps with no alarm armed and three power-key wakes, each with the same post-resume checks as your rtcwake runs. Bluetooth can stay out since the machine does not use it. Thanks for the charger-wake numbers; we will look at the dark-wake series when it is up.

One more K116s row, beyond this PR: SIO is still enabled only on the J714s (drivers/dma/apple-sio.c:703-706). We are widening it to every board with the hardware and will link the branch here. A boot of it plus dmesg | grep -i -E "sio|rtkit|pmp" before and after 30 minutes of uptime would close it: SIO users (DP audio) probe, and no RTKit timeouts.

@axboe

axboe commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Ryan, thanks. v3 is pushed; point by point:

1. One predicate. apple_t6050_pro_sleep_described() is gone. What used it:

  • SIO, the ISP DART's sleep, the SN201202x's retried start: apple_t6050_sleep_described(), as everything else.
  • Display (v27_j714s, dcp_j714s_ext()): a boolean on the sleep node, apple,display-method-sleep: the display coprocessors take the sleep through their firmware 27 method table (the sleep call, the A407 swap, the panel's AV and DP services), not through the endpoint transport alone. Binding added. It is set in t6050-j714s.dts and in the K116s's own sleep file, not in t6050-j714s-sleep.dtsi, so a board that includes that file (arm64: dts: apple: t6050-k114c: add the deep-sleep controller node #2089) does not inherit it.
  • SMC wake reasons: point 2.

One thing I left: dcp_peer_limit_applies() still follows dcp_j714s_ext(). That limit is the Pro's display engines, not the sleep. Say if it should get its own key.

2. SMC wake reasons. apple,wake-reasons and apple,wake-reason-names on the SMC's node, binding added, set on the J714s and the K116s (the K116s ADT's smc-pmu numbers them the same way). The J714s table is removed; without the properties the SoC's table is used as before. The KUnit case builds its own table.

3. Wake mode set. Two completions in place of the poll and the msleep(40):

  • the open of the panel's video interface (the panel AV open worker), up to 1.5 s;
  • then the firmware's hotplug report (D575, signalled in the V27 trampoline), up to 250 ms.

A wait that runs out logs a warning and the mode set is sent anyway. In three v2 wake logs the report follows the open by 5 to 16 ms. One caveat: the 40 ms also covered about 20 ms of firmware set-up that follows its hotplug notify in the syslog, so this sends the mode set earlier than v2 did. At the v3 head neither wait ran out in five wakes, and the panel was on after each; in the one I timed the report came 5 ms after the open and the mode set request followed at once.

4. udelay(2000). It had no source; it was a guess. The hook now returns an error, and an AP idle of the secure port that is not acknowledged in 5 ms fails the stop (apple_rtkit_v27_idle_atomic() poisons with it).

5. SPMI, tipd.

What changes on other boards, v3 against v2

  • J716c: the ISP DART's registers are restored after a deep sleep where that DART is enabled, and a failed SN201202x probe is retried. Its SIO is disabled, so the SIO change does nothing there. Its display paths are unchanged (no apple,display-method-sleep).
  • J700: the system power state command's rules, as above.
  • J714s: none intended; its two new properties say what the driver assumed.
  • A board described with the J714s sleep file takes the sleep's common paths, and the display method and the wake reason names only if its own tree sets them.

Checks

  • checkpatch: clean except the MAINTAINERS note for the new .dtsi.
  • dt_binding_check for the two touched schemas passes; dtbs_check adds no warning for the K116s, J714s or J716c against v2.
  • tools/asahi/run-host-tests.py: all pass but g15-retention-tests --mutations, which reads a commit my clone does not have. The publication-hpd selftest is why the hotplug signal sits in the V27 trampoline and not in dcpep_cb_hotplug().
  • KUnit: not run here.

Tests at the v3 head (K116s, firmware 27.2, integration/aurora 0abc2f3 + #2187 + #2309 + v3 + my other K116s commits)

  • rtcwake -m mem -s 30: 3 of 3 resumed on the same boot. After each: panel enabled, ping -c 5 5 of 5, and dmesg --level=err,warn has the same lines as at v2 and nothing from DCP, RTKit, NVMe, AOP or DART.
  • Lid close/open, no alarm armed: one, "woken for the lid", same checks pass.
  • Power key: one, wake record pwrbtn, same checks pass.
  • USB device on a USB-C port: not at this head; 3 of 3 at v2.

I did one lid and one power-key wake, not three of each, on purpose. The sleep and wake path does not depend on what wakes the machine, and everything v3 changes in it ran in the rtcwake cycles. The two things specific to these wakes are the sleep with no alarm armed, which v3 does not touch (17 lid wakes on earlier heads, one at v2), and the wake reason names, whose table moved to the device tree with the same contents. One wake of each kind reads the two entries.

Link the SIO branch when it is up and I will boot it and post the two logs.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for v3; one predicate, the wake reasons in the DT, the completions, and failing the unacknowledged idle all read right. On your question: yes, please give dcp_peer_limit_applies() its own key. It describes the display engines, not the sleep, so it should follow a property of the display coprocessors (on the dcpext nodes, or per-SoC DCP data with a comment), not apple,display-method-sleep. One lid and one power-key wake are fine given your reasoning; the USB-C re-enumeration check at this head is still open. The J700 now takes the apple,sleep-ssps rules, so we will run an A18 Pro sleep row. Noted: this lands after #2309, and the tipd hunk coordinates with #2398.

@axboe

axboe commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Ryan, thanks. v4 is pushed: three commits on top of v3, nothing else changed.

The merged-mode limit. dcp_peer_limit_applies() reads apple,merged-mode-limit from the external display coprocessor's own node (binding added to apple,dcp.yaml). The J714s sets it on its four, so the limit holds there as before, and the machine check in dcp_peer_limit_update_v27() goes with it. No other board sets it. That includes the K116s, where v3 had the limit follow the sleep property.

USB-C re-enumeration. One rtcwake -m mem -s 30 at the v3 head with a USB stick on a USB-C port: after the wake the device and its block device are back, the panel is enabled, ping -c 5 is 5 of 5, and dmesg --level=err,warn has the same lines as before. I did not repeat it on v4: nothing the K116s runs in a sleep changed.

Checks on v4. Builds; checkpatch clean on the three commits; dt_binding_check passes for apple,dcp.yaml; dtbs_check warning counts for the J714s and the K116s are unchanged. The limit itself is not tested: it needs a J714s with external displays.

Sequencing. #2440, #2441 and #2442 cover the selection commits here with the same helper. If they go first, I will rebase this onto them and drop the duplicates, which leaves the 27.2 pieces, the bindings and the K116s tree. Say which order you want.

@RyanTheTide

Copy link
Copy Markdown
Contributor

As promised, the branch that widens SIO and the PMP CoreAnalytics acknowledgement from the J714s to every T6050 board (keyed on the hardware instead of the board name) is #2412 (draft). A boot of it plus dmesg | grep -i -E "sio|rtkit|pmp" right after boot and after 30 minutes of uptime is all we need: SIO users probe, no "refused auxiliary buffer request", no RTKit timeouts.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for v4. Keying dcp_peer_limit_applies() on apple,merged-mode-limit on the external coprocessor nodes, and the USB-C re-enumeration check, cover what was still open from our side. On ordering: landing #2440-#2442 first and rebasing this onto them is fine with us, after #2309.

@Isaac-Duarte

Copy link
Copy Markdown
Contributor

Note

🤖 Claude Opus 5.5 responding on behalf of Isaac-Duarte

J714s row for 3a8aaee ("a sleep with no RTC alarm armed is not refused") alone: lid close deep-sleeps, 2 of 2, woken by the lid.

Setup: J714s (14" M5 Pro), system firmware 27.0. Kernel integration/aurora 0abc2f3 + #2144, #1996, #2510's series, #2440 and #2442, plus my carried #2017, #2026, #2233 and #2421, plus this one commit cherry-picked unchanged (it applies cleanly; none of the rest of this series). mem_sleep at [deep], no mem_sleep_default.

Before (same tree without the commit): each lid close is refused at entry, and logind retries about every 30 s while the lid stays shut:

PM: suspend entry (deep)
apple-sleep 280600000.sleep-controller: refused at .enter: SoC check: -16
PM: suspend exit

With the commit:

Lid closed Asleep Woken by After the wake
07:37:31 67 s lid: wake status set: AP 171 MTP.DOCK.CHANNELS.AP0.IRQ, wake record: MBSE 0x100fe, MBSW 00 01 ...: lid Wi-Fi reconnected, Bluetooth up, speakers play
08:17:25 2 h 28 min lid, same wake status and record same

No early wakes and no RTC alarm armed in either. Battery on the 2 h 28 min sleep, on battery throughout: 97.245 % → 96.753 % (upower), about 0.32 Wh of a 65.5 Wh full charge, so roughly 0.13 W average while asleep.

Not covered: a power-key wake, and a USB-C plug wake with the lid shut (#2231 is not in this tree). RTC-alarm sleeps (rtcwake -m mem) ran on the same base without this commit for #2440/#2442 and behave as before, but I haven't rerun them with it.

Could this commit go up as its own PR? It's the only thing a J714s needs from this series for lid-close deep sleep, and here it doesn't depend on #2187/#2309 or the K116s commits. If you'd rather not split it, I can open one with you as the author.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@Isaac-Duarte thank you for the J714s row on 3a8aaee on its own. Lid-close deep sleep refused at entry without it and 2 of 2 with it, both woken by the lid with Wi-Fi, Bluetooth and speakers back, is a clear before and after, and the 0.13 W average on the long sleep is a useful number. Noted that power-key and USB-C plug wakes are not covered yet.

… build

The paired mode set (a mode too wide for one engine, run on two) sends
its IOMFB calls through dcp_peer_video_call_stream(), naming them by
their 27.0 IDs. Firmware 27.2 renumbered the IOMobileFramebufferAP
methods, and an ID the firmware does not know panics it: on a 27.2 stub
the paired prepare's set_display_device went out as A411 and crashed
both engines.

Translate each call's ID through the engine's build-selected table
(iomfb_v27_tag()): a method the tables name takes this build's ID, and
on 27.2 another A4xx ID (A449) moves up by 50 with the rest of
IOMobileFramebufferAP. Other IDs, and every ID on 27.0, are sent as
before.

Developed with Claude Code.

Signed-off-by: Erik Bourget <erik@ebourget.net>
Besides the paired calls, the firmware 27 paths name some calls by their
27.0 IDs: the primary's paired mode set (A413) and power step (A484), the
paired background swap (A408), the sleep's power and A500 steps, the
display stage calls and A442. On 27.2, which renumbered
IOMobileFramebufferAP, several of those IDs are other methods: the
paired mode's power step ran one and failed, and the second engine of a
4K240 mode never started.

Translate each of them through the engine's build-selected table
(iomfb_v27_tag()). The J714s's A407 swap keeps its ID, which only its
27.0 table names, and its diagnostic now refuses a pair whose engines
take different swap forms. 27.0 sends what it sent.

Developed with Claude Code.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The J716c's display processors take part in a deep sleep through the
firmware 27 endpoint transport, which was admitted on a 27.0
compatibility build only. On a 27.2 stub no processor registered for the
sleep, and every deep sleep was refused ("display 0: no provider").

Admit 27.2.0 as well. Its endpoint transport is the 27.0 one, and the
IOMFB calls the sleep makes are sent with the build's IDs.

Developed with Claude Code.

Signed-off-by: Erik Bourget <erik@ebourget.net>
axboe added 27 commits November 21, 2026 09:17
The T6050 entry refuses a sleep unless the PMU's RTC alarm is armed and
unmasked ("SoC check: -16"), so a lid close with no alarm set never
sleeps. The alarm is one wake source among several: the SMC wakes the
machine for the lid and the keyboard without it.

Accept a sleep with no alarm armed. The alarm is then not held against
the sleep timer in the final check and not rearmed after the commit.
With an alarm armed nothing changes.

Tested on a K116s: deep sleep with no alarm, woken by the lid.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The drivers that take part in T6050's firmware-driven sleep each name
the boards it has run on. Whether a board sleeps that way is in its
device tree: it has an enabled apple,t6050-sleep node or it does not.

Add apple_t6050_sleep_described() for that. What differs from one
description to another is a property of the node, read with
apple_t6050_sleep_property().

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The drivers tell one T6050 sleep description from another by the board
or by the node's compatible. What differs for the display coprocessors
is how they take the sleep: through their firmware 27 method table,
with the panel's AV and DP services, or through the sleep's endpoint
transport alone. Say so in the description.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The bits of the SMC's wake record are numbered per board: the ADT's
smc-pmu node gives each a name (event_name-bitN). Let the device tree
carry the bits and their names.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…C's wake reasons

Both were tied to the board's name in the drivers: the display
coprocessors' sleep through their firmware 27 method table, and the
numbering of the SMC's wake record. Describe them, the latter as the
J714s ADT's smc-pmu node has it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
A profile that names a machine is refused at probe on any other board,
whatever its CPUs. The node's compatible already chose the profile, and
what the entry depends on is the inventory: the boot CPU's MPIDR and
the CPU count. Check those alone.

The K116s (16-inch M5 Pro) binds apple,t6050-sleep with the J714s's
18-core layout and sleeps with that profile.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…ibed

The save and restore for T6050's deep sleep are set up on a list of
boards. Set them up wherever the device tree describes that sleep.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The saved-context lane is for T6050's deep sleep and was enabled on the
boards named here. Enable it wherever the device tree describes that
sleep.

The J714s's numbering of the wake record was a table picked by the
board's name. It is the ADT's smc-pmu numbering: read it from the SMC's
node (apple,wake-reasons, apple,wake-reason-names). Without them the
SoC's table is used as before.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…ny board

The empty CoreAnalytics event on the PMP's endpoint 7 is acknowledged
on the J714s only. It is the firmware's doing, not the board's: a
K116s's PMP sends it too, on the same endpoint. Acknowledge it for
every registry-v2 PMP.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The T6050 description, which stops the SIO at the sleep's commit, was
in force on the J714s by name. Follow the device tree: the boards that
describe the sleep. The J716c describes it and leaves its SIO disabled,
so nothing changes there.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…ibed

The attachment was made on two boards by name. Make it wherever the
device tree describes T6050's deep sleep; the node's own properties
still decide the rest.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…cribed

The host registered for T6050's deep sleep on two boards by name.
Register wherever the device tree describes that sleep.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The display DARTs' V27 provider was admitted on two boards by name and
the ISP DART's sleep on one. Take both wherever the device tree
describes T6050's deep sleep: the sleep takes the ISP DART's stream
registers on any of them.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…ep is described

The rules were in force on two boards by name. Apply them wherever the
device tree describes T6050's deep sleep.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The dwc3 glue took T6050's sleep lines on the J714s and the J716c by
name. Take them wherever the device tree describes T6050's sleep.

The port controllers' side of this is in already: their sleep rules are
asked for by the controllers' own properties.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The wrapped provider for T6050's deep sleep was used on two boards by
name. Use it wherever the device tree describes that sleep.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…ription

The V27 sleep's paths for the internal panel (the 27.0 method table
with the sleep call and the A407 swap, the panel's AV and DP services)
and what the external processors gained around it were in force on the
J714s by name. Follow the device tree: a sleep description with
apple,display-method-sleep. The J716c's has none and keeps its endpoint
transport.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Describe the RTC of the PMU on nub-spmi0, as the J714s does: the
registers are the T6041 PMU's, at the addresses this board's ADT gives.
It is a second RTC beside the SMC's and the only one with an alarm. The
PMU raises no alarm interrupt on this SoC, so the alarm is a wake source
for a firmware sleep only.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
iBoot leaves VENC0_SYS on (PS word 0xf0003ff). Its node is disabled on
the K116s, so nothing ever turns it off, and FAB0_SOC stays up behind
it. The J714s enables these power states for its encoder.

With VENC0_SYS on, the SoC does not enter the firmware-driven sleep:
the whole entry runs, and the machine resets about 5 s after the commit
word. macOS has VENC0_SYS off at its commit on this board (register
state read with macOS as an aura guest, the commit withheld).

Enable ps_fab1_piogw (firmware-owned), ps_fab0_soc (always-on) and the
ps_venc0_* states as on the J714s. Unused, genpd turns them off at
boot. No encoder is described yet.

Tested on a K116s: venc0-sys and its children read off after boot, and
the J714s commit sequence then sleeps.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…ional

The SoC values file ends with the J714s's USB4 router sleep (acio2, its
DART, the clock protection syscon), which needs nodes only
t6050-max.dtsi has. A board that includes the SoC values without that
router defines T6050_SLEEP_SOC_NO_CIO first. No change for the J714s.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The internal DCP of a T6050 on firmware 27.2 has the secure port T8140's
has (ADT dcp-exclave-mailbox, iop,secure-rtbuddy-proxy).

Signed-off-by: Jens Axboe <axboe@kernel.dk>
…p-pins

Without the property no pin is saved. A board whose ADT names no pin to
leave alone, the K116s, has every pin saved: the property is there and
empty.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The boot loader hands the display over only to a node whose mboxes is
the one ASC mailbox. A machine whose internal DCP has a secure port
names it in a property of its own there, and the driver takes it as the
"secure" mailbox.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The J714s's sleep controller description and SoC values on the K116s
(16-inch M5 Pro, firmware 27.2), with what differs on this board:

- apple,pinctrl-skip-pins is empty: the K116s ADT's gpio0 has no
  no-restore-gpio-pins. With the J714s's list the panel stays dark
  after a deep sleep.
- The display coprocessor's secure mailbox (ADT dcp-exclave-mailbox),
  named by apple,secure-mbox so that mboxes stays the one ASC mailbox
  for the boot loader.
- The MagSafe port's PD controller (hpm5), so that the sleep puts it in
  S3.
- The three port controllers ask for the sleep's rules for the system
  power state command and for the reset on a failed probe
  (apple,sleep-ssps-rules, apple,reset-on-failed-probe), as the J714s's.
- dcpext0 without its Type-C route, as dcpext1 to 3: the engine must
  bind for the sleep to stop its firmware.
- apple,sram-keep <0x56000 0x9b000> for the PMP: its __DATA starts at
  0x56000 on 27.2 (ADT segment-ranges). With the J714s's range the PMP
  does not come back from the sleep.
- The four clock words are parked with 0x80100000, as macOS does on
  this board (J714s: 0x80100400).
- apple,panel-video-open-delay-us 10000: the panel's plug takes about
  2.9 ms here, and with 2500 us the open landed before the firmware's
  close.
- No CIO sleep part: no USB4 router is described.
- apple,display-method-sleep and the SMC's wake reasons, as on the
  J714s: the K116s ADT's smc-pmu node numbers them the same way.

Needs a boot loader that hands the four DCPEXT to the kernel on 27.2
(aura with ext = true for the V27_2 images) and publishes the S2R
mailbox.

Tested on a K116s: sleep and wake by RTC alarm and by the lid, several
cycles a boot, and one sleep of 7.7 hours; display, NVMe, Wi-Fi and
Bluetooth work after the wake. The values taken
from the J714s (commit schedule, SMC policy, MCC and clock sequences)
have not been checked against this board one by one.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
The platform's limit on merged modes belongs to the external display
coprocessors of a machine, not to its sleep. Give it a property of
their nodes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
… display coprocessors

The driver applies the limit on the J714s. Say so on its four external
display coprocessors, for the driver to read.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
dcp_peer_limit_applies() rode on dcp_j714s_ext(), which follows the
sleep's description now. The limit is of the display engines, not of
the sleep: read apple,merged-mode-limit from the coprocessor's node.
The J714s sets it, so nothing changes there, and no other board takes
the limit.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
@axboe

axboe commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Ryan, done at b2607fb: the <ctype.h> include is its own commit right after #2187's three ("selftests: apple-dcp: give the T6041 admission fixture ctype.h"), and leaves this series when #2187 has it. apple-dcp passes here with it, t6041-v27-admission included. Nothing else changed from ddbc973.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, confirmed: with the <ctype.h> commit at b2607fb, host-tests passes, and all checks are green on this head. Keeping it as its own commit that drops out once #2187 carries it is the right shape. Nothing else is open on our side; the series still lands after #2309.

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.

4 participants