-
Notifications
You must be signed in to change notification settings - Fork 7k
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
power_domain: Internal SoC PM state change #74371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these actions are meant to notify devices about being turned off or being turned on, please, check https://docs.zephyrproject.org/latest/services/pm/power_domain.html
This change is to allow devices and SoC's that do not use a power domain to receive TURN_ON/OFF actions. Its a property per power state that is in the users control. |
|
Yep that is correct. But it is possible that depending on power state that the SoC sleeps, internal devices my have power removed. But just to be clear, I completely agree, TURN_ON/OFF must be used for when power is applied and removed only, not for different power savings level. |
Maybe the nomenclature is ambiguous ? If this action is only used in cases where a power state cuts of device power, I don't see a problem. |
We have SoC low power states where the IP blocks lose state and need to be reconfigured on exit from low power modes. |
I don't use system PM, is there a link somewhere between the IP blocks that do lose state and the power state with
This is tricky, because adding an extra state means you have to fit it into the existing state transitions. I think the current Are these IP blocks losing state because they are being powered down, or for some other reason (i.e. clocks disabled)? |
This action will be run on all devices. If for some reason the device is already TURNED_OFF, then the system will ignore and move on to the next device. I could add logic to skip calling the TURN_OFF action on devices that are registered with a power-domain driver.
They are being power down by the SoC. |
Then I think
This is a problem. Your suggested solution is not sufficient because that would also run the action on external devices that are not on a power domain. IMO there needs to be a setup where the actions are run ONLY on the IP blocks that are being powered down, not relying on the PM subsystem to discard actions. |
Yep !
Agree, this action should run only in devices that are losing power. @mmahadevan108 you can use the property added in this commit 02a14d7. It tells which power states cause power loss in a device. You may leverage it and trigger on/off in devices using it. |
@ceolin, the |
Great, this is what this PR is proposing.
In this proposal, it is assumed that for certain power states all devices except the one's marked for wakeup are powered down. |
@JordanYates @ceolin @gmarull please let me know your thoughts/suggestions on this PR. |
That is an incorrect assumption, you can't make any statements about the power state of devices that are external to the SoC. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor revisions made by me. I believe this aligns with our desired direction, which is to map all devices to their respective power rails. It is logical to have a separate power rail for devices within the same SoC power domain.
Agree ! |
@JordanYates @ceolin . One thing with this new approach of using a Power Domain Driver is that every node in the SoC dtsi file would need to be updated to add the |
No, that would still run actions on external devices that are not on a power domain (permanently powered). |
That sounds like a reasonable requirement, there needs to be some link between devices and the power states they work in, where else would you put it? |
ebfa93d
to
66f6c8a
Compare
New test added. |
@gmarull , could you kindly revisit this PR. |
66f6c8a
to
ab50188
Compare
Thank you. For my reference and understanding, can you point me to some of these devices |
Pick practically any sensor driver, and find an instance of it in a board file without
|
@mmahadevan108 thanks for putting it together. I tried the test and the failure does not seem to be a test problem. I noticed one additional tick in the timeout that is making the kernel call twice the suspend function instead of one. I am checking why this is happening. |
ab50188
to
97c1b35
Compare
Thanks @ceolin, I have added a change to address that issue. |
This driver triggers the TURN_ON and TURN_OFF actions for certain power states. These power states are specified via device tree. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
The SoC State Change Power Domain driver issues TURN_ON/ TURN_OFF actions to all devices registered with it for certain power states that can be specified via device tree. This test exercises the functionality of this driver. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
97c1b35
to
9c37dbd
Compare
@ceolin @JordanYates @gmarull , thank you for your reviews. I think I have addressed your review comments. Can you please take a look one more time. |
@JordanYates can you take another look please ? |
System managed device power management only invokes PM_DEVICE_ACTION_SUSPEND and PM_DEVICE_ACTION_RESUME actions on the device drivers.
This changes allows the user to specify a property per power state called
zephyr,pm-turn-on-off-action
. This will make the system managed power management framework to invoke PM_DEVICE_ACTION_TURN_OFF and PM_DEVICE_ACTION_TURN_ON actions on the device drivers.This allows device drivers to take additional power saving steps for certain low power states.