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.
There were a few suggestions for what the
soc-manager-serviceshould handle, but for several of them I couldn't come up with abstractions I felt satisfied with after thinking about them and experimenting.For now, this PR keeps it simple and focuses on proper power state transitioning and power regulator rollback in event of failure. In its current state it is more of a library than a service as there are no associated tasks, but that will likely change in the future.
Power state transition
I followed the docs from here for my understanding of valid power state transitions. Offline it was discussed that the
embedded-power-sequencetraits be renamed to match ACPI power state names, but in this context, I think it makes sense to keep them as-is. The S0, S3, etc terminology reflects a state, but we can view theembedded-power-sequencetraits as state transitions which are aptly named IMO. Also just added a simple standard interface for allowing multiple listeners to power state changes (since currently platforms are just rolling their own slightly different but ultimately the same implementation for this).Rollback
Made a simple data structure backed by a heapless vec which acts as a stack that regulator operations can be pushed to. In the event of failure, or explicitly called rollback, this just allows us to reverse every prior regulator operation. The idea is this will be used in the
embedded-power-sequencetrait impls for a SoC (the docs contain an example of how I pictured it being used).Other suggestions folks offered and things I need to think about more:
so will need to think about this a bit more.
Resolves #685