Skip to content

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

Merged
DjDeveloperr merged 37 commits into
aurora-silicon:mainfrom
axboe:k116s-sleep-27.2
Nov 25, 2026
Merged

DjDeveloperr merged 37 commits into
aurora-silicon:mainfrom
axboe:k116s-sleep-27.2

Conversation

@axboe

@axboe axboe commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The K116s (16-inch MacBook Pro, M5 Pro, T6050) on firmware 27.2 has no system sleep. The T6050 firmware-driven deep sleep in main is selected by board lists (J714s, J716c) and is written against firmware 27.0: on 27.2 the internal display coprocessor has a secure mailbox port that must go idle before the coprocessor takes its own idle, and the display calls are renumbered (#2187).

Change

With this series the K116s enters the deep sleep and wakes by RTC alarm, lid, power key or keyboard, with panel, NVMe, Wi-Fi and Bluetooth back. It is stacked on #2187, which brings the 27.2 call numbering and sleep transport: the first three commits here are #2187's, carried unchanged, and drop out when it merges. The 32 after them are this series.

Affects every T6050 machine that describes the sleep in its device tree: J714s and J716c as before, now selected by that description instead of by name, and the K116s, which the last commit enables. No board, chip or firmware-version gate is added; the remaining J714s check in macsmc.c is the one already in main.

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()); a port idle that is not acknowledged fails the idle. Where the port is named by apple,secure-mbox, RTKit takes its mailbox from that property.
  • 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.

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

Tested: K116s (T6050, M5 Pro), firmware 27.2; rows below. Host tests 503/503 and display selftests 94/94 at the head.

Risk: two-way · T6050 machines that describe the sleep (J714s, J716c, K116s). Shared drivers are touched (AIC, SMC, RTKit, SIO, NVMe, PCIe, DART, combo PHY, dwc3, G17, DCP); on other SoCs the changes are behind the T6050 sleep description.

The K116s does not sleep without #2187, #2309 and #2877, so every row is on a stack, named in the row. The command line is not the default (idle=nop among others).

Earlier rows, by head

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

Still to run

  • J714s and J716c: not run here, I have neither. What changes on them: a first buffer under the ANS hold is served, the J716c acknowledges the PMP's empty CoreAnalytics event, a J714s on 27.2 would take the wake's mode set, and both take the secure-port and strict-idle paths only if their device tree names the port.

  • Standalone on main + drm/apple: J716c external displays and display sleep on firmware 27.2 #2187 the series builds; it has only been run as part of the stack above.

  • Reset with Wi-Fi associated at entry. At the v6 head a raw rtcwake -m mem with Wi-Fi still associated reset the machine, 2 of 2. wifi: apple: centauri: t6050: harden keep-alive sleep fallback, PME gating, and 27.2 TLV 280 #2877 takes the warm-reset path instead of wifi: apple: centauri: t6050: keep N1 firmware, Bluetooth, and Wi-Fi alive across deep sleep #2718's keep-alive entry when the stack disconnected inside suspend, and with it on top of the v6 stack the same sleep resumes, 2 of 2 (rows in wifi: apple: centauri: t6050: harden keep-alive sleep fallback, PME gating, and 27.2 TLV 280 #2877). Until that is in, a sleep through logind is not affected, since NetworkManager takes Wi-Fi down first.

  • 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. Not tested on a J714s or J716c beyond building. What changes there is listed in the v2 comment: 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.

Revision history

v11 (2026-11-24): rebased onto main 35cfd76, no conflicts. The secure port's poller is stopped once the sleep is armed instead of at .prepare, and started again when a sleep is disarmed without the firmware having stopped, so a refused or cancelled sleep no longer leaves it off. The wake's two completions are reset before the calls that power the panel on. apple_rtkit_v27_port_ap_idle_atomic() checks that the acknowledged state is idle. A stale comment in t6050-k116s-sleep.dtsi is corrected.

v10 (2026-11-24): rebased onto main 974efa5. One conflict, in rtkit.c against the adopted-session argument of __apple_rtkit_init(); no other change.

v9 (2026-11-23): rebased onto integration/aurora 1b1304f and #2187's new head a56f2a5. One conflict, in t6050-k116s.dts against #2204 and #2214, which merged; both sides kept. No other change to the commits of this series. It builds, host tests 463/463, display selftests 94/94. Booted: see Testing.

v8 (2026-11-23): rebased onto integration/aurora 70a00e5 and changed after review:

  • The secure port's mailbox is no longer added to the live device tree. RTKit can take a mailbox named by a property of its own (apple_mbox_get_prop(), apple_rtkit_init_mbox_prop()), and the DCP uses that for apple,secure-mbox. The of_update_property() export is gone.
  • The SMC's wake reasons from the device tree are no longer overwritten on the J714s. Its built-in table stays for a device tree without the properties, and its dark wake rule has a flag of its own instead of comparing the table's address.
  • apple_rtkit_idle_strict_with() takes a callback that returns an error, and a secure port idle that is not acknowledged fails the idle.

v7 (2026-11-23): rebased onto integration/aurora 160ca43. No change to the commits of this series. #2187's three commits are carried as before; their head conflicts with the tip in two selftest files (apple-dcp/boot.py, run.py), resolved here by keeping both sides. Not booted at this head: it builds and the host tests pass (463/463).

v6 (2026-11-22): rebased onto integration/aurora bb9f8ec and #2187's new head 7375b71. Three commits left: the no-alarm commit (in through #2698), the <ctype.h> test fix (#2187 no longer needs it) and the A492 filler commit (#2187 now zeros the filler itself). Nothing else changed.

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).

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.

  • Clean-room: no Apple code, strings, firmware, RE output or tuning values
  • No chip/board/firmware-version gate where a hardware property can decide
  • Works on the default kernel command line; no hacks, delays or lab-only paths (rows are on my usual command line, see Testing)
  • Safety limits come from the machine, not from constants in code
  • Hardware safety rules followed for every test boot
  • Third-party commits unchanged; reporters and testers credited
  • Commits: human Signed-off-by only; no AI attribution in commits or PR text
  • Tested on the affected hardware; no regression

@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.

@axboe

axboe commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

v5 is up at ddbc973, rebased onto integration/aurora a84637d; the description has the details and today's K116s rows.

host-tests will be red on this head: apple-dcp t6041-v27-admission does not compile on the current tip with #2187's commits (isdigit() without <ctype.h> in the fixture). I have left a note on #2187; nothing in the 34 commits of this series touches it.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH at a01d61c1f397

Blockers: none

Checked: Full semantic interdiff from 6fd4b798070e to a01d61c1f397, full 35-commit diff against main (d420ae2bd61a), both dcp-v27-sleep.inc race fixes and both prior nits, §1–§6 compliance, exact-head CI (13/13 green), exact-head K116s hardware evidence, and dependency PR state (#2187, #2309, #2877).

Evidence
  • Prior blockers and nits resolved cleanly:
    • drivers/gpu/drm/apple/dcp-v27-sleep.inc:1363-1364, 1454-1459: dcp_secure_poll_stop(dcp) moved out of dcp_v27_sleep_prepare() to the end of dcp_v27_late_arm() (process context, only after all arm steps succeed), and dcp_v27_late_disarm(..., stopped=false) restarts it via dcp_secure_poll_start(s->dcp). Refusals during prepare or aborts before arm leave the poller running; aborts after arm restore it cleanly. Verified on K116s with a pm_test platform cancel-after-arm between deep sleeps.
    • drivers/gpu/drm/apple/dcp-v27-sleep.inc:73-77, 1227, 1260: dcp_v27_wake_expect(dcp) now calls reinit_completion(&dcp->v27_wake_video) and reinit_completion(&dcp->v27_wake_hotplug) before iomfb_v27_sleep_rpc(dcp, false, true) and again before iomfb_v27_sleep_plain(dcp, true), removing the post-power-on reset race.
    • drivers/soc/apple/rtkit-v27-late.inc:166-167: apple_rtkit_v27_port_ap_idle_atomic() now checks FIELD_GET(APPLE_RTKIT_MGMT_PWR_STATE, in.msg0) == APPLE_RTKIT_PWR_STATE_IDLE ? 0 : -EPROTO.
    • arch/arm64/boot/dts/apple/t6050-k116s-sleep.dtsi:264: stale live-DT-mutation comment updated.
  • Checklist (§1–§6):
    • §1 No model gating: Pass (apple_t6050_sleep_described(), apple,display-method-sleep, apple,merged-mode-limit, apple,wake-reasons, and method-table admission; only pre-existing main J714s dark-wake rule / old-DT fallback remains in macsmc.c).
    • §2 Production-ready: Code clean (no new cmdline/module params or hacks). Note K116s hardware row still used non-default cmdline (idle=nop).
    • §3 Safety: Pass.
    • §4 Clean-room & attribution: Pass (35/35 commits carry human author/committer and human Signed-off-by:; clean commits, PR title, and PR body).
    • §5 Evidence & CI: 13/13 active CI checks green at a01d61c1f397 (MERGEABLE onto main); exact-head K116s row present (4 deep sleeps + 1 pm_test platform cancel-after-arm, 0 SELinux denials, 0 failed units, 0 error-level kernel lines at boot, 0 new kernel errors at wakes, no wake-report timeout, no secure port warning).
    • §6 Naming: Pass (aura, no m1n1 or Honeykrisp).
  • Remaining before merge (external prerequisites):
    • Open dependencies: #2187 (carried as commits 1–3: 1bde4938f3f6, f57ed85491ab, 328e039f5692 — drop on rebase after #2187 merges), #2309, and #2877 are still OPEN.
    • Hardware coverage: default-cmdline verification on K116s and J714s/J716c regression runs for the shared T6050 driver changes.

DjDeveloperr
DjDeveloperr previously approved these changes Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at a01d61c1f397: the code point is fixed; it needs a branch update and one more row.

Blockers: none in the code. The secure poller is now stopped only once the sleep is armed (end of dcp_v27_late_arm()) and restarted on disarm, so a refusal in dcp_v27_sleep_prepare() leaves it running (v11, a01d61c1). The branch conflicts with main again; update it. After the update, the K116s rows still apply if the touched files merge without changes. Missing row: this touches code every Mac runs (apple-dart.c, irq-apple-aic.c, macsmc.c, pcie-apple.c, dwc3-apple.c, g17/sleep.c), so before it merges it also needs one boot at the updated head on a non-M5 Mac with an s2idle cycle and no new kernel errors. We'll run it on our J773g or J700.

Checked: no Apple material. The T6050 paths are selected by the sleep's own description, not the board. Host tests 503/503, display selftests 94/94.

@DjDeveloperr
DjDeveloperr dismissed stale reviews from themself November 24, 2026 22:05

Superseded by the review at a01d61c

@github-actions github-actions Bot removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
Conflict in drivers/mfd/macsmc.c: keep both sides' new helpers
(apple_smc_dt_wake_reasons() here, the WKTP full-wake ones from main),
and in apple_smc_dark_wake() take main's order (an already-dark wake is
counted first, on every board with a sleep policy) with this branch's
port_dark_wake test in place of the J714s wake-reason table compare.

Signed-off-by: Dj <[email protected]>
DjDeveloperr
DjDeveloperr previously approved these changes Nov 24, 2026
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026
satchlj
satchlj previously approved these changes Nov 25, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini 4 Neon on @satchlj's behalf

Verdict at 2b65b5180834

Approve — clean, well-factored generalization of T6050 firmware-driven deep sleep to DT-described boards (replacing hardcoded board lists) and firmware 27.2 K116s support, with 12/12 CI checks green.

Blockers

None for code review.

Note on merge readiness: As flagged by pr-readiness, an exact-head K116s hardware row at 2b65b5180834 is still owed before merge (prior K116s hardware verification was on v11 a01d61c1f397 before the final rebase).

Checked

  • Full static audit of all 35 changed files (+843/-94):
    • include/linux/soc/apple/sleep.h + callers (irq-apple-aic.c, macsmc.c, apple-m5-sleep.h, pcie-apple.c, atc-t6050-combo.h, dwc3-apple.c, apple-dart.c, apple-dart-v27-admission.inc, asahi/g17/sleep.c, dcp.c, sleep.c): replaces scattered j714s/j716c board-compatible checks with apple_t6050_sleep_described() / apple_t6050_sleep_property("apple,display-method-sleep") (checking apple,t6050 + available apple,t6050-sleep node) while preserving port_dark_wake scoping strictly to j714s.
    • drivers/soc/apple/mailbox.c + rtkit.c + rtkit-v27-late.inc + drivers/gpu/drm/apple/dcp.c + dcp-v27-sleep.inc:
      • apple_mbox_get_prop() / apple_rtkit_init_mbox_prop() cleanly support apple,secure-mbox without disturbing mboxes handoff expectations.
      • apple_rtkit_idle_strict_with() and apple_rtkit_v27_set_after_ap() / apple_rtkit_v27_port_ap_idle_atomic() execute secure-port AP idle between main AP idle ACK and IOP idle (both normal and interrupts-off atomic paths), failing/poisoning on error and restarting secure polling when !stopped on disarm.
      • apple_rtkit_alloc_first_shmem() allows first-time endpoint buffer allocation during ans_hold without replacing existing buffers.
    • drivers/gpu/drm/apple/epic/panelavep.c, iomfb_template.c, iomfb_v27.c: bounded v27_wake_video -> v27_wake_hotplug waits for firmware 27.2 renumbered methods before modeset, with clean completion init at probe and timeout warnings.
    • drivers/mfd/macsmc.c + macsmc-test.c: DT-driven apple,wake-reasons / apple,wake-reason-names parsing validates equal lengths, bit <= 63, and cleanly falls back to static tables if absent/invalid.
    • DT / bindings / KUnit updates: clean and consistent across all files.
  • CI at 2b65b5180834: 12/12 checks SUCCESS (kunit, dt-checks, host-tests, source, readiness, pr-text, rust-build, DWC3/ATC matrix).
  • Untested scope: no local K116s hardware suspend/resume run performed (static diff + CI verification only; exact-head K116s row at 2b65b5180834 remains owed).
Evidence
  • Changed files (35): +843/-94.
  • CI: 12/12 checks green at 2b65b5180834.
  • pr-readiness confirms no conflicts, CI ok, PR text ok; awaiting code-owner review and exact-head K116s hardware row at 2b65b518.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

The approved 2b65b5180834 now conflicts with main. Please merge current main into the existing branch and push the update without rewriting the PR branch. The SPMI prerequisite and the Wi-Fi prerequisite have both landed. Please flag any changes to the sleep paths relative to the reviewed series so the existing K116s and shared-board qualification can use the right candidate.

Keep the struct resource forward declaration added on main alongside
the <linux/of.h> include and apple_t6050_sleep_property() helpers in
include/linux/soc/apple/sleep.h.

Signed-off-by: Diljit Singh <[email protected]>
@DjDeveloperr
DjDeveloperr dismissed stale reviews from satchlj and themself via 478fb58 November 25, 2026 01:06
@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 25, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini 4 Neon on @satchlj's behalf

Verdict at 478fb58a902c

APPROVE — clean merge of main (e7528180365f) into the previously approved 2b65b5180834 head, preserving the struct resource; forward declaration in include/linux/soc/apple/sleep.h with zero unintended changes to the reviewed sleep paths, and all 13/13 active CI checks pass.

Blockers

None.

Checked

  • Changed files (35 files, +843/-94): Verified merge commit 478fb58a902c (parents: 2b65b5180834, e7528180365f, Signed-off-by: Diljit Singh <[email protected]>) resolves only the include/linux/soc/apple/sleep.h header conflict cleanly (retaining struct resource; alongside <linux/of.h> and apple_t6050_sleep_property() / apple_t6050_sleep_described()).
  • CI (13/13 active checks passing, 1 skipped, 0 failing, 0 pending):
    • Device tree checks/dt-checks: PASS (13m53s)
    • Host tests/host-tests: PASS (7m18s)
    • SEP source checks/kunit: PASS (10m32s)
    • MT7932 KUnit/kunit: PASS (5m40s)
    • Apple DRM KUnit/kunit: PASS (4m50s)
    • PMGR power state KUnit/kunit: PASS (4m18s)
    • SEP source checks/rust-build: PASS (3m31s)
    • SEP source checks/DWC3/ATC (×3): PASS
    • SEP source checks/source: PASS
    • pr-readiness/readiness: PASS
    • pr-text/pr-text: PASS
  • Untested scope: Live Apple M5 Pro (K116s, firmware 27.2) suspend-to-RAM hardware validation (carried by PR owner's hardware test rows).
Evidence
  • Merge commit 478fb58a902c614c613eacfd7a52bf1ae38b94b7:
    • Parents: 2b65b5180834f3352a2566c632452a632d88f757 (previously approved head) and e7528180365f06cd40aca475f5bfb3a6180c68c2 (main).
    • include/linux/soc/apple/sleep.h: retains struct device;, struct resource;, #include <linux/of.h>, apple_t6050_sleep_property(), and apple_t6050_sleep_described().
  • gh pr checks 2201 -R aurora-silicon/linux: 0 cancelled, 0 failing, 13 successful, 1 skipped, and 0 pending checks.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J773g (T8132, Apple M4, G16G B0) s2idle row: PASS.

  • Tested commit: PR commit 2b65b5180834f3352a2566c632452a632d88f757 (same PR diff as current head 478fb58a902c614c613eacfd7a52bf1ae38b94b7, which only merges newer main), built as 7.3.0-ARCH-pr2201 (aurora.ko Build ID 88042d5106b757b02f12b6b861b87d2b39531f0c).
  • DTB note: Because 2b65b5180834 predates arm64: dts: apple: t8132-j773g: don't use the managed radio contract #3098, booted with the 4-property J773g Wi-Fi DART strip (apple,managed-sids/apple,dma-range/apple,sid16-page on 490000000.iommu and apple,managed-sids on 1cb0000000.pcie); kernel Image, modules, and initramfs were unmodified from 2b65b5180834.
  • Boot & drivers: Booted cleanly over Wi-Fi SSH in 33 s (NPROC=10, /lib -> usr/lib, 0 failed units). macsmc (38c600000.smc, macsmc-rtc rtc0, macsmc-gpio, macsmc-hwmon fan 999 rpm, macsmc-input, macsmc-reboot; SMC_ERR_LINES=0), apple_pmp (380500000.pmp, PMP_READY=1, PMP_STARTED=1, PMP_VOTE_BRIDGE=1, CA_FAIL=0, die temp 49.75 C, THERMAL_SENSOR_ERRORS=0), all RTKit co-processors (RTKIT_CRASH=0, UNKNOWN_EP=0, RTKIT_ERRWARN=0), and all 15 DART instances (DART_PROBE_FAIL=0) initialized cleanly.
  • s2idle cycle (1/1 PASS): Armed rtc1 (apple-pmu-rtc) +10 s alarm and entered s2idle; woke cleanly with Wi-Fi SSH back 13 s after trigger (SUSPEND_STATS success=1 fail=0 mem_sleep=[s2idle]). Post-wake: SYSTEM=running, FAILED_UNITS=0, SMC_ERR_LINES=0, RTKIT_CRASH=0, BAD_PATTERN_LINES=0, WARNSET_UNCHANGED, GPU healthy (health: failed 0 errno 0 degraded 0, jobs 471, recoveries 0, hang_kills 0). Only expected pre-existing dwc3-apple genpd_prepare returns -11 entries appeared across suspend/resume, matching baseline J773g s2idle.
  • Cleanup: Restored clean idle 7.3.0-ARCH-m4prod25d + aura-383-r3-stage2.bin, removed candidate modules, verified DM=active and FAILED_UNITS=0.

@DjDeveloperr
DjDeveloperr merged commit 237b796 into aurora-silicon:main Nov 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants