fix(sleep): use pm_power_state_force for proper device power management#1291
Merged
petejohanson merged 1 commit intozmkfirmware:mainfrom May 17, 2022
Merged
Conversation
petejohanson
approved these changes
May 17, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
pm_power_state_set, we skip over all of the device-related power management seen here: https://docs.zephyrproject.org/latest/services/pm/system.html#system-power-managementAlthough I wasn't able to 100% confirm this from reading Zephyr code,
pm_power_state_forceseems to force the next state to what you want, and then all of the rest of the diagram follows as expected setting device power states. In our case,STATE_OFFsets devices to standby, which is why those actions got updated.We should probably be aware of the fact that this currently just sets CPU 0 to off. This may be an issue with dual/multi-core chips like the nrf5340. I'm not sure about that though.