pm: device: add action to turn device on
Adds `PM_DEVICE_ACTION_TURN_ON` to transition from `PM_DEVICE_STATE_OFF` to `PM_DEVICE_STATE_SUSPENDED`. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
2e732dff6d
commit
79f382e96e
|
@ -75,6 +75,8 @@ enum pm_device_action {
|
|||
PM_DEVICE_ACTION_RESUME,
|
||||
/** Turn off. */
|
||||
PM_DEVICE_ACTION_TURN_OFF,
|
||||
/** Turn on. */
|
||||
PM_DEVICE_ACTION_TURN_ON,
|
||||
/** Force suspend. */
|
||||
PM_DEVICE_ACTION_FORCE_SUSPEND,
|
||||
};
|
||||
|
|
|
@ -119,6 +119,13 @@ int pm_device_action_run(const struct device *dev,
|
|||
|
||||
state = PM_DEVICE_STATE_OFF;
|
||||
break;
|
||||
case PM_DEVICE_ACTION_TURN_ON:
|
||||
if (pm->state != PM_DEVICE_STATE_OFF) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
state = PM_DEVICE_STATE_SUSPENDED;
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue