Enable suspend/resume on Pi 5 - #7514
Conversation
|
Can you describe your use case? |
|
This is just for testing how the drivers handle suspend/resume. The firmware does not support suspend yet. It currently stops the arm and then starts it again after one second. The first commit should only be merged if the firmware supports suspend. The other commits should do nothing if suspend is not enabled so they could be merged before suspend works. |
|
The commits look plausible to me. Claude had some comments (that may not be an issue):
|
|
I've updated the watchdog driver with the extra check. The wireless driver prevents runtime PM while it is bound I've added a temporary fix for NVMe drives. It works by overriding |
|
The firmware is now getting into the kernel after wakeup from S3 (lots to do!). I think our TFA was assuming that GIC distributor was preserved in S3, it isn't. It's not in the AON power island Mailboxes writes weren't making it to VPU after wakeup from S3, here's my very lightly tested patch for this on top of your patchset |
|
Firmware for kernel debug here - pieeprom-2026-08-17 (probably quite broken) Should look something like this, WiFi + NETDEV timeouts |
|
WiFi no longer hangs for me with the pinctrl changes - tested with rebased s2ram pieeprom-2026-08-17-v3.bin that includes other firmware clock changes. |
42dae28 to
e2fe239
Compare
|
Using the regulator driver for PCIE_PWR_EN means that it will also be left unpowered when not in use. |
a6f3b97 to
35fcd28
Compare
Add support for suspend to RAM on bcm2712 Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Stop the watchdog during suspend to that it does not reset while suspended Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Add a device tree property so that wifi is powered off correctly during suspend. The wifi is powered off by the firmware during system suspend. The wifi driver does not allow runtime suspension so this will only affect system suspend. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
This makes the NVMe driver reset drives during suspend/resume. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Disable the iommu on suspend and reinitialise it on resume. Only allocate top_table and default_page on first initialisation. nmapped_pages is already 0 from kzalloc on the first initialisation. Prevent it from being reset to 0 on subsequent initialisations. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Force a runtime suspend during system suspend. This prevents ccasional warnings about packet RAM being off. Signed-Off-By: Peter Bailey <peter.bailey@raspberrypi.com>
Use the drm_mode_config_helper_ functions on suspend and resume. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Reinitialise the hardware on resume. Split vc4_hvs_upload_linear_kernel into two functions. On resume, the kernels have already been allocated. Move writing to the hardware into another function and call that on resume. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Use the suspend/resume methods for hibernation. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
In S3 deep-sleep, the entire VPU, ARM, GIC infrastructure is powered off. Re-initialise the mailbox hardware on resume otherwise, the VPU won't see mailbox requests.
Enable the watchdog for device power management. Use a short timeout before warning. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Add support for hibernation on bcm2712 Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Save the pin mux and pad during suspend and restore it during resume. Multiple pins are stored in each register. Store the entire register for each pin. The values will not change between storing and restoring the individual pins. This uses a few extra bytes but simplifies the code. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Re-enable interrupts in start_rx. This fixes the serial console ignoring input after a system suspend with no_console_suspend set. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
The firmware reports that the HSM clock is 0 after resume. The HDMI runtime resume will fail early if it is 0 to prevent stalling on memory accesses. Ignore the check for now. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
The registers get reset during suspend. Restore them on resume. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
There are 32 individual event bits of which 4 correspond to mailbox channels. Limit the IRQ handler to signalling mailbox events on actual mailboxes, to prevent all-1s completions (such as when the link is down) or RP1 firmware bugs from causing null pointer dereferences. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Rerun the sdhci initialisation on resume. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
On suspend, check if there is a current job being processed. Suspending takes longer than a pisp job so assume it will be done and cancel suspending if it is not. On resume, restore hardware registers. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Use the modeset helper functions and disable the clock in suspend. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Unregister the device when suspending and then register it again on resume Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
Add a device tree property so that bluetooth is handled correctly after suspend. It is powered off so the device must be reprobed on resume. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
This adds a regulator for pcie1 using a pin on the RP1. It needs a hack to order pcie2 before pcie1 so that the regulator is found by the pcie-brcmstb driver. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
…other alarm This clears the pending alarm when resuming from system suspend and when setting another alarm. Previously, If the rtc was used to wake from suspend more than one time in a row, It would fail. If the alarm is set and the system is suspended, resumed and suspended before the alarm occurs, the alarm will still wake the system. Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
This prevents the camera from sometimes freezing when using rpicam-hello -t 0 Signed-off-by: Peter Bailey <peter.bailey@raspberrypi.com>
f019f0c to
17a7254
Compare
This enables suspend/resume support for Pi 5.
The watchdog should be stopped when suspending.
The wireless can be turned off with
cap-power-off-card. It could be left on withkeep-power-in-suspendbut that does not have any benefits currently.NVME drives currently do not work. The NVME driver puts the drive in a low power state and expects the link to be left on. The PCIe driver then turns off the link. This stops the NVME driver waking up the drive. Adding NVME_QUIRK_SIMPLE_SUSPEND to a drive fixes it.