xnux.eu - site map - news

System suspend (A64)

System suspend is done on multiple levels, from top to bottom:

Management firmware (crust) then loops and watches for wakeup interrupts and restores the system into running state if necessary.

Currently crust is able to put system into a sleep state that consumes ~110mW on PinePhone.

There are some limits to what devices can be used for wakeup currently, because of interrupt routing for some possible wakeup sources not going through r_intc. So on A64 volume keys can't be used for wakeup, for example.

Controlling suspend/resume from userspace

Suspended state is entered by writing into sysfs files:

# see available suspend to RAM sleep modes
cat /sys/power/mem_sleep
# configure one of them (in this case suspend to idle, which just idles all ARM CPUs)
echo s2idle > /sys/power/mem_sleep
# initiate power state change
echo mem > /sys/power/state

Wakeup sources can be listed and configured via sysfs files under /sys/class/wakeup.

# list all enabled wakeup sources
cat /sys/class/wakeup/wakeup*/name
1f00000.rtc
alarmtimer
axp20x-battery
axp813-ac
axp20x-usb
1c21800.lradc
musb-hdrc.1.auto

# disable a wakeup source
cat /sys/class/wakeup/wakeup#/device/power/wakeup
enabled
echo disabled > /sys/class/wakeup/wakeup#/device/power/wakeup

# enable a wakeup source (you need to find the device in sysfs first)
find /sys/devices -wholename '*power/wakeup'
/sys/devices/platform/soc/1c1a000.usb/usb1/power/wakeup
/sys/devices/platform/soc/1c1b000.usb/usb3/power/wakeup
/sys/devices/platform/soc/1c1a400.usb/usb2/power/wakeup
/sys/devices/platform/soc/1c28c00.serial/tty/ttyS2/power/wakeup
/sys/devices/platform/soc/1c1b400.usb/usb4/power/wakeup
/sys/devices/platform/soc/1c21800.lradc/power/wakeup
/sys/devices/platform/soc/1c28400.serial/serial0/power/wakeup
/sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp20x-ac-power-supply/power_supply/axp813-ac/power/wakeup
/sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp20x-battery-power-supply/power_supply/axp20x-battery/power/wakeup
/sys/devices/platform/soc/1f03400.rsb/sunxi-rsb-3a3/axp20x-usb-power-supply/power_supply/axp20x-usb/power/wakeup
/sys/devices/platform/soc/1c28000.serial/tty/ttyS0/power/wakeup
/sys/devices/platform/soc/1f00000.rtc/power/wakeup
/sys/devices/platform/soc/1c19000.usb/musb-hdrc.1.auto/power/wakeup
/sys/devices/platform/serial8250/tty/ttyS6/power/wakeup
/sys/devices/platform/serial8250/tty/ttyS4/power/wakeup
/sys/devices/platform/serial8250/tty/ttyS7/power/wakeup
/sys/devices/platform/serial8250/tty/ttyS5/power/wakeup
/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup

# enable wakeup source (volume key press in this case)
echo enabled > /sys/devices/platform/soc/1c21800.lradc/power/wakeup