Skip to content

apple-drm: quiesce inactive DCPs on suspend, fix resume crash#510

Open
areofyl wants to merge 51 commits into
AsahiLinux:fairydustfrom
areofyl:fix/drm-dcp-suspend
Open

apple-drm: quiesce inactive DCPs on suspend, fix resume crash#510
areofyl wants to merge 51 commits into
AsahiLinux:fairydustfrom
areofyl:fix/drm-dcp-suspend

Conversation

@areofyl
Copy link
Copy Markdown

@areofyl areofyl commented May 31, 2026

drm_mode_config_helper_suspend returns -EINVAL when a secondary DCP (external display) is disconnected, which blocks the entire PM suspend path. Even if you make suspend return 0 anyway, the DCP RTKit firmware keeps running and generates mailbox IRQs that immediately wake from s2idle.

When the drm suspend helper fails, iterate CRTCs and call apple_rtkit_quiesce on inactive DCPs so they stop generating IRQs. On resume, re-boot them with apple_rtkit_boot and fire a hotplug event so the DRM state gets reconciled.

Also fixed the resume path. drm_mode_config_helper_resume crashes on NULL suspend_state if suspend failed, so check for that and fall back to a hotplug event instead.

Tested on M1 MacBook Air (J313) with USB-C display, fairydust 6.18.10. Still needs more stress testing with repeated plug/unplug + suspend cycles before taking this out of draft.

noopwafel and others added 30 commits May 23, 2026 14:35
This only includes the first port, because it's the only port that is
present on my hardware, and only includes the pwren gpio for J613.

Uses the t6020 base compatible as that is what the M3 hardware appears
to be compatible with, rather than the configuration applied by the
generic base compatible.

Signed-off-by: Alyssa Milburn <amilburn@zall.org>
Co-developed-by: Michael Reeves <michael.reeves077@gmail.com>
Signed-off-by: Michael Reeves <michael.reeves077@gmail.com>
The SPMI pmic provides nvmem cells for macsmc-reboot and macsmc-rtc.

Signed-off-by: Janne Grunau <j@jannau.net>
Contains minimal device trees for all M3 Max and Ultra Apple silicon
devices. Those are 14-inch and 16-inch MacBook Pros with M3 Max released
in November 2023 and Mac Studio with M3 Ultra released in 2025.
This does not include M3 Pro since it looks like separate chip and not a
smaller variant of the M3 Max contrary to the M1 and M2 generations.
The smaller M3 Max variant (10 performance cores) has its own chip
variant (t6034) but is clearly the same design as t6031. Besides fewer
CPU performance cores and GPU cores it misses also on fourth of the
memory controllers and thus has an aggregated bus width of 384 bit
instead of 512 bit.
Both M3 Ultra variants (28 or 32 CPU cores) are based on t6031 judging
by the advertised memory bandwidth of 819GB/s.
The device trees have devices nodes for CPU cores, timer, interrupt
controller, power states, watchdog, serial, pin controller, i2c,
PWM based keyboard LED illumination and the boot framebuffer.

Signed-off-by: Janne Grunau <j@jannau.net>
Minimal device trees for the M3 Pro based 14-inch and 16-inch MacBook
Pro released in November 2023. The M3 Pro appears to distinct chip
design and not a cut down version of the Max variant like for M1 and M2
Pro. The M3 Pro has only a single cluster with up to 6 performance
cores and one cluster with 6 efficiency cores.
The device trees have devices nodes for CPU cores, timer, interrupt
controller, power states, watchdog, serial, pin controller, i2c,
PWM based keyboard LED illumination and the boot framebuffer.

Signed-off-by: Janne Grunau <j@jannau.net>
Adds device node for spmi and spmi-pmic, smc and nvme.

Signed-off-by: Janne Grunau <j@jannau.net>
Adds device node for spmi and spmi-pmic and smc.

Signed-off-by: Janne Grunau <j@jannau.net>
Add NVMe related devices nodes for all t6031, t6032 and t6034 based
devices.

Signed-off-by: Janne Grunau <j@jannau.net>
Certain Broadcom bluetooth chips (bcm4377/bcm4378/bcm438) need ACL
streams carrying audio to be set as "high priority" using a vendor
specific command to prevent 10-ish second-long dropouts whenever
something does a device scan. This patch sends the command when the
socket priority is set to TC_PRIO_INTERACTIVE, as BlueZ does for audio.

Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
The current approach of silently disabling all rust drivers if the
toolchain is missing results in users that try to compile their own
kernels getting a "successful" build and then being confused about where
did their drivers go. In comparison, missing openssl results in a build
failure, not a disappearance of everything that depends on it.

This also means that allyesconfig will depend on rust, but since the
rust experiment concluded with "rust is here to stay", i believe that
allyesconfig should be building rust drivers too.

Signed-off-by: Sasha Finkelstein <k@chaosmail.tech>
jannau and others added 20 commits May 23, 2026 14:38
- WLAN/BT (SMC PMU GPIO AsahiLinux#13) (all devices)
- ASM3142 (SMC PMU GPIO AsahiLinux#14) (j434, iMac with 4 USB-C ports)
- SD card reader (SMC PMU GPIO AsahiLinux#23) (j504, 14-inch MacBook Pro)

Signed-off-by: Janne Grunau <j@jannau.net>
The internal keyboard and trackpad HID on MacBook variants
of the Apple M3 (t8122) SoC are connected through a Apple
-developed protocol called DockChannel and mediated by a
coprocessor known as the Multi-Touch Processor (MTP).

This commit adds the nessecary device tree nodes to the
M3's device tree for internal HID to work. It is disabled
by default, to be enabled only in MacBook board files
where it is tested and confirmed to work.

Co-developed-by: Alyssa Milburn <amilburn@zall.org>
Signed-off-by: Alyssa Milburn <amilburn@zall.org>
Signed-off-by: Michael Reeves <michael.reeves077@gmail.com>
Add mtp device nodes for t8122 (M3) based MacBooks.

Signed-off-by: Michael Reeves <michael.reeves077@gmail.com>
Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
List trackpad firmware files and activate MTP devices nodes on all
t6030, t6031 and t6034 based MacBooks.

Signed-off-by: Janne Grunau <j@jannau.net>
HDP status for DisplayPort alt-mode is signaled data_status. Track
changes to have a debounced HPD to forward to the DRM KMS driver.

Signed-off-by: Janne Grunau <j@jannau.net>
This is not how dp-altmode support should be implemented but it works
for new. Requires a "displayport" property in the connector node with a
phandle of the connector.

Signed-off-by: Janne Grunau <j@jannau.net>
Enable DP alt mode for all M1 devices:
- Mac Mini (M1): USB-C port next to the HDMI port
- Macbook Pro (M1, 13-inch): front left USB-C port
- Macbook Air (M1, 13-inch): front left USB-C port
- iMac (M1, 2 USB-C ports): back left USB-C port
- iMac (M1, 4 USB-C ports): back right middle USB-C port

Signed-off-by: Janne Grunau <j@jannau.net>
Works around missing suspend/resume handling in ATC phy for DP-altmode.

Signed-off-by: Janne Grunau <j@jannau.net>
Enable DP alt mode for the front left USB-C port of Macbook Air 13 (M2,
13/15-inch) and Macbook Pro (M2, 13-inch).
Can't easily enabled on on the M2 Mac Mini since dcpext is used for the
HDMI port and dcp bringup is troublesome.

Signed-off-by: Janne Grunau <j@jannau.net>
Works around missing suspend/resume handling in ATC phy for DP-altmode.

Signed-off-by: Janne Grunau <j@jannau.net>
Needs more testing, maybe a little unstable and somehow limits the HDMI
out to 1280x720 (to be verified).
Using dcp as display coproc since dcpext is used for the HDMI port.

Signed-off-by: Janne Grunau <j@jannau.net>
Works around missing suspend/resume handling in ATC phy for DP-altmode.

Signed-off-by: Janne Grunau <j@jannau.net>
Blessed dp-altmode port is front left port on j314/j316/j414/j416.

Signed-off-by: Janne Grunau <j@jannau.net>
…ways on

Works around missing suspend/resume handling in ATC phy for DP-altmode.

Signed-off-by: Janne Grunau <j@jannau.net>
DP alt mode for Mac Studio, the blessed port is the back left middle port
(second closest USB-C port to the power connector).

Signed-off-by: Janne Grunau <j@jannau.net>
…s on

Works around missing suspend/resume handling in ATC phy for DP-altmode.

Signed-off-by: Janne Grunau <j@jannau.net>
DP alt mode for Mac Mini M2 Pro, the blessed port is the back right
middle port (second closest USB-C port to the power connector).

Signed-off-by: Janne Grunau <j@jannau.net>
@areofyl areofyl force-pushed the fix/drm-dcp-suspend branch from d33be4e to 0b2b907 Compare June 1, 2026 00:14
@areofyl areofyl marked this pull request as ready for review June 1, 2026 00:19
drm_mode_config_helper_suspend returns -EINVAL when a secondary DCP
(external display) is disconnected, which blocks the entire PM suspend
path. Even if suspend returns 0 anyway, the DCP RTKit firmware keeps
running and generates mailbox IRQs that immediately wake from s2idle.

When the drm suspend helper fails, iterate CRTCs and call
apple_rtkit_quiesce on disconnected DCPs so they stop generating IRQs.
On resume, re-boot them with apple_rtkit_boot and fire a hotplug event.

Also fix the resume path: drm_mode_config_helper_resume crashes on NULL
suspend_state when suspend failed, so check for that and fall back to a
hotplug event instead.

Tested on M1 MacBook Air (J313) with USB-C display, fairydust 6.18.10.

Signed-off-by: areofyl <areofyl@users.noreply.github.com>
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.

5 participants