Runtime PM 与休眠唤醒入门
本文对应 成长路径 中优先级:按硬件支持配置 运行时省电 与 系统休眠。
Runtime PM
设备空闲时 clock off / 电源域关闭:
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev); /* 使用前 */
/* 访问硬件 */
pm_runtime_put(&pdev->dev); /* 空闲 */驱动需实现 runtime_suspend / runtime_resume。
系统休眠(mem)
| 状态 | 说明 |
|---|---|
| freeze | 用户态冻结 |
| mem | 挂起到 RAM |
| disk | 休眠到磁盘 |
驱动实现 suspend / resume 或 suspend_noirq 等。
设备树
wake-parent = <&gpio>;
wakeup-source;GPIO 唤醒源 需在 BSP 中配置 irq wake。
调试
cat /sys/power/state
echo mem > /sys/power/state # 需 root,确认硬件支持失败时查 dmesg 哪个设备 suspend 失败。