Skip to content

J813 S2R: fix device recovery, SMC ordering and USB-C displays - #5

Closed
sithglan wants to merge 39 commits into
m0d16l14n1:j815/t8142-s2rfrom
sithglan:thomas/j813-dcp-s2r-followup
Closed

sithglan wants to merge 39 commits into
m0d16l14n1:j815/t8142-s2rfrom
sithglan:thomas/j813-dcp-s2r-followup

Conversation

@sithglan

@sithglan sithglan commented Nov 16, 2026 •

Copy link
Copy Markdown

J813 deep sleep could leave DCP running, crash SMC/ANS after MagSafe removal, abort the Wi-Fi or Bluetooth firmware, or leave USB unable to enumerate after wake. The sleep branch also omitted the working T8142 DisplayPort prerequisites, leaving a directly attached USB-C monitor dark. This series fixes device suspend/resume, SMC entry ordering, and the missing display support. The latest candidate completes timed physical sleep with display, GPU, both radios, USB Ethernet, CPUs and storage working after wake.

Based on m0d16l14n1/linux:j815/t8142-s2r at 64720d198ab0, after merged #4. Still draft: this is the J813 bring-up stack with explicit opt-ins; battery-only operation and wider peripheral coverage remain unqualified.

Changes

  • Stop/restart the internal DCP through its existing quiesce path with appledrm.s2r_untested=1; retain the external DCP CPUs at PS_MIN=4 so subsequent suspends receive A550.
  • Route and acknowledge J813's RTC alarm through Gen4 SPMI peripheral source 2, then restore interrupt enables.
  • Restore the radio PCIe host's MSI address, vector map and enable bit after link training.
  • Quiesce Bluetooth ACIPC before sleep, require sleep/wake acknowledgments, and restore Beta's DMA-backed MSI capability.
  • Send the final SMC MBSE/AP IDLE notice after ANS and the other peers stop. Reserve bounded IRQ-independent transport before irreversible stops, while retaining AP ON at the existing macsmc resume_noirq point. This is the fix moved from the now-closed aurora-silicon/linux#2086, committed here as 321a7e5c9faf.
  • Restore T8142 ATC common/PIPE state after physical sleep and keep the dummy PHY enabled while parked (8fa560769da0).
  • Add the J813 Alpha Wi-Fi sleep sequence behind apple_centauri.alpha_sleep_untested=1: pause traffic/work, send the disconnected host-power request, then request ACIPC sleep and wait for status 3. Resume ACIPC before sending host-awake and restarting producers. Failed acknowledgments refuse entry or leave traffic paused. The installed firmware accepts at most 85 events in the host-power filter; the newer native driver's 91-event format is rejected. This path supports the ordinary disconnected suspend case, not associated WoWLAN.
  • Restore the working J813 USB-C display stack: T8122 AUX/AUSPLL/lane setup, LIOA/common calibration, PIPE boot-hold release, USB fallback without calibration, and T8142 DPTX route ordering/PCLK1. Carry the existing EIZO DPMS bad-link and first-enable relink fixes. Host fixtures cover the restored fields and full route-apply body.
  • Retain the tested prerequisites: arm64: dts: apple: t8142-j813: Add the cluster power gates aurora-silicon/linux#1942 cluster power gates; J813 SEP profile/high DMA window; GPU TEXT reservation, firmware 26B123 support and sleep restart; display admission, DPTX/power/DART bindings and firmware 27.2 support; and T8142 AON audio policy. Original authorship and test-only labels are preserved.

USB-C display validation

PR head 0c3e9bd5883f matches candidate 347f5a29b5bb, tree a02127e47fec3cd470d8c8ad7ca0998b54193aa7. Runtime code was tested at f7bfa05fae9e; the final commit only updates host fixtures. Image and modules build with arm64 LLVM 22; strict checkpatch reports 0 errors/warnings/checks. All 88 DCP host groups pass; fabric KUnit reports 117 pass, 0 fail, 1 skip.

Boot 55029578: the directly attached EIZO EV2780 runs on DP-2 at 2560×1440@59.951 alongside the internal panel at 2560×1600@60. Three DPMS off/on rounds pass. A cancelled preflight and one eight-second physical RTC sleep pass with the monitor attached (host UTC 19:29:33 → 19:29:41, boot-object counter 0 → 1, SPMI alarm, ANS 168 ms). Both outputs return active and the user confirms the EIZO desktop after wake. GPU readback, Bluetooth HCI, ten CPUs, Wi-Fi-bound traffic, monitor USB3 hub and direct storage checksum pass. Firmware logging was never initialized. This test used external power and Wi-Fi, with the two USB-C ports occupied by monitor and debug tether.

Earlier Alpha validation

Before the display restoration, the source tree matched tested Alpha candidate 53e28baf350d: 47c3a6e4596bd05cdce8cb52fd16649bb6a3b1a5. The Alpha module builds with arm64 LLVM 22 and its complete submitted diff passes strict checkpatch with zero errors, warnings or checks. The unchanged USB/SMC Image.gz, other modules and DT passed their full build.

On 2026-11-16, four physical RTC wakes and one automatic lid wake passed across two boots:

Boot Sleeps Firmware logger ANS restart
049f0fc1 8 s, 20 s Enabled 169, 167 ms
bd3f61e4 8 s, 8 s Never initialized 169, 169 ms
bd3f61e4 Lid close/open Never initialized 168 ms

Each wake passed active-panel restoration (brightness 100, fbcon bound), actual Apple M5 GPU clear/readback (00 ff 00 ff), Bluetooth Read Local Version (0x1001), all ten CPUs and CPU0 work, USB3 RTL8153 Ethernet, a direct 32 MiB disk checksum, and three gateway pings explicitly bound to Wi-Fi. Physical boot-object counters advanced 0 → 1 → 2 on the first boot and 0 → 1 → 2 → 3 on the second. Host timestamps verify the sleep durations; these were physical wakes, not s2idle. Three cancelled preflights also passed, including with WPA running and without the firmware logger.

Before Alpha's handshake, the USB candidate woke immediately via SMC.OutboxNotEmpty/MBSW wifibt and returned Alpha in abort stage 3. The latest candidate remains at stage 2, waits for the RTC deadline and wakes via the SPMI alarm. The subsequent lid wake used MTP with the SMC lid bit set; logind recorded closure, suspend, reopening and resume. The user confirmed desktop, Wi-Fi and USB operation, and the same independent device checks passed. Raw firmware/crash captures remain private.

Separate earlier coverage:

  • The DCP/RTC/MSI/Bluetooth stack completed 25 physical RTC cycles across five boots; that count is not validation of the later Alpha change.
  • The SMC ordering candidate completed three RTC and two physical battery lid wakes with display, GPU, radios, CPUs and direct storage checks.
  • The USB candidate passed empty-port sleep followed by hub/RTL8153 hot-plug and another cancelled suspend, without a PIPE timeout. Missing Realtek firmware and an uncabled-dongle network-readiness delay were fixed in userspace, outside this PR.

Setup and limits

Tests use CONFIG_KEXEC=y, aura PCIe/Wi-Fi handoff tables, apple_sleep.deep=1, nvme_apple.sleep_untested=1, appledrm.s2r_untested=1, idle=nop, arm64.nowfxt, and the new Alpha opt-in. Physical tests explicitly arm apple_sleep.untested_commit=1. SEP is attached with writes, provisioning, trusted keys and FileVault API disabled. Audio remains enabled.

The newest RTC cycles used external power and a connected Ethernet hub. During the subsequent successful lid check, the system still reported AC online, so battery-only operation is not established. Empty-port hot-plug with the complete stack and longer-term reliability also remain to be qualified. Earlier watchdog resets on the rebased stack were resolved by restoring the missing aurora-silicon#1942 cluster power-gate DT prerequisite.

The gig3m write-up was checked at revision 3da9315d2381d496077d76e7e1dc5065f41a3eaf.

m0d16l14n1 and others added 12 commits November 16, 2026 12:46
hw.s2r stops the internal DCP's firmware and powers its domains off when
the display is turned off, and restarts it warm on DPMS on. Only T8140
had the data for it. This adds what T8142 needs:

- the power words and DART streams become a per-SoC layout
  (dcp_s2r_layout), with T8140's values unchanged and T8142's derived
  from the macOS 27.2.1 device tree and PMGR (DISP_SYS at 0x290,
  retention words 0x11cc/0x11f0, no exclave streams, no pmc-dcp);
- firmware 27.0's sleep calls: set_power_state and the AP link release,
  which 27.0 still dispatches as A500, and D572 (powerUpDART). A build
  whose table has no tag for the release (27.2 and later moved it) is
  not offered the stop, and T8142 is offered it on firmware 27.0 only;
- T8142 has no DCP secure mailbox (no dcp-exclave-mailbox in the 27.0 or
  the 27.2.1 device tree of a J813), so the stop no longer requires one
  on this SoC (s2r_no_secure_port).

The stop stays off by default on T8142 (appledrm.s2r_untested=1 enables
it).

This is a screen-off (DPMS) power saving. No firmware-driven system
sleep has run on T8142, and a SoC behind appledrm.s2r_untested does not
take the stop's system sleep path.

Tested on a J813 (MacBook Air 13" M5, firmware 27.0) on this series,
with and without appledrm.s2r_untested=1: DPMS off stops the firmware,
DPMS on restarts it ("RTKit: Initializing") and the panel comes back at
its brightness, 6 of 6 cycles. System power with the screen off (SMC
PSTR, on battery, 12 and 15 samples): 2.72 W without the stop, 1.81 W
with it.

The driver part is from m0d16l14n1's J815 sleep work
(m0d16l14n1#1, 192a56c), without its hibernation and deep
sleep pieces; the secure mailbox change and the J813 test are new.

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
dcpext0 and dcpext1 of the T8142 (MacBook Air M5: one per USB-C display,
J704: HDMI) run the internal DCP's firmware 27 image; iBoot leaves them
running idle and the boot loader hands them over. Give them the T6050
external profile's shape: adopt the live session, one DPTX port, EDID
from the sink metadata. A processor that fails to probe or bind joins as
an unusable pipe and the internal panel goes on.

Not booted.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <nekreshen@yandex.ru>
(cherry picked from commit 0663908)
…PTX_ENDPOINT

On a J813 the external processors booted, then timed out waiting for the
DPTX port ("DPTX transport ready but port 0 service not announced",
-110), and every connect found no port service. The T8142 dcpext had the
T6050 external profile, which opens firmware 27's DPTX_ENDPOINT_V2 (0x2c)
and no DPTX controller.

macOS 27.2 on a J815 (IORegistry under iop-dcpext0/1-nub, RTBuddy
EndpointN = 0x1f + N) binds, per external processor:
- AppleDCPDPTXController (dcpav-controller-epic, dcpdp-controller-epic,
  units 0 and 1) on 0x24, DPTX_CONTROLLER_ENDPOINT;
- AppleDCPDPTXRemotePort (dcpdptx-port-epic, units 0 and 1) on 0x2a,
  DPTX_ENDPOINT; 0x2c has no service;
- dcpdptx-hdcp-interface on 0x2b.
dmitzsaz's J704 tree opens the same: the controller first, the ports on
DPTX_ENDPOINT with firmware 27, two ports.

Add two hardware data fields, dptx_endpoint and dptx_controller, and set
them for the T8142 dcpext with two DPTX ports (Type-C still uses port 0).
The controller endpoint speaks the same wire as the port, so it now
takes the OPEN handshake on firmware 27 too; for the H17P externals,
the only ones that opened it before, nothing changes.

Not booted yet.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <nekreshen@yandex.ru>
(cherry picked from commit 002bae8)
Adopt the working external display DT and use the firmware 27.2 link release before RTKit idle. Give each external processor its own power layout and include both in the sleep controller. Both warm restarts pass a dry run; real sleep still resets, with all external power states now matching macOS.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J813 external display processors complete the warm RTKit handshake
after deep sleep, but lose CPU_CONTROL.RUN within 20 ms. The next suspend
queues an AP-link release that the stopped processor cannot answer.

Set PS_MIN to 4 before raising the external CPU domain and enabling its
automatic power management. This matches the measured J813 macOS wake
sequence and the existing T8140 external DCP path.

On J813, both processors now retain RUN after wake and answer the next
suspend's link-release request. The second full sleep still needs further
debugging; this fixes the display processor retention failure.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
T8142 has no GAPF slice for the DCP DART. Its SPTM (27.2.1) keeps a bit
per DART in a shared PS write-disable register instead
(/chosen/dart-ps-wr-dis-entries): set, the fabric rejects writes to the
power word of the coprocessor CPU behind the DART. The driver clears
that bit where it clears GAPF bit 4 on T8140, for a DCP firmware stop,
and sets it again after. Only this DART's bit of the register is
changed.

A GAPF slice is handled as before. Nothing of the shared register's
boot value is written back, only this DART's bit.

From m0d16l14n1's J815 sleep work (m0d16l14n1#1, 192a56c),
taken out on its own for the DPMS firmware stop.

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
T8142's display power node has the power gate and power state words
only: its PMC keeps no count of the powered coprocessors, so there is no
pmc-dcp word.

From m0d16l14n1's J815 sleep work (m0d16l14n1#1, 192a56c).

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
The power gate and power state words a DCP firmware stop writes, and the
DCP DART's PS write-disable bit that protects DISP_CPU's power word
(ADT dart-dcp clock-protection-wr-dis-id 0x1f: pmgr reg[1] + 0x3fdc,
bit 6).

Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
On a macOS 27.2 (26B123) stub, the J813 refuses its DCP's
apple,firmware-compat of 27.2.0. It then drives the DCP with the H17P
interface, and the 27.2 DCP firmware crashes on the first call
("ap_link: rpc_callee_gated: link_rpc_lookup callback not found:
'A427'").

The firmware 27.2 method table (iomfb_v27_methods("27.2.0")) drives the
J813's 27.2 DCP: with it the DCP boots, the panel comes up at 2560x1600
and sway presents on it.

Admit 27.2.0 on T8142 as firmware 27, so that probe picks that table.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the status word and source mask that the sleep driver owns on
the Gen4 SPMI controller. T8142 needs the corresponding peripheral
interrupt enabled as well as the RTC alarm programmed to wake the AP.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Programming the RTC compare is insufficient when the Gen4 SPMI
peripheral source remains masked. J813 reached PMU stage 0x68 on its
second sleep; RTC_CTL showed FIRED, but the fresh aura entry marker
never changed. Enabling peripheral source 2 manually allowed a second
physical resume, with NUB.SPMI0.SW3 reported and the boot ID preserved.

After successfully programming the next alarm, acknowledge only the DT-
owned stale sources and enable their route. Restore their previous
enable state during wake, preserving other sources. This avoids using an
old latched alarm as the next wake event.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J813 ADT assigns PMU peripheral interrupt 2 to the RTC path. macOS
enables it at nub-spmi0 offset 0x400 and acknowledges it at 0x600.
Describe that source for the sleep driver.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan sithglan changed the title J813: retain external DCP CPUs after wake and include display prerequisites J813 S2R: retain external DCP CPUs and route RTC wake Nov 16, 2026
gig3m and others added 3 commits November 16, 2026 14:14
T8142 has the same per-cluster power-gate enable words as T8132 and T8140.

Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
iBoot leaves the boot core's power-gate enable (P core 0,
/arm-io/pmgr reg[34] + 0x60) clear on T8142, so the boot core never
powers down in WFI. The node lists the E and P clusters' first words,
which apple-cluster-pwrgate sets early in boot. T8132 and T8140
describe the same words; there they are enabled for deep sleep, here
for idle power.

Tested on a J813 (MacBook Air 13" M5, firmware 27.0), same kernel with
and without the node, on battery, SMC PSTR:
- PCPU_0's power state word reads off in idle with the node, on
  without it;
- screen off, idle: 2.72 W without, 2.54 W with (12 samples each);
- screen on, idle: 3.93 W without, 3.83 W with (3 samples each).
All 10 cores come up and the system runs as before.

The register layout is from m0d16l14n1's J815 sleep work
(m0d16l14n1#1).

Assisted-by: Claude Fable 5.2
Signed-off-by: Kyle Arrington <kyle@arrington.co>
The T8142 platform wake retrains the radio port with its reset values. The MSI doorbell address and enable bit programmed at probe are then lost, while the PCI core only restores the endpoint MSI capability. Keep the mapped ports and replay their MSI routing during noirq resume after a firmware-driven sleep.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan sithglan changed the title J813 S2R: retain external DCP CPUs and route RTC wake J813 S2R: retain DCP CPUs and restore RTC/MSI wake routing Nov 16, 2026
Pause ring doorbells, request ACIPC host sleep and require its shared-memory acknowledgment before the link goes away. Wait for the wake acknowledgment before restarting polling, and unwind a refused entry.

Restore the DMA-backed endpoint MSI capability after PERST; it is programmed outside the PCI core's allocated-vector state.

The native 26B123 AirshipDK protocol is verified with the installed J813 firmware. Enable the handshake on J813 only; other boards need qualification.
@sithglan sithglan changed the title J813 S2R: retain DCP CPUs and restore RTC/MSI wake routing J813 S2R: restore DCP, RTC, MSI and Bluetooth across repeated sleeps Nov 16, 2026
Describe the J813 SEP, mailbox and power domains, publish its alias for
aura's firmware/manifests handoff, and admit J813 to the T8142 profile.
Leave sep_dart disabled until the SEP module enables it.

Describe the ADT's SID0 DMA aperture directly with no DART offset. The
profile fallback gives the DMA API a low address and adds BIT(40) only
to the page-table mapping; the SEP consumed that registration without
replying. The explicit high window matches the existing J813 Touch ID
work (7003518) and the macOS s05 registration trace.

On J813, fresh attach with xart_writes=0 provision_keybag=0 trusted_keys=0
filevault_api=0 changes from zero replies at IOVA 0xfffc0000 to all 12
endpoints ready at IOVA 0x100fff80000. The key store opens and hwrng
registers. The sleep dry run passes with eight coprocessors; a real
commit still resets with no aura wake marker. This is sleep bring-up,
not Touch ID or suspend/resume qualification.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit c1a2048)
The J813 GPU driver is about to identify the firmware build iBoot loaded
before it starts it, as the M5 Pro and Max do: it measures both roles'
__TEXT, which iBoot loads back to back (ADT gfx-asc and gfx1-asc
segment-ranges, 0x50000 + 0x4c000 bytes).

Add the region as fw-text. Like fw-data, it is fixed at the address
iBoot uses under macOS 27.0 (26A428), 0x100_00e4_4000, until the boot
loader fills it in. Under 27.2 (26B123) iBoot loads the TEXT 64 KiB
higher, at 0x100_00e5_4000, and the DATA at 0x100_0245_8000, so a 27.2
boot needs a loader that fills both.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit 1fadec2)
The J813 runs the common 26A428 InitData graph, the J873's interface. macOS
27.2 (26B123) ships a new G17G build (RTKit 3514.41.1), which never
acknowledges that graph: the secondary's InitData times out.

The 26B123 interface differs from 26A428 in three places, the same three
as the J873's G18G build of this release:

- both roles expect the InitData root version word with bit 45 set,
  0x0c8b_6339_83a0_04c0;
- the policy grows by 0x60 and the status config by 8; the other 22
  allocations keep their sizes. Everything after the policy in the shared
  cluster moves by 0x80; the page total and the private cluster (0x6d8
  still packs to 0x700) stay as they are;
- policy fields +0x2f0c..+0x2f17 move by 0x10 and +0x2fb4..+0x6d9f by
  0x18, with a new word at +0x2f28; status-config fields +0x59c..+0x5b3
  move by 4 and +0x5b4 to the end by 8, with a new word at +0x5b8 and
  +0x59c left zero. The new words carry a new accelerator power-controller
  field, which the generic power and performance setup sets to 5000 and
  the G17G one leaves alone.

The HW data, the roots, the main configs, status B and region C keep
their field offsets.

Add the 26B123 profile and graph. The 26A428 encoders run unchanged and
their policy and status config are moved in place by bands; a nonzero
byte no band carries is refused. Compile-time checks keep the bands
ascending and inside the new sizes. The board for it is J813_26B123; no
configuration selects it yet, and the 26A428 encoding is unchanged.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit 2bb41c8)
The J813 ran a fixed variant: it started whatever firmware iBoot had
loaded on the 26A428 graph. Under the macOS 27.2 stub that is the 26B123
build, which needs its own graph.

Identify the loaded build as the M5 Pro and Max do, from the fw-text
region: both roles' TEXT (G17G c000, then c010), with the entropy
records and the ranges iBoot fills zeroed (the image header's load
fields, the boot arguments before each role's GKTS record and the
records from it). The 26A428 build keeps the J813 configuration; the
26B123 build runs the board on the 26B123 graph. Both digests reproduce
from the stock images in the IPSWs with the same ranges zeroed and were
measured on 27.0 (two boots) and 27.2 boots. An unknown build is refused
before anything is written to the GPU.

Tested on a J813 under the macOS 27.2 stub, with fw-text and fw-data at
the 27.2 addresses: both roles acknowledge the 26B123 InitData, the
render node registers, and Mesa runs GLES2 16955/0, GLES3 44379/1 (an
order-dependent texture-units case that passes alone) and GLES31 37339/0,
matching the 27.0 results.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit 349d61e)
…ops, wake restarts)

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit 0367ba8)
The firmware 27.2 table has no ID for dfb_ready_query, so boot_5()
skips the query on 27.2. The 27.3 trace sends it at A385, one above its
27.0 ID, as 27.2 moved set_create_DFB and vi_set_temperature_hint up by
one.

Give the 27.2 table A385, so 27.2 boots with the same sequence as 27.0.
The J813 ran with this table on 27.2: boot_done() acknowledges the DCP's
boot callback only after the query's reply, and the DCP booted and the
panel came up.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit 801cec0)
The M5's DCP announces powerlog-service on ep:20 with only
ep-has-desc-mgr and interface-id. AFK matches such a service by its
announced name, but only for the H17G method profile, and a T8142 on
firmware 27 runs the default profile. So on 27.0 and 27.2 the service is
never bound ("AFK[ep:20]: failed to extract init props: -2"), and the
mNits reports it carries, the loader-level hint that
dcp_backlight_takeover() takes on firmware 27, could never arrive.

Fall back to the announced name for a T8142 on firmware 27 as well: the
H17P-generation processor (hw.firmware_compat) that probe admits as
firmware 27. The service-rebind host test's apple_dcp gets that field.
On 27.2 the service now binds on channel 1. That firmware sent no report
in the first minutes after boot, so the backlight still starts from the
fallback level there.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit 0e76ef5)
On firmware 27 the first present of a new KMS client (modetest, kmscube)
fails with "present dropped: backlight prepare -61" and "swap failed!",
and modetest -v then sees no page flip. With the panel backlight active,
iomfb_apply_backlight_h17p() drops every present that
dcp_backlight_prepare() refuses. dcp_bl_prepare() refuses a present
without a surface with -ENODATA, because such a present cannot apply a
new level, so the whole present is dropped rather than only the level.

Treat a present without a surface as one with nothing to reserve: it
carries the last completed level and is sent, and a pending level waits,
still dirty, for the next present with a surface. Only the H17P/firmware
27 path asks without a surface; the M4 and 14.7 callers always pass one.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit f99c37a)
Port the audio power policy from the successful J813 experimental stack:
do not apply T8132's forced state-4 list to these no_ps domains.

Keep the updated sleep branch's own PMU diagnostics. The old diagnostic
hunk is omitted because it uses the same scratch bytes differently.
This prerequisite has not been isolated as the cause of a failure.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit 8dd86e4)
The system-suspend callback skipped every s2r_untested instance even after probe admitted J813 through appledrm.s2r_untested. With the panel active, the DCP kept RUN and the sleep controller refused entry.

Use the existing qualified DCP quiesce and restart path on J813 during system sleep. Preserve the explicit opt-in and all existing readiness checks; other unqualified boards keep their prior behavior.

Validated active-panel sleeps with and without fbcon bound, followed by three systemctl suspend cycles. The panel, GPU rendering and Bluetooth recovered each time.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
After a battery lid suspend on J813, ANS failed its IOP IDLE handshake
and SMC faulted at the ANS mailbox. Linux resumed, but ANS could not
restart and DCP power-on timed out. The matching native trace idles
ANS before the final SMC MBSE/AP IDLE sequence.

Defer that sequence until the peer stops have finished. Reserve the
existing bounded SMC transport before IRQ shutdown and check ownership
before irreversible stops. Release it at platform wake, retaining AP
IDLE until macsmc resume_noirq so the original wake-notice timing is
preserved. Earlier tests with AP ON in platform wake had Alpha Wi-Fi
aborts; preserve the established ordering without claiming that the
timing change alone explains those failures.

Keep the J813-only diagnostic switch, command sequence and delay floors.
Three RTC and two battery lid wakes completed on the candidate stack.
The resulting source tree is identical to tested candidate 651007b.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
T8142 loses its common PHY and PIPE state across a physical sleep
outside genpd's normal transitions. Mark that loss at resume and use
the existing baseline/mode restoration path before another controller
or Type-C operation. Keep the dummy PHY enabled when parking so the
next PIPE handoff has a producer after the boot state is lost.

On J813, hot-plug after battery lid wakes timed out in PIPE parking and
blocked later suspend during device prepare. With this change the hub
and RTL8153 enumerate at USB3 speed after an empty-port deep sleep,
establish Ethernet SSH, and pass another suspend preflight. A hub left
attached across sleep also re-enumerates.

Alpha Wi-Fi still aborts across some physical sleeps; this change does
not address that failure.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan sithglan changed the title J813 S2R: restore DCP, RTC, MSI and Bluetooth across repeated sleeps J813 S2R: restore devices and correct SMC sleep ordering Nov 16, 2026
sithglan and others added 11 commits November 16, 2026 19:49
J813 can resume with Alpha aborted and an immediate wifibt wake while the other devices recover. Send the disconnected host-power request before ACIPC host sleep, and restore ACIPC before the awake request. Match the installed firmware's event-filter limits. Pause ring traffic and background work across the transition and require acknowledgments before restarting producers.

Keep the bring-up path behind apple_centauri.alpha_sleep_untested=1. Three cancelled preflights and four physical RTC cycles across two boots passed with active panel, M5 GPU, Bluetooth, Wi-Fi-bound traffic, USB Ethernet, CPUs and direct storage reads. The second boot never initialized the firmware logger. The complete source tree matches candidate 53e28ba.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Run the T8122 AUX, AUSPLL and lane sequences for T8142. Apply
loader-supplied LIOA and common-configuration calibration before AUX,
using separately claimed resources. Refuse DP without the complete
calibration bundle.

Serialize lane validation with Type-C mux setup so DCP sees lanes only
after AUX is ready. No board identity or out-of-resource MMIO mapping is
needed.

Signed-off-by: Dmitriy <noc@pimk.in>
(cherry picked from commit df6cd4a in
 dmitzsaz/linux)
Signed-off-by: Nick <nekreshen@yandex.ru>
(cherry picked from commit 4e47750)
A port left at reset by the loader retains bit 16 of the nonselected
PIPE override. The dummy backend cannot acknowledge its lock while this
hold is asserted. Clear it before enabling that backend on T8142,
including ports which the loader did not initialize.

Signed-off-by: Dmitriy <noc@pimk.in>
(cherry picked from commit def4169 in
 dmitzsaz/linux)
Signed-off-by: Nick <nekreshen@yandex.ru>
(cherry picked from commit 0db8f37)
A device tree written before DisplayPort was described has no "lioa"
window. Probe as before then and leave DisplayPort off, instead of
failing the probe and taking USB down with it.

Signed-off-by: Nick <nekreshen@yandex.ru>
(cherry picked from commit 7292f7d)
… DisplayPort calibration

On T8142 the mode switch refuses every mode with DP AUX while the boot
loader's LIOA and common configuration banks are missing ("DisplayPort
bank calibration missing; DP disabled"). A partner in DP Alt Mode then
loses its USB as well: on a J813 with a dock in pin assignment D, under
a loader without the bank export, the PHY init fails with -EOPNOTSUPP
and the port's dwc3 never probes, where the kernel before the T8142
DisplayPort sequence ran the dock's hub at 10 Gb/s.

Map the DP modes to the USB the partner keeps, as T8132 does: USB2 next
to four DP lanes (pin assignments C and E), USB3 next to two (D).

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit ca7da9d114f79b533e2bf33834876dbcf982d7c9)
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Run a T8142 external processor's route admission in the fallible Type-C
finish phase, after every supplier has applied its hardware state. DCP
then observes completed AUX and lane setup without polling for PHY
readiness.

Release an unasserted DP-alt owner and leave a pin assignment with no
sink unallocated, so the pipe can serve a display on another port.

T8142's Type-C PHYs are of the T8122 generation and report no link
configuration: give the crossbar their fixed pixel clock (PCLK1, 8b/10b)
when DCP brings a link up.

Based on dmitzsaz's J704 commit 3829b86 ("drm/apple: Order T8142
DPTX after Type-C PHY configuration") and the crossbar clock of his
dcp_direct_crossbar_link(), limited here to apple,t8142-dcpext so
that the T6050 firmware 27 routes keep their order.

Signed-off-by: Dmitriy <noc@pimk.in>
Signed-off-by: Nick <nekreshen@yandex.ru>
(cherry picked from commit 6973576)
A USB-C monitor plugged in while the outputs are off (a compositor's
idle blanking) gets its link trained only when its CRTC is first
enabled, possibly minutes later. On a J813, an EIZO EV2780 attached
that way lost the link at that mode set: DCP logged "IOAVVideoInterface
prepareLink() failed with 0xe0114100" and dropped the sink, which still
asserted HPD and stayed attached in DP Alt Mode. The relink window had
been opened at the attachment, 137 s earlier, and the CRTC had never
been powered off, so the DPMS wake path did not open it again either.
The display stayed dark until the cable was replugged; a replug with
the outputs on brought it up at once.

Time the window from that first enable as well, as dcp_dptx_connect()
does for the attachment. Unlike a DPMS wake, it keeps the attachment's
retries.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
A DPMS off of a Type-C output releases its DPTX session; the enable
that follows reconnects it in dcp_poweron() before the mode set of the
same commit. The HPD the firmware answers that reconnect with runs the
hotplug worker while the mode is not set yet, and the worker reported
the link bad and replayed the CRTC. wlroots answers a bad link by
destroying the output, which disables the CRTC it was enabling; the
next enable does the same, forever.

On a J813 with an EIZO EV2780 on USB-C, every DPMS off and on ended in
that loop: about three cycles a second ("connector DP-2: Bad link
detected", "Destroying output 'DP-2'"), the display dark and the
desktop sluggish, until the output was disabled or the cable pulled.

Mark the CRTC enable as pending from dcp_poweron() until its mode set
has run, and let the worker report a bad link, or replay the CRTC, only
when no such enable and no mode set is in flight. A mode set that fails
still ends in a bad link once the enable is done.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
(cherry picked from commit e6e28269f2a1ba9f75d688c0559574b05718c45a)
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Carry banked calibration fields in the PHY fixtures, observe the two calibration-bank dispatches in the existing profile test, and keep route transaction tests on the complete production apply body. Supply the opaque sleep-layout pointer used by the resource-profile fixture. All 88 host groups pass.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan sithglan changed the title J813 S2R: restore devices and correct SMC sleep ordering J813 S2R: fix device recovery, SMC ordering and USB-C displays Nov 16, 2026
@gig3m

gig3m commented Nov 16, 2026

Copy link
Copy Markdown

Tested 0c3e9bd5 on my J813 with your thomas/j813-el2-s2r aura (693083b4). Boot arguments were the PR's set, including apple_centauri.alpha_sleep_untested=1, idle=nop and arm64.nowfxt, with N1 started through rom_boot 1/2/3. Six physical RTC sleeps (31–32 s, all wake source: NUB.SPMI0.SW3) across three boots:

  • Text mode, 2 cycles:
    • The Alpha handshake completed both times (host sleep status=3, then host wake and host awake).
    • After each wake: Wi-Fi gateway pings bound to wlp1s0f0, ten CPUs, a 32 MiB O_DIRECT read, and hci0 present.
  • Hyprland desktop, systemctl suspend, 2 cycles in each of two boots:
    • The same checks pass after every wake.
    • The internal panel returns, with the lock screen rendering on DPMS on.
    • A paired BLE mouse (Keychron M3) reconnects with its input devices.
  • ANS came back in 168–318 ms. Two of the first wakes after boot took about 300 ms.

Bluetooth address: your J813 tree is missing 223d7d72 ("arm64: dts: apple: t8142-j813: add N1 factory address targets", Diljit Singh, in m0d16l14n1's j815/test-next). Without the wifi0/bluetooth0 aliases, the loader has nowhere to copy the ADT factory addresses:

  • The kernel logs hci0: No factory local-bd-address from the loader.
  • BlueZ then reports No default controller available.

A raw HCI Read Local Version still succeeds, so the HCI check in your validation can't see it. With the commit added (a one-hunk conflict next to the t8142-peripherals.dtsi include; I kept both), the kernel logs factory address in use, the controller is powered, and the mouse works across the sleeps above. You may want it in the series.

Hyprland: to run it on this tree, I also carried my local XRGB8888 primary-plane patch. Without it, aquamarine aborts with format XR24 isn't supported by primary backend. That's a property of my setup rather than your series, since upstream keeps the alpha-only plane restriction.

Logs available if useful.

Drafted with Claude Opus 5.5.

@sithglan

Copy link
Copy Markdown
Author

Superseded by aurora-silicon#2135

@sithglan sithglan closed this Nov 17, 2026
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