Linux Runtime PM(运行时电源管理)框架API
Linux 的 Runtime PM(运行时电源管理)框架提供了一系列 API,用于管理设备的电源状态。以下是一些常用的 Runtime PM 系统 API:
更多PM API请见头文件 #include <linux/pm_runtime.h>
-
启用和禁用 API:
○pm_runtime_enable(struct device *dev)
: 启用设备的运行时电源管理
○pm_runtime_disable(struct device *dev)
: 禁用设备的运行时电源管理 -
获取和释放电源管理:
○pm_runtime_get(struct device *dev)
: 增加设备的使用计数,异步请求设备退出低功耗状态
○pm_runtime_get_sync(struct device *dev):
增加设备的使用计数,同步请求设备退出低功耗状态
○pm_runtime_get_noresume
:设备的使用计数会增加,但设备的电源状态不会改变
○pm_runtime_put_noidle
:设备的使用计数会减少,但设备的电源状态不会改变
○pm_runtime_put(struct device *dev)
: 减少设备的使用计数,异步请求设备进入低功耗状态
○pm_runtime_put_sync(struct device *dev)
: 减少设备的使用计数,同步请求设备进入低功耗状态 -
自动挂起和恢复:
○pm_runtime_autosuspend(struct device *dev)
: 请求设备在指定的时间后自动挂起
○pm_runtime_resume(struct device *dev)
: 请求设备恢复到活动状态 -
状态查询:
○pm_runtime_active(struct device *dev)
: 检查设备是否处于活动状态
○pm_runtime_suspended(struct device *dev)
: 检查设备是否处于挂起状态