You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: Extend Zephyr PM to Support Custom Next Event Ticks via Hook
Background
In Zephyr’s power management, the function pm_system_suspend determines the next system wake-up time by considering kernel ticks and an optional custom event list. This event list is typically populated on an event-driven basis whenever events change.
However, certain use cases involve proprietary or complex data sources for the next event timing that cannot be easily or practically translated into entries in the event list. Examples include:
Timing information stored in hardware registers.
Proprietary binary code modules where source modification is impractical.
Complex data structures that are inefficient to convert into event list format.
Proposal
Introduce a new optional hook, pm_policy_next_custom_ticks(), which allows retrieving the next event ticks directly from a custom source. This hook will be called during the suspend decision process to complement the existing kernel and event list ticks.
Implementation
In pm_system_suspend, extend the tick calculation as follows:
/* * Determine the earliest tick count among kernel ticks, event list ticks, * and optionally, custom ticks provided by a user-defined hook. */events_ticks=pm_policy_next_event_ticks();
ticks=ticks_expiring_sooner(kernel_ticks, events_ticks);
#ifdefCONFIG_PM_CUSTOM_TICKS_HOOKexternint64_tpm_policy_next_custom_ticks(int64_tcurrent_ticks); /* Declaration in policy.h */ticks=ticks_expiring_sooner(pm_policy_next_custom_ticks(ticks), ticks);
#endif
pm_policy_next_custom_ticks(int64_t current_ticks) should return the next event tick count from the custom source, considering current_ticks as a reference or upper bound.
The hook is enabled via CONFIG_PM_CUSTOM_TICKS_HOOK Kconfig option.
This extension maintains backward compatibility, as the hook is optional.
Benefits
Enables integration with proprietary or hardware-specific timing sources.
Avoids costly or impractical translation of complex event data into the event list.
Increases flexibility and extensibility of Zephyr’s power management framework.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal: Extend Zephyr PM to Support Custom Next Event Ticks via Hook
Background
In Zephyr’s power management, the function
pm_system_suspenddetermines the next system wake-up time by considering kernel ticks and an optional custom event list. This event list is typically populated on an event-driven basis whenever events change.However, certain use cases involve proprietary or complex data sources for the next event timing that cannot be easily or practically translated into entries in the event list. Examples include:
Proposal
Introduce a new optional hook,
pm_policy_next_custom_ticks(), which allows retrieving the next event ticks directly from a custom source. This hook will be called during the suspend decision process to complement the existing kernel and event list ticks.Implementation
In
pm_system_suspend, extend the tick calculation as follows:pm_policy_next_custom_ticks(int64_t current_ticks)should return the next event tick count from the custom source, considering current_ticks as a reference or upper bound.CONFIG_PM_CUSTOM_TICKS_HOOKKconfig option.Benefits
@ceolin, any possible unwanted side effects ?
Beta Was this translation helpful? Give feedback.
All reactions