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

drivers: intel_adsp: Refactor Power Management Initialization for DMIC, SSP, and GPDMA Drivers #82115

Conversation

tmleman
Copy link
Collaborator

@tmleman tmleman commented Nov 27, 2024

This pull request refactors the power management initialization for the DMIC, SSP, and GPDMA drivers across ACE15, ACE20, and ACE30 generations.

The current implementation of power management initialization for these drivers does not fully comply with the recommended practices outlined in the documentation. This refactor addresses these issues, ensuring that the drivers are initialized correctly and consistently. The functionality of the power management state remains unchanged, ensuring consistent behavior across all three generations.

Changes:

  1. DMIC Driver:
    • Replaced the conditional initialization of power management state with a call to pm_device_driver_init in the dai_dmic_initialize_device function.
    • Added the zephyr,pm-device-runtime-auto property to the DMIC nodes in the device tree files for ACE15, ACE20, and ACE30.
  2. SSP Driver:
    • Replaced the conditional initialization of power management state with a call to pm_device_driver_init in the ssp_init function.
    • Added the zephyr,pm-device-runtime-auto property to the SSP nodes in the device tree files for ACE15, ACE20, and ACE30.
    • Moved the power domain assignment for the SSP device in the device tree. The previous configuration resulted in the device not being under any power domain and being initialized as always ON.
  3. GPDMA Driver:
    • Replaced the conditional initialization of power management state with a call to pm_device_driver_init in the intel_adsp_gpdma_init function.
    • Ensured that the GPDMA driver is initialized with the appropriate power management state and that runtime power management is automatically enabled based on the device tree configuration.

@zephyrbot zephyrbot added area: Xtensa Xtensa Architecture platform: Intel ADSP Intel Audio platforms area: DMA Direct Memory Access area: DAI labels Nov 27, 2024
danieldegrasse added a commit to nxp-upstream/zephyr that referenced this pull request Nov 27, 2024
When reprinting the shell command buffer with long user inputs, the
reprinted buffer may cross a line boundary, and require a newline to be
printed. For these cases, print the command buffer character by
character, inserting newlines as appropriate.

Fixes zephyrproject-rtos#82115

Signed-off-by: Daniel DeGrasse <[email protected]>
@tmleman tmleman force-pushed the topic/upstream/pr/pm/device_runtime/refactor branch from e247afe to b18d544 Compare November 28, 2024 13:36
kv2019i
kv2019i previously approved these changes Nov 28, 2024
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Looks very nice clean up of the code.


return pm_device_runtime_enable(dev);
return pm_device_driver_init(dev, dmic_pm_action);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not an expert with the pm code, but this does look very clean and matches with other drivers' use of Zephyr runtime-pm, so looks good for me.

@tmleman tmleman force-pushed the topic/upstream/pr/pm/device_runtime/refactor branch 3 times, most recently from 136207d to b5e455c Compare December 6, 2024 10:54
@tmleman
Copy link
Collaborator Author

tmleman commented Dec 6, 2024

Rebase to enable testing in SOF CI: thesofproject/sof#9713

This patch refactors the power management initialization for the DMIC
driver across ACE15, ACE20, and ACE30 generations to align with the
recommended practices outlined in the documentation. The changes
include:

1. Replacing the conditional initialization of power management state
   with a call to `pm_device_driver_init` in the
   `dai_dmic_initialize_device` function.
2. Adding the `zephyr,pm-device-runtime-auto` property to the DMIC nodes
   in the device tree files for ACE15, ACE20, and ACE30.

These changes ensure that the DMIC driver is initialized with the
appropriate power management state and that runtime power management is
automatically enabled based on the device tree configuration. The
functionality of the power management state remains unchanged, ensuring
consistent behavior.

Signed-off-by: Tomasz Leman <[email protected]>
This patch refactors the power management initialization for the SSP
driver across ACE15, ACE20, and ACE30 generations to align with the
recommended practices outlined in the documentation. The changes
include:

1. Replacing the conditional initialization of power management state
   with a call to `pm_device_driver_init` in the `ssp_init` function.
2. Adding the `zephyr,pm-device-runtime-auto` property to the SSP nodes
   in the device tree files for ACE15, ACE20, and ACE30.
3. Moving the power domain assignment for the SSP device in the device
   tree. The previous configuration resulted in the device not being under
   any power domain and being initialized as always ON.

These changes ensure that the SSP driver is initialized with the
appropriate power management state and that runtime power management is
automatically enabled based on the device tree configuration. The
functionality of the power management state remains unchanged, ensuring
consistent behavior.

Signed-off-by: Tomasz Leman <[email protected]>
This patch refactors the power management initialization for the Intel
ADSP GPDMA driver. The changes include:

1. Replacing the conditional initialization of power management state
   with a call to `pm_device_driver_init` in the `intel_adsp_gpdma_init`
   function.
2. Ensuring that the GPDMA driver is initialized with the appropriate
   power management state and that runtime power management is
   automatically enabled based on the device tree configuration.

These changes streamline the power management initialization process and
ensure consistency with other drivers.

Signed-off-by: Tomasz Leman <[email protected]>
@tmleman
Copy link
Collaborator Author

tmleman commented Dec 9, 2024

SOF CI did not show any regression.

@tmleman tmleman requested a review from kv2019i December 9, 2024 10:43
@kartben kartben merged commit 9edca5e into zephyrproject-rtos:main Dec 11, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DAI area: DMA Direct Memory Access area: Power Management area: Xtensa Xtensa Architecture platform: Intel ADSP Intel Audio platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants