Suspend to RAM / SC7

SC7 is an SOC power state where Tegra is in low power mode and DRAM is in self-refresh mode. SC7 is also known as Suspend to Ram mode. In SC7, all domains in Tegra SOC will be powered down except for the AON domain. The AON domain is powered on but in sleep mode.

Note:
  • This section only talks about Suspend to Ram / SC7, which is one of many Tegra SOC power states. It does not talk about the power states at the global platform level or at the device level . You are responsible for defining power states at the platform level.

  • The term Suspend to RAM and SC7 are used interchangeably in this documentation and mean the same thing.

Legal SoC Power States

The legal, non-transient, next states after SC7 are:

  1. normal boot

  2. Powered off

Exit from SC7 is triggered by wake sources:

  1. RTC wake

Why SC7

A significant part of the system boot time is taken up in the initialization of the application, including loading of libraries and data (DNN and map files). Achieving the boot time target in cold-boot for all use-cases is difficult.

A way around this is to keep the DRAM pre-loaded and initialized before the system needs to be a fully functional state. Rather than keep the system powered off when not in use, it retains the system in SC7 state (which minimizes the power consumption while keeping the DRAM loaded and most of the software initialized).

With SC7, data is loaded and applications are initialized (example: DNN unpacking) before suspend that do not require external interaction. When it resumes, the application programs the external sensor and the rest of the application init. Since most of the initialization, which is IO and CPU intensive, happened before suspend, the visible time is only the resume time (and much less compared to cold boot) for the end user.

How it Works

The Tegra sequence:

  • When the vehicle engine is turned OFF, instead of doing a shutdown, Tegra is put in the suspend state.

    • In order to put the Tegra in suspend, you must first reboot the system and execute the KeyOFF IST, followed by another reboot where the application puts the system in the suspend state.
  • Power is consumed in SC7 state and requires a timeout after which you can shut down the system to save power.

  • The block diagram below shows the steps performed at the Tegra end.

Known Issues with SC7 Entry and Exit

  • WiFi connected to PCIE C1 controller does not suspend and must be unbound before SC7 entry.
  • On board ethernet connected to PCIE C7 does not suspend and must be unbound before SC7 entry.

  • Any PCIE controller configured as an end-point must be unbound before SC7 entry.

  • tcu_muxer output is intermittenly distorted once SC7 cycle is triggered.

  • Display suspend fails so display drivers must be removed before SC7 entry.

  • host1x tests fail after SC7 exit.

  • SE does not work with SC7. Tegra SOC suspends and resumes fine but SE does not work after SC7 exit.

  • Camera applications must be restarted after SC7.

Entering and Exiting SC7

Trigger SC7 entry and exit from guest Linux:

Prerequisite

Flash and boot P3710 as described in the documentation.

The PCIe WiFi, PCIe Ethernet and PCIE end-point have suspend and resume issues so you must disable them. The currently supported platform is P3710. P3663 verification will be done for 6.0.4. If you see an issue with PCIe client endpoint devices' suspend and resume sequence, then unbind the corresponding PCIe device so that suspend and resume work.

  • Unbind PCIe C1 controller with WiFi connected:

    echo 14100000.pcie > /sys/bus/platform/drivers/tegra194-pcie/unbind
  • Unbind PCIe C7 controller with on-board Ethernet connected:
    echo 141e0000.pcie > /sys/bus/platform/drivers/tegra194-pcie/unbind
  • Unbind PCIe C6 that is configured as EP in primary config - miniSAS Port-B:
    echo 141c0000.pcie_ep > /sys/bus/platform/drivers/tegra194-pcie/unbind
    
  • Unload display drivers:
    sudo pkill -9 Xorg
    rmmod nvidia_modeset
    rmmod nvidia
    

Start SC7 Suspend

Execute:
echo 1 > /sys/class/tegra_hv_pm_ctl/tegra_hv_pm_ctl/device/trigger_sys_suspend

Exit SC7

You can exit SC7 either through an RTC or GPIO wake event. For RTC wake, before SC7 suspend is triggered, set RTC wake event:
echo 0 > /sys/class/rtc/rtc1/wakealarm && echo +10 > /sys/class/rtc/rtc1/wakealarm

In the example above, the RTC wake event is set to 10 seconds.

Note: If RTC node is disabled, enable RTC in DT:
rtc@c2a0000 {
status = "okay";
};

Debugging

If you see the system going to shutdown after resume, make the following changes:

  1. Comment out or remove the below rule from the /lib/udev/rules.d/70-power-switch.rules file:
    SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEY}=="1", TAG+="power-switch"
  2. Close the file and reboot the system.