Power Management Support in Hikey (suspend-resume)

Greetings All,
We are using Hikey boards as a reference for ARM64 development. I have looked for documentation regarding “Power Management” in Linux kernel, however my searches were not very successful.
I have tried to do the following in v3.18
$ echo mem > /sys/power/state
[ 2234.871713] PM: suspend entry 2016-02-11 17:05:03.872904787 UTC
[ 2234.878654] PM: Syncing filesystems … done.
[ 2234.900361] Freezing user space processes … (elapsed 0.001 seconds) done.
[ 2234.901713] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done.
[ 2234.901724] Suspending console(s) (use no_console_suspend to debug)

I have also tried this on a 4.4 kernel:
$ echo mem > /sys/power/state
PM: suspend entry 2016-02-11 16:28:18.994227498 UTC
PM: Syncing filesystems … done.
Freezing user space processes … (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks … (elapsed 0.001 seconds) done.
sd 1:0:0:0: [sdb] Synchronizing SCSI cache
PM: suspend of devices complete after 305.758 msecs
PM: late suspend of devices complete after 2.420 msecs
PM: noirq suspend of devices complete after 1.947 msecs
Disabling non-boot CPUs …
CPU1: shutdown
psci: CPU1 killed.
CPU2: shutdown
psci: CPU2 killed.
CPU3: shutdown
psci: CPU3 killed.
CPU4: shutdown
psci: CPU4 killed.
CPU5: shutdown
psci: CPU5 killed.
CPU6: shutdown
psci: CPU6 killed.
IRQ5 no longer affine to CPU7
CPU7: shutdown
psci: CPU7 killed.

However I did not know how to add the peripherals to the “wakeup” domain.
Can someone educate me on the power-management for Hikey? Thanks

Warm Regards,

Hi Raghu,

  • Before I verified Hikey suspend-to-RAM flow. So for suspend-to-RAM, you need enable one wakenup source so after system has suspended into low power state, one hardware source still can wake up platform to execute resume flow. But so far we don’t have ‘on_key’ supporting for Hikey AFAIK, usually I use watchdog to do this:

echo +10 > /sys/class/rtc/rtc0/wakealarm; echo mem > /sys/power/state

  • In kernel side, you need enable the driver RTC driver: CONFIG_RTC_DRV_PL031, I build latest kernel and I see it has enabled this driver yet.

Leo Yan

Regarding wakeup source, here is a summary for HiKey:

  1. UART and USB wakeup are not possible for HiKey. Their wakeup logic
    was blocked by Hi6220 MCU in silicon way. MCU firmware cannot
    workaround it either. We didn’t see any way to change that.

  2. Good news is: GPIO pins on HiKey Low-speed expansion port can be
    used as wakeup source. You need to run these scripts to enable that.
    See below. To wakeup the board, just give some voltage jitter to
    any of these GPIOs.

== to wakeup by GPIO:

/* 488: GPIO2_0, 490: GPIO2_2, /
492: GPIO2_4, 495: GPIO2_7 /
GPIO2_1, GPIO2_3 busy */

echo 488 > /sys/class/gpio/export
echo 490 > /sys/class/gpio/export
echo 492 > /sys/class/gpio/export
echo 495 > /sys/class/gpio/export

echo in > /sys/class/gpio/gpio488/direction
echo both > /sys/class/gpio/gpio488/edge
echo in > /sys/class/gpio/gpio490/direction
echo both > /sys/class/gpio/gpio490/edge
echo in > /sys/class/gpio/gpio492/direction
echo both > /sys/class/gpio/gpio492/edge
echo in > /sys/class/gpio/gpio495/direction
echo both > /sys/class/gpio/gpio495/edge

Thank you.
Best regards,
Guodong Xu

Thank you !

I have tried the RTC alarm method first and yes it works, thanks Leo.
I will try the GPIO method aswell and share my experience.
Warm Regards,