Skip to content

drm/apple: T6050: restart the display coprocessors during the wake (internal panel lit after deep sleep) - #2028

Merged
DjDeveloperr merged 4 commits into
integration/aurorafrom
j714s/dcp-v27-wake-restart
Nov 16, 2026
Merged

DjDeveloperr merged 4 commits into
integration/aurorafrom
j714s/dcp-v27-wake-restart

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

On the J714s (MacBook Pro 14", M5 Pro, T6050) the internal panel stays dark after a deep sleep on the current tree: the display coprocessor boots again from its stopped CPU and answers the wake's calls, but the panel is not lit, and a display on an external display coprocessor does not come back. macOS restarts each display coprocessor once more between its wake calls. This makes the wake do the same.

  • dcp_v27_rtkit_cycle(): every session closed, the coprocessor idled, its receive side off and its CPU stopped; its DART stopped; for the internal display the display PMC handshake and the display domain's power words off; at least v27_cycle_hold_ms (12 ms) with the domain off; then the words on, the PMC handshake, the DART started and the display pipe DART's Linux-owned streams written back; a strict warm restart, the run bit, the boot, and every session open again. An external coprocessor's restart uses its own power words and PMC bits, with one retry when its firmware gives no HELLO. A failed restart is logged and the wake goes on without further restarts.
  • The internal display's wake, as macOS's dark wake followed by its lit wake (v27_rtkit_cycles=2 here): A500 and a restart; A489, the flags-form A484(1), A115(1); A500 and a restart held through v27_lit_delay_ms (2 s); the display stage with a restart after each call; the plain A484(1) with an out-of-band A442 beside it. The panel lights about three seconds after the wake. drm/apple: T6050: one display coprocessor restart per wake (panel lit 0.84 s after the wake) #2029 turns this into macOS's full wake (one restart, 0.84 s).
  • An external coprocessor's wake: A500 and a restart (or its sessions closed and opened again with v27_ext_cycles=0), A489 (with A442 beside it on a coprocessor that had a display), the flags-form A484(1), A115(1), A500 again with a second restart.
  • The sleep side: A489 before and A115 after each flags-form A484 (v27_a115); when the display sleeps before the hard off, its DART is stopped right after its plain A484(0), since a DART stopped before the display stage lets the still-lit pipe read through it and the firmware dies of a bus error at A414.
  • The panel's backlight level is kept through a firmware 27 sleep (appledrm.v27_keep_level), so the first frame after the wake carries it rather than 0.

Every step has its module parameter. Board gating: all of it runs only on a T6050 DCP or DCPEXT on firmware 27 with the late display sleep selected (dcp_v27_sleep_selected()), the PMC handshake only with the J714s's display register block, and the power and DART helpers refuse anything else (#2027). Other SoCs and firmware versions are untouched.

Dependencies

Testing

This commit's form (dark wake, then lit wake) ran on the J714s on the private test stack: the panel lit about three seconds after each wake. Its full-wake form (#2029) is the one measured in detail.

Checks

  • A full cross build (make ARCH=arm64 LLVM=1 Image modules, the M5 kit's configuration) of this head: links (vmlinux, Image, 1774 modules), 0 warnings.
  • checkpatch (--strict): 0 errors; the warnings are the author name against the sign-off's and a few lines over 100 columns.

🤖 Generated with Claude Code

After a strict warm restart, as after a sleep or a stop and restart of a
coprocessor in place, every buffer request has to be answered from the
buffers kept from the first boot, and a request for one that was never
set up fails the boot with -EPROTO. The firmware asks for its crash log's
buffer only when it crashes, so that buffer is normally never set up
before a restart, and a crash after one ended the boot with -EPROTO
instead of giving its crash log.

Serve the crash log endpoint's buffer request after a strict restart as
at the first boot. Every other endpoint keeps the strict rule.

Signed-off-by: Diljit Singh <[email protected]>
On the T6050 (M5 Pro) each firmware 27 display coprocessor is stopped
and restarted once after a wake, outside the system sleep (the display
driver's part follows in the series). Its DART has to go down and come
back with it, and the internal display pipe's DART loses the streams
Linux owns when the display's power domain is cycled for that restart.

Three helpers for the display driver:

- apple_dart_m5_display_cycle(): at a stop, the error interrupts masked
  and cleared, the coprocessor's streams 23 and 24 disabled one write
  each, a TLB flush, then the DART's GAPF slice set to 0x2; before a
  start, the slice back to 0x12, the diagnostic lock and the error mask
  cleared and both streams enabled. These are the writes macOS makes
  around every stop and run bit of a display coprocessor. No translation
  table is touched. The display coprocessors' DARTs have no GAPF range
  in the J714s's tree, so each one's slice is found by the DART's
  address.
- apple_dart_m5_display_snapshot(): before the display's domain goes
  off, every stream with a valid context is remembered, with the enabled
  streams.
- apple_dart_m5_display_rewrite(): once the domain is back on, every
  stream that is not one of the firmware's locked ones and no longer
  reads as remembered is written back, and the TLB is flushed. Without
  it the firmware's first scan-out after the restart faults on the
  framebuffer stream's cleared context entry.

Only a T8110-type DART is accepted, and only the J714s's display
coprocessors' DARTs have a slice.

Signed-off-by: Diljit Singh <[email protected]>
…its restart

On the T6050 (M5 Pro) each firmware 27 display coprocessor is stopped
and restarted once after a wake, outside the system sleep. A stopped
display coprocessor starts again only if its power domains are cycled
between the stop and the start, as macOS does at that point: with the
domains left on, the firmware gives no HELLO after the run bit.

Two helpers for the display driver, both on the sleep profile's display
power words (ps.disp[]):

- apple_sleep_m5_display_power(): the internal display's CPU, FE and
  SYS words, lowered (CPU, the coprocessor core's gate pair, CPU, FE,
  SYS) or raised (SYS, FE, CPU, the gate pair, CPU), each step polled
  until its state has settled. The display pipe DART's own streams are
  remembered before the power-off and written back after the power-on
  (m5_disp_dart_rewrite=0 leaves them). The display driver makes the
  PMC requests around it.
- apple_sleep_m5_dispext_power(): the same for one external display
  coprocessor, found by its device, with its bits in the PMC's boost and
  bandwidth enable words cleared before the power-off and set after the
  power-on. The PMC's request word is left alone: the other external
  coprocessors stay on.

The values and the order are the ones macOS uses for these restarts.
The sleep's entry and exit don't call either; both refuse unless the
T6050 profile is the one running.

Signed-off-by: Diljit Singh <[email protected]>
On the T6050 (M5 Pro, firmware 27) the internal panel stays dark after
a deep sleep: the display coprocessor boots again from its stopped CPU
and answers the wake's calls, but the panel is not lit, and a display
on an external coprocessor does not come back. macOS restarts each
display coprocessor again between its wake calls; this does the same.

The restart, dcp_v27_rtkit_cycle(): every session closed, the
coprocessor idled, its receive side off and its CPU stopped; its DART
stopped; for the internal display, the display PMC handshake and the
display domain's power words off; at least v27_cycle_hold_ms (12 ms)
with the domain off; then the words on, the PMC handshake, the DART
started and the display pipe DART's Linux-owned streams written back;
a strict warm restart, the run bit, the boot and every session open
again. An external coprocessor's restart has its own power words and
PMC bits instead, and one retry with a longer time off when its
firmware gives no HELLO. A failed restart is logged, no other is tried
in that wake, and the wake goes on.

The internal display's wake (v27_rtkit_cycles=2): A500's wake form and
a restart; A489, the flags-form A484(1) and A115(1); A500 and a restart
held through v27_lit_delay_ms (2 s); the display stage with a restart
after each of its calls; the plain A484(1) with an out-of-band A442
beside it. That is macOS's dark wake followed by its lit wake, and the
panel lights about three seconds after the wake.

An external coprocessor's wake: A500's wake form and a restart (or,
with v27_ext_cycles=0, its sessions closed and opened again); A489,
with A442 beside it on a coprocessor that had a display; the flags-form
A484(1); A115(1); A500 again with a second restart.

The sleep side: A489 before and A115 after each flags-form A484
(v27_a115), and, when the display sleeps before the hard off, its DART
stopped right after its plain A484(0): stopped before the display
stage, the still-lit pipe reads through it and the firmware dies of a
bus error at A414.

The panel's backlight level is kept through a firmware 27 sleep
(v27_keep_level), as macOS does, so that the first frame after the
wake carries it rather than 0.

The host selftest that builds dcp_set_brightness() gets mocks for the
level switch and pm_suspend_via_firmware().

Each step has a module parameter. All of it runs only on a T6050 DCP or
DCPEXT on firmware 27 with the late display sleep selected
(dcp_v27_sleep_selected()), and the PMC handshake only with the J714s's
display register block.

Signed-off-by: Diljit Singh <[email protected]>
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.

1 participant