Skip to content
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

Add turn on and off actions for device drivers #65258

Closed
wants to merge 2 commits into from
Closed

Add turn on and off actions for device drivers #65258

wants to merge 2 commits into from

Conversation

mmahadevan108
Copy link
Collaborator

@mmahadevan108 mmahadevan108 commented Nov 15, 2023

This power domain driver reads the power states from device tree which would determine when to turn on/ off device drivers.
Add the PM_DEVICE actions for TURN_ON and TURN_OFF

@mmahadevan108
Copy link
Collaborator Author

@ceolin can you help review this power domain driver. I have tried to keep it generic incase other SoC's might wish to use it.

@mmahadevan108
Copy link
Collaborator Author

@tmleman @ceolin I have update this PR based on some issues I found from testing.

DEVICE_DT_INST_DEFINE(id, NULL, PM_DEVICE_DT_INST_GET(id), \
NULL, &pd_deviceonoff_##id##_cfg, PRE_KERNEL_1, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmahadevan108 I think this domain is re-implementing a lot of things from this pr #60939

This logic to check which power state should trigger device pm should be done in the system pm layer imho.

Wondering now if we should have add a way to the system pm triggers POWER_ON / POWER_OFF depending on the sleep state the soc goes (instead of just suspend / resume).

Copy link
Member

@ceolin ceolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem with the drivers adding PM support but the domain I think is addressing things that should be done at the subsys level.

Copy link

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.

@github-actions github-actions bot added the Stale label Feb 14, 2024
@dleach02 dleach02 removed the Stale label Feb 16, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Apr 17, 2024
@decsny decsny removed the Stale label Apr 17, 2024
return -ENOTSUP;
}

return ret;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work as you expect since the pm subsystem will try to suspend devices before the domain (if they are hierarchically correct), then when the pm action is called for this domain, all devices under it will already be suspended.

Another case this can cause issue is if one enable device runtime pm for this device. In this case, if one does pm_device_runtime_put(domain_device_on_off); while the system is active, pm_state_next_get(0)->state; will return PM_STATE_ACTIVE and it will much likely not suspend devices.

Please take a look in
#70623 I have tried to address this problem where only specifics power states should trigger device pm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ceolin, I have update the implementation based on PR #74371

@decsny decsny removed their request for review May 13, 2024 14:02
@DerekSnell DerekSnell removed their request for review May 13, 2024 14:15
@zephyrbot zephyrbot added the platform: NXP Drivers NXP Semiconductors, drivers label Jun 21, 2024
@zephyrbot zephyrbot requested a review from dbaluta June 21, 2024 20:19
@mmahadevan108 mmahadevan108 changed the title Power Domain driver to turn on and off device drivers Add turn on and off actions for device drivers Jun 21, 2024
Add power action callback handlers to the driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Add PM action for MCUX LPC driver

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Copy link

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.

@github-actions github-actions bot added the Stale label Aug 21, 2024
@dleach02 dleach02 removed the Stale label Aug 23, 2024
@nxp-zephyr nxp-zephyr closed this by deleting the head repository Aug 26, 2024
yvanderv pushed a commit to nxp-zephyr/nxp-zephyr that referenced this pull request Dec 12, 2024
Add PM action for MCUX LPC driver

From list zephyrproject-rtos/zephyr#65258

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
yvanderv pushed a commit to nxp-zephyr/nxp-zephyr that referenced this pull request Dec 12, 2024
Add power action callback handlers to the driver.

From list zephyrproject-rtos/zephyr#65258

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
yvanderv pushed a commit to nxp-zephyr/nxp-zephyr that referenced this pull request Dec 12, 2024
Add PM action for MCUX LPC driver

From list zephyrproject-rtos/zephyr#65258

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
yvanderv pushed a commit to nxp-zephyr/nxp-zephyr that referenced this pull request Dec 12, 2024
Add power action callback handlers to the driver.

From list zephyrproject-rtos/zephyr#65258

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
yvanderv pushed a commit to nxp-zephyr/nxp-zephyr that referenced this pull request Dec 12, 2024
Add PM action for MCUX LPC driver

From list zephyrproject-rtos/zephyr#65258

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
yvanderv pushed a commit to nxp-zephyr/nxp-zephyr that referenced this pull request Dec 12, 2024
Add power action callback handlers to the driver.

From list zephyrproject-rtos/zephyr#65258

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: GPIO area: Power Management area: UART Universal Asynchronous Receiver-Transmitter platform: NXP Drivers NXP Semiconductors, drivers platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants