Standby
Linux Standby 模式是一种省电模式。在这种模式下,计算机进入睡眠状态以节省功耗。当系统处于 Standby 模式时:
- 系统会自动将大部分硬件设备关闭或者置于低功耗状态
- 同时 DDR 进入自刷新状态
模块介绍
功能介绍
系统休眠唤醒框图如下:

系统的休眠唤醒分为四层:
- 用户空间层: 主要是系统休眠的发起方。
- 内核层: 主要处理冻结用户进程、内核线程,以及各个设备的休眠唤醒等操作。
- OPENSBI 层: 该层会操作 PMU,让系统进入休眠状态。
- 硬件层: PMU 硬件处理系统休眠唤醒的硬件逻辑。
源码结构介绍
控制器驱动代码在 drivers/soc/spacemit/pm/ 目录下:
drivers/soc/spacemit/pm/
├── Makefile
├── platform_hibernation_pm.c
├── platform_hibernation_pm_ops.c
├── platform_pm.c
├── platform_pm_ops.c
休眠唤醒核心层代码位于 kernel/power 目录下:
kernel/power/
├── Kconfig
├── main.c
├── suspend.c
└── wakelock.c
关键特性
特性
无
性能参数
| 休眠时间 | 唤醒时间 | 休眠功耗 |
|---|---|---|
| 3s | 1s | 32.3 mw |
配置介绍
主要包括 驱动使能配置 和 DTS 配置
CONFIG 配置
CONFIG_SUSPEND:
Allow the system to enter sleep states in which main memory is
powered and thus its contents are preserved, such as the
suspend-to-RAM state (e.g. the ACPI S3 state).
Symbol: SUSPEND [=y]
Type : bool
Defined at kernel/power/Kconfig:2
Prompt: Suspend to RAM and standby
Depends on: ARCH_SUSPEND_POSSIBLE [=y]
Location:
-> Power management options
-> Suspend to RAM and standby (SUSPEND [=y])
典型唤醒源配置
power-key
本唤醒源使用的是 PMIC 上面的 ONEKEY,其基本配置如下:
DTS
&i2c8 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c8>;
status = "okay";
spm8821@41 {
compatible = "spacemit,spm8821";
reg = <0x41>;
interrupt-parent = <&intc>;
interrupts = <64>;
status = "okay";
...
pwr_key: key {
compatible = "pmic,pwrkey,spm8821";
};
};
};