Bravo! Well done. Thank you for freely sharing your work in the best sprit of the net.i decompiled the pi5 firmware, the week it had been announced, before any such docs existed
and some rpi engineers filled in details as i asked things on the forum
I went down that rabbit hole, but kernel hacking is way beyond my knowledge level. The page mentions that the hibernate script is available on this page: https://www.suspend2.net/, but the URL to it is dead. However, archive.org has it: https://web.archive.org/web/20120324230 ... .94.tar.gzthere are several components to suspend2ram, and a few are in placei also stumbled upon https://elinux.org/Suspend_To_Disk_For_ARM and it may have more details
- systemd (or whatever init system youve chosen) has to run any pre-suspend scripts, that should all be reusable
- systemd will tell linux its time to suspend to ram, by writing a mode to /sys/power/state then the kernel begins the process
- linux will tell each driver its going into sleep, and those drivers need to properly store the hw state in ram (likely a lot of work here)
- linux will issue a PSCI call into the ATF blob
- the ATF blob will issue a mailbox call to the firmware, (this is implemented)
- the firmware will turn the arm core off, sleep 30 seconds, then turn it back on and resume (this needs to be replaced with actual suspend)
- ATF will repair the arm state, and jump back to linux (i believe this is implemented)
- linux should then call each driver, and ask them to re-init the peripherals and restore state (lot of work needed here)
- userland processes resume, and systemd will resume execution from the moment it wrote to the trigger file, and then has to run the post-suspend scripts to wake things up
I applaud your diligence and persistence and look forward to your future insight into this issue.edit:
i was curious as to what would happen, so i grabbed the rpi-6.7.y branch, the 2712 defconfig, and make a few small tweaks:i didnt want to bother with modules, so i just made the graphics built-inCode:
CONFIG_SUSPEND=y CONFIG_HIBERNATION=y CONFIG_DRM_V3D=y CONFIG_DRM_VC4=y
the 2d drm node still failed, but it boots fine, and /sys/power/state was present
but attempting to set state to mem, just turned off the ethernet port and hung the system
cant debug further until i get a JST cable that can fit the debug port
I posted an inquiry on the Debian debian-arm reflector, and received a very helpful response from Hank Barta:
Further research turned up these pages:If by "standby" you mean the state described in the thread where the
Pi uses less power when stopped, there are instructions at
https://www.tomshardware.com/raspberry- ... onsumption
(and lots of other sites. Personally I'd look for Jeff Geerlings
instructions, but I don't have a Pi 5 yet and that was the first link
when I searched for "raspberry p 5 low power when off".
If by "standby" you mean turning off the monitor when idle, I have
found the following:
nonadmin@nova:~ $ tail -2 .config/wayfire.ini
[idle]
dpms_timeout=600
nonadmin@nova:~ $
(Which works with Wayfire on a Pi 4B.)
If you mean suspend, According to the link you posted it is not yet supported.
And these are all possibly off-topic for Debian ARM, though 64 bit
RpiOS does directly use Debian repos.
https://www.tomshardware.com/raspberry- ... onsumption
https://www.jeffgeerling.com/blog/2023/ ... ption-140xThis hack is easy, all we need to do is alter a configuration file, reboot and we can enjoy a lower standby power consumption.
1. Open a Terminal and run this command. This will open a nano text editor where we can make changes to the EEPROM.
sudo rpi-eeprom-config --edit
2. Scroll down and change the following line.
POWER_OFF_ON_HALT=0
Change to
POWER_OFF_ON_HALT=1
3. Press CTRL + X, Y and then ENTER to save and exit.
Reboot the Raspberry Pi to write the changes to the EEPROM. When powered off, your Raspberry Pi 5 will now consume much less power in standby.
I haven't found time yet to dig deeper into these new revelations.Reducing Raspberry Pi 5's power consumption by 140x
November 5, 2023
By default, the Raspberry Pi 5 (like the Pi 4 before it) leaves the SoC powered up (just in a shutdown state) when you shut down the Pi.
Because of this, a Pi 5 will still sit there consuming 1.2-1.6W when completely shut down, even without anything plugged in except power.
That's a lot—even compared to a modern desktop PC![...]
Fixing the Pi's power consumption
The fix is, thankfully, easy.
Edit your EEPROM config by running sudo rpi-eeprom-config -e, and make sure the following settings are configured:
[all]
BOOT_UART=1
WAKE_ON_GPIO=0
POWER_OFF_ON_HALT=1
The first setting is irrelevant here, but I'm including it for completeness. Also, WAKE_ON_GPIO doesn't seem to do anything on Pi 5 (since there's a power button and pads on the board for power switching, instead of GPIO-pin-based power control), but it's still there for now. I'm mostly including it because you can set these options on the Pi 4 too, and get it to reduce it's powered-off consumption too!
Save that configuration and reboot, then next time you shut down, you should see power consumption go down from 1-2W to 0.01W or even less:
Can you still boot the Pi 5 with POWER_OFF_ON_HALT?
Yes! The power button still works just as normal, and the red LED is still illuminated when it's shut down.
The RTC still keeps time, too, so watchdog-related functions (like booting during some interval, or at a certain time of day) should also work. I haven't personally tested this (yet), but here's a forum thread with a little more info.
viewtopic.php?p=2151102
Further reading
How to update the Raspberry Pi Compute Module 4 Bootloader / EEPROM
https://www.jeffgeerling.com/blog/2022/ ... der-eeprom
Testing PCIe on the Raspberry Pi 5
https://www.jeffgeerling.com/blog/2023/ ... berry-pi-5
NVMe SSD boot with the Raspberry Pi 5
https://www.jeffgeerling.com/blog/2023/ ... berry-pi-5
I apologize for the long post.
Larry
Statistics: Posted by LDighera — Sun Dec 17, 2023 8:11 pm