Skip to content

PM DEVICE RUNTIME: Only select EVENTS if PM_DEVICE_RUNTIME_ASYNC=y #93727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions include/zephyr/pm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ struct pm_device {
const struct device *dev;
/** Lock to synchronize the get/put operations */
struct k_sem lock;
#if defined(CONFIG_PM_DEVICE_RUNTIME_ASYNC) || defined(__DOXYGEN__)
/** Event var to listen to the sync request events */
struct k_event event;
#if defined(CONFIG_PM_DEVICE_RUNTIME_ASYNC) || defined(__DOXYGEN__)
/** Work object for asynchronous calls */
struct k_work_delayable work;
#endif /* CONFIG_PM_DEVICE_RUNTIME_ASYNC */
Expand Down Expand Up @@ -199,10 +199,13 @@ BUILD_ASSERT(offsetof(struct pm_device_isr, base) == 0);

/** @cond INTERNAL_HIDDEN */

#ifdef CONFIG_PM_DEVICE_RUNTIME
#ifdef CONFIG_PM_DEVICE_RUNTIME_ASYNC
#define Z_PM_DEVICE_RUNTIME_INIT(obj) \
.lock = Z_SEM_INITIALIZER(obj.lock, 1, 1), \
.event = Z_EVENT_INITIALIZER(obj.event),
#elif CONFIG_PM_DEVICE_RUNTIME
#define Z_PM_DEVICE_RUNTIME_INIT(obj) \
.lock = Z_SEM_INITIALIZER(obj.lock, 1, 1),
#else
#define Z_PM_DEVICE_RUNTIME_INIT(obj)
#endif /* CONFIG_PM_DEVICE_RUNTIME */
Expand Down
2 changes: 1 addition & 1 deletion subsys/pm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ config PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM

config PM_DEVICE_RUNTIME
bool "Runtime Device Power Management"
select EVENTS
help
Enable Runtime Power Management to save power. With device runtime PM
enabled, devices can be suspended or resumed based on the device
Expand All @@ -128,6 +127,7 @@ config PM_DEVICE_DRIVER_NEEDS_DEDICATED_WQ

config PM_DEVICE_RUNTIME_ASYNC
bool "Asynchronous device runtime power management"
select EVENTS
default y
help
Use this option to enable support for asynchronous operation
Expand Down
Loading