pm: device_runtime: add zephyr,pm-device-runtime-auto
Add the `zephyr,pm-device-runtime-auto` flag to `pm.yaml` and `struct pm_device`. This flag is intended to signify to the boot system that device runtime PM should be automatically enabled on the device after the init function has run. Only run `pm_device_runtime_auto_enable` function on a device if initialisation succeeded. This prevents actions being run on devices that are not ready. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
f1111dd679
commit
db3d51bb7d
5 changed files with 54 additions and 8 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <kswap.h>
|
||||
#include <zephyr/timing/timing.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/pm/device_runtime.h>
|
||||
LOG_MODULE_REGISTER(os, CONFIG_KERNEL_LOG_LEVEL);
|
||||
|
||||
/* the only struct z_kernel instance */
|
||||
|
@ -261,6 +262,10 @@ static void z_sys_init_run_level(enum init_level level)
|
|||
dev->state->init_res = rc;
|
||||
}
|
||||
dev->state->initialized = true;
|
||||
if (rc == 0) {
|
||||
/* Run automatic device runtime enablement */
|
||||
(void)pm_device_runtime_auto_enable(dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue