Skip to content

Introduce CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE #93720

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bjarki-andreasen
Copy link
Contributor

@bjarki-andreasen bjarki-andreasen commented Jul 25, 2025

Introduce the option config PM_DEVICE_RUNTIME_DEFAULT_ENABLE which effectively implicitly adds the devicetree flag zephyr,pm-device-runtime-auto to every node in the devicetree. In reality, it ignores the flag and enables PM_DEVICE_RUNTIME unconditionally, but the behavior is identical from the outside.

Typically, SoCs which utilize PM_DEVICE_RUNTIME need it enabled for every device. Having to add a flag manually to every node all of the devicetrees for these SoCs is tedious and error prone. It is also a software property being set in the devicetree, so in multiple ways a problematic pattern.

All of nordics SoCs require all devices to enable PM_DEVICE_RUNTIME if PM_DEVICE_RUNTIME is enabled. It looks like this also is the case for Ambiq Apollo (@AlessandroLuo @RichardSWheatley @aaronyegx) and Xtensa Ace (@dcpleung @andyross @nashif), please check if this option would be helpful for your platforms as well :)

@bjarki-andreasen bjarki-andreasen force-pushed the nrf-pm-device-runtime-align branch 2 times, most recently from fbc6e7f to 4b360c0 Compare July 25, 2025 12:48
Many SoCs which use PM_DEVICE_RUNTIME need every device in the system
to have PM_DEVICE_RUNTIME enabled to function. Currently, this is only
possible by adding zephyr,pm-device-runtime-auto; to every node in
every devicetree which could potentially implement device power
management. This is very error prone since its easy to miss a node,
especially if users apply overlays, where users need to know and
remember to apply or reapply this property.

This commit adds a Kconfig, disabled by default, which automatically
treats every device as if it had the zephyr,pm-device-runtime-auto
property added to every node.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
Enable CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE by default for all
nordic SoCs if CONFIG_PM_DEVICE_RUNTIME is used. This will ensure
consistent behavior across all nordic SoCs and remove the need
for pasting the devicetree propert zephyr,pm-device-runtime-auto
everywhere.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
@bjarki-andreasen bjarki-andreasen force-pushed the nrf-pm-device-runtime-align branch from 4b360c0 to 0352a64 Compare July 25, 2025 12:59
Remote the redundant zephyr,pm-device-runtime-auto property from
nordic devicetree nodes as these are now implicitly set by
CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE=y at the SoC level.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
@bjarki-andreasen bjarki-andreasen force-pushed the nrf-pm-device-runtime-align branch from 0352a64 to 2f14d77 Compare July 25, 2025 13:00
Copy link

@bjarki-andreasen bjarki-andreasen changed the title nRF pm device runtime align Introduce CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE Jul 25, 2025
@bjarki-andreasen bjarki-andreasen changed the title Introduce CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE Introduce CONFIG_PM_DEVICE_RUNTIME_DEFAULT_ENABLE Jul 25, 2025
@bjarki-andreasen bjarki-andreasen marked this pull request as ready for review July 25, 2025 14:06
@zephyrbot zephyrbot added area: Samples Samples area: UART Universal Asynchronous Receiver-Transmitter area: Power Management platform: nRF Nordic nRFx area: SPI SPI bus labels Jul 25, 2025
@JordanYates
Copy link
Contributor

I'm not against this, but what is the reasoning behind this

Typically, SoCs which utilize PM_DEVICE_RUNTIME need it enabled for every device.

All of nordics SoCs require all devices to enable PM_DEVICE_RUNTIME if PM_DEVICE_RUNTIME is enabled

I've never had a situation where only enabling PM on some devices was problematic.

@bjarki-andreasen
Copy link
Contributor Author

bjarki-andreasen commented Jul 26, 2025

I'm not against this, but what is the reasoning behind this

Typically, SoCs which utilize PM_DEVICE_RUNTIME need it enabled for every device.
All of nordics SoCs require all devices to enable PM_DEVICE_RUNTIME if PM_DEVICE_RUNTIME is enabled

I've never had a situation where only enabling PM on some devices was problematic.

The reasoning is the 100+ redundant occurrences of zephyr,pm-device-runtime-auto; removed in the third commit of this PR. And that's just for nordic SoCs, there are 100+ more occurances in tree which could potentially be removed as well for other platforms mentioned in the description :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Power Management area: Samples Samples area: SPI SPI bus area: UART Universal Asynchronous Receiver-Transmitter platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants