Search by Tags

Suspend/Resume (Linux)

 

Article updated at 21 Aug 2020
Compare with Revision




Subscribe for this article updates

Introduction

The Linux kernel can support up to four system sleep states depending on the capabilities of the platform it runs on. In this article, we will explore platform-specific implementations for Toradex SoMs.

Suspend/Resume on Apalis iMX6

When the CPU is not running, the processor can enter the low power mode. The chip supports a very flexible set of power mode configurations in low power mode:

  • System Idle: The CPU can enter this mode automatically if there is no thread running anymore. All peripherals can be kept working. The CPU state is retained, so the interrupt response can be very short.

  • Low Power Idle: Some of the peripherals are kept still alive while others are shut off. The interrupt response in this state is longer than in the System Idle, but the power consumption is much lower.

  • Suspend: All clocks, unused peripherals and PHYs are off. The DDR3L RAM stays in SelfRefresh mode. The exit time from this mode is much longer. All power rails are still available on the module.

The low power mode can be activated through the following command:

echo standby > /sys/power/state

The suspend mode can be activated through the following command:

echo mem > /sys/power/state

In order to wake the system up again, the MXM3 PIN 37 need to be pulled up or down (depending on the previous state).

Suspend/Resume on Apalis T30

The NVIDIA Tegra T30 support Low Power modes (LP). Currently, LP1 is supported which means CPU is put into a sleep mode and RAM is in self-refresh mode

root@apalis-t30:~# echo mem > /sys/power/state

In order to wake the system up again, the MXM3 PIN 37 need to be pulled up or down (depending on the previous state).

The suspend mode can be selected using /sys/power/suspend/mode. But currently, only LP1 is supported.

Suspend/Resume on Apalis TK1

The NVIDIA Tegra TK1 support Low Power modes (LP). Currently, LP1 is supported which means CPU is put into a sleep mode and RAM is in self-refresh mode

root@apalis-tk1:~# echo mem > /sys/power/state

In order to wake the system up again, the MXM3 PIN 37 need to be pulled up or down (depending on the previous state).

The suspend mode can be selected using /sys/power/suspend/mode. But currently, only LP1 is supported.

GPIO Wake-Up

By default SODIMM PIN 45 is used as wake-up GPIO on Colibri modules and MXM3 PIN 37 is used as wake-up GPIO on Apalis modules.

RTC Wake-Up using internal SNVS RTC

The below example sets the timeout (in Sec) to wakeup from standby/suspend.

echo +10 > /sys/class/rtc/rtc1/wakealarm

UART Wake-up

The below example enables ttyLP0 as wake-up source.

echo enabled > /sys/class/tty/ttyLP0/power/wakeup

Note: UART wake-up is only supported for standby mode.

Suspend/Resume on Colibri iMX6/iMX6ULL/iMX7

When the CPU is not running, the processor can enter the low power mode. The chip supports a very flexible set of power mode configurations in low power mode:

  • System Idle: The CPU can enter this mode automatically if there is no thread running anymore. All peripherals can be kept working. The CPU state is retained, so the interrupt response can be very short.

  • Low Power Idle: Some of the peripherals are kept still alive while others are shut off. The interrupt response in this state is longer than in the System Idle, but the power consumption is much lower.

  • Suspend: All clocks, unused peripherals and PHYs are off. The DDR3L RAM stays in SelfRefresh mode. The exit time from this mode is much longer. All power rails are still available on the module.

The low power mode can be activated through the following command:

echo standby > /sys/power/state

The suspend mode can be activated through the following command:

echo mem > /sys/power/state

In order to wake the system up again, the SODIMM PIN 45 need to be pulled up or down (depending on the previous state).

Suspend/Resume on Colibri T20/T30

The NVIDIA Tegra T20 and T30 support Low Power modes (LP). Currently, LP1 is supported which means CPU is put into a sleep mode and RAM is in self-refresh mode. LP1 mode draws around 180mW on a Colibri T20 512 MB on the Iris Carrier Board)

root@colibri_t20:~# echo mem > /sys/power/state

In order to wake the system up again, the SODIMM PIN 45 need to be pulled up or down (depending on the previous state).

The suspend mode can be selected using /sys/power/suspend/mode. But currently, only LP1 is supported.

Note: Check the release notes for possible limitations.

Suspend/Resume on Colibri VF50/VF61

Disable Ethernet PHY

The Ethernet PHY used on our Vybrid based modules has an errata which does not allow the PHY to power down and wake-up reliable. Therefore, suspend mode for the Ethernet PHY has been disabled by default (by this commit).

For low-power applications not using Ethernet, it is recommended to set the PHY to power-down mode in U-Boot and disable the PHY driver in Linux. To disable PHY control from Linux either disable the Ethernet and PHY driver in the kernel configuration or remove the corresponding device tree node (e.g. set the status property of the fec node to disabled see Device Tree Customization).

Use the following U-Boot command to disable the Ethernet PHY:

Colibri VFxx # mii write 0 0 0x3800​

Extend the bootcmd to disable the Ethernet PHY by default:

Colibri VFxx # setenv bootcmd "mii write 0 0 0x3800 && ${bootcmd}"
Colibri VFxx # saveenv

Standby mode

The standby sleep state puts the Vybrid SoC in STOP mode. The SoC can be woken from standby through any peripheral interrupt. However, currently, wake-up capabilities have been implemented and tested only for some peripheral drivers, namely GPIO, SNVS RTC and UART driver.

Entering standby mode:

echo standby > /sys/power/state

Suspend-to-RAM mode

The mem sleep state (Suspend-to-RAM) uses Vybrid's LPSTOP2 mode. This mode powergates most parts of the SoC expect some peripherals such as Wake-Up controller (WKPU) or LP RTC. The main memory (DDR3) is put into self-refresh mode. The SoC can be woken from mem sleep state through wake-up GPIOs or internal SNVS RTC.

Entering in suspend to mem mode:

echo mem > /sys/power/state

Or

systemctl suspend

Note:

  • Suspend to mem mode is supported since V1.2A module revision.
  • There are few systemd services which are used as a workaround for a known issue with USB host not working after using LPSTOP suspend mode. To make sure USB is working on resume from a suspend to mem, use systemctl suspend to initiate suspend to mem.

Suspend/Resume on Verdin iMX8M Mini

Wi-Fi subsystem

The Wi-Fi subsystem currently does not support suspend. Thus the related kernel module needs to be unloaded.

modprobe -r mwifiex_sdio

Supported Sleep States

Two sleep states are supported by the Linux kernel on Verdin iMX8M Mini: Suspend-to-RAM and Suspend-to-Idle.

Suspend-to-RAM (deep) State

To enter on Suspend-to-RAM state:

# echo enabled > /sys/class/tty/ttymxc0/power/wakeup; echo deep > /sys/power/mem_sleep; echo mem > /sys/power/state

The system will wake up with WAKE1_MICO# (SODIMM_252, X7-24) pin or with a console keypress.

You can also set the system to wake up with RTC alarm in 5 secs from now:

# echo +5 > /sys/class/rtc/rtc1/wakealarm; echo deep > /sys/power/mem_sleep; echo mem > /sys/power/state

Suspend-to-Idle (S2Idle)

To enter on S2Idle state:

# echo enabled > /sys/class/tty/ttymxc0/power/wakeup; echo s2idle > /sys/power/mem_sleep; echo mem > /sys/power/state