The Rockchip RK3588 platform, like other SoC platforms with trust-based systems, manages system suspend operations within the TrustZone. However, the implementation of system suspend varies between platforms, and therefore, the suspend configuration options for different platforms are not universally applicable. This article focuses on the specific suspend configuration for the RK3588 platform, detailing how the system enters sleep mode, how it wakes up, and how the relevant configurations are handled through the Device Tree Source (DTS) files.
Overview of System Suspend Process
The typical system suspend process involves several steps to minimize power consumption while maintaining the ability to resume quickly. The steps usually include:
•Disabling power domains, module IPs, clocks, and PLLs.
•Putting DDR into self-refresh mode.
•Switching system buses to low-speed clocks (24M or 32K).
•Powering off components such as vdd_arm and vdd_log.
•Configuring wake-up sources.
For each product and use case, different suspend configurations are needed, and these configurations are passed to the TrustZone during the boot phase through DTS nodes.
DTS Node Configuration
The relevant DTS node for Rockchip RK3588 suspend configuration is located in the file arch/arm64/boot/dts/rockchip/rk3588s.dtsi. Here’s a breakdown of the key configuration parameters within the rockchip_suspend node:
rockchip_suspend: rockchip-suspend {
compatible = "rockchip,pm-rk3588";
status = "disabled";
rockchip,sleep-debug-en = <0>; // Sleep debug log enable (0: Disabled, 1: Enabled)
rockchip,sleep-mode-config = <
(0
| RKPM_SLP_ARMOFF_LOGOFF
| RKPM_SLP_PMU_PMUALIVE_32K
| RKPM_SLP_PMU_DIS_OSC
| RKPM_SLP_32K_EXT
)
>; // Sleep mode configuration
rockchip,wakeup-config = <
(0
| RKPM_GPIO_WKUP_EN
)
>; // Wakeup source configuration
};
In this configuration, rockchip_suspend defines the sleep mode and wake-up sources for the system. It specifies the sleep mode configurations and allows for controlling whether debug logs are printed during the sleep and wake cycles.
The DTS node is then enabled on the reference board in the arch/arm64/boot/dts/rockchip/rk3588-evb.dtsi:
&rockchip_suspend {
status = "okay";
rockchip,sleep-debug-en = <1>;
};
Sleep Configuration Breakdown
Sleep Mode Configuration
The rockchip,sleep-mode-config defines the behavior of the system during sleep. This includes which power domains and components are powered off, as well as which clock sources are used.
The configuration options include:
•RKPM_SLP_ARMOFF: Powers off vdd_arm. This requires hardware support.
•RKPM_SLP_ARMOFF_DDRPD: Powers off vdd_arm and the DDR controller. Hardware support is required.
•RKPM_SLP_ARMOFF_LOGOFF: Powers off vdd_arm and vdd_log. Again, hardware support is required.
•RKPM_SLP_ARMOFF_PMUOFF: Powers off vdd_arm, vdd_log, and the PMU1 power domain.
•RKPM_SLP_PMU_PMUALIVE_32K: Uses a 32K clock source for the system during sleep.
•RKPM_SLP_PMU_DIS_OSC: Disables the 24M crystal oscillator for the lowest power mode, used in conjunction with RKPM_SLP_PMU_PMUALIVE_32K.
•RKPM_SLP_32K_EXT: Uses an external 32K clock source for sleep instead of the internal 32K clock.
Wakeup Source Configuration
The wakeup sources determine how the system will be awakened from sleep mode. These sources are configured through the rockchip,wakeup-config node, and the options available for wakeup include:
•RKPM_CPU0_WKUP_EN, RKPM_CPU1_WKUP_EN, etc.: Enable wake-up for specific CPUs.
•RKPM_GPIO_WKUP_EN: GPIO0 is typically used as a wakeup source. Hardware design suggestions recommend placing all required wakeup sources on GPIO0.
•RKPM_SDMMC_WKUP_EN, RKPM_USB_WKUP_EN, RKPM_UART0_WKUP_EN, etc.: Enable wakeup from various peripherals such as SDMMC, USB, UART, etc.
•RKPM_TIME_OUT_WKUP_EN: Enable wakeup from the internal PMU timer, which typically triggers a wakeup after 1 second.
For instance, to enable wakeup from GPIO0 and CPU0, the following configuration would be used:
&rockchip_suspend {
status = "okay";
rockchip,sleep-debug-en = <1>;
rockchip,sleep-mode-config = <
(0
| RKPM_SLP_ARMOFF_DDRPD
| RKPM_SLP_PMU_PMUALIVE_32K
| RKPM_SLP_PMU_DIS_OSC
| RKPM_SLP_32K_EXT
)
>;
rockchip,wakeup-config = <
(0
| RKPM_GPIO_WKUP_EN
| RKPM_CPU0_WKUP_EN
)
>;
};
Wakeup Source Considerations
•GPIO Wakeup: By default, only GPIO0 is supported as a wakeup source. Other GPIOs can be configured as wakeup sources, but careful consideration must be given to the power domains.
•CPU Wakeup: CPUs can be configured to wake the system from suspend. This option provides more flexibility in managing wakeup sources.
•Timer Wakeup: The PMU internal timer can be used for waking up the system, typically for testing purposes during development.
Power Domain and Logic Configuration
To prevent the logic power domain from being powered off during system suspend, modify the configuration in the DTS file like so:
vdd_log_s0: DCDC_REG3 {
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <675000>;
regulator-max-microvolt = <750000>;
regulator-ramp-delay = <12500>;
regulator-name = "vdd_log_s0";
regulator-state-mem {
regulator-on-in-suspend; // This keeps the logic domain powered during suspend
regulator-suspend-microvolt = <750000>; // Voltage after suspend
};
};
This ensures that the logic power domain is maintained during system sleep.
The Rockchip RK3588 platform offers extensive configurability for system suspend and wakeup sources. By using the DTS nodes to specify the sleep modes and wakeup sources, developers can fine-tune the system’s power consumption and performance. Careful configuration of power domains and wakeup sources ensures the system can efficiently enter and exit suspend mode while meeting the specific needs of different products.