Skip to content

Conversation

fimohame
Copy link
Contributor

This commit enables the pm device driver support for the dma_silabs_siwx91x driver.

@fimohame fimohame force-pushed the device_pm_silabs_siwx91x_dma branch 5 times, most recently from c73b89c to 620f008 Compare August 12, 2025 09:28
@fimohame fimohame marked this pull request as ready for review August 12, 2025 09:33
@zephyrbot zephyrbot added platform: Silabs Silicon Labs area: DMA Direct Memory Access labels Aug 12, 2025
@fimohame fimohame force-pushed the device_pm_silabs_siwx91x_dma branch from 620f008 to e603e6d Compare August 12, 2025 10:31
@fimohame fimohame force-pushed the device_pm_silabs_siwx91x_dma branch 3 times, most recently from 0a0e6e1 to 0ac614f Compare August 19, 2025 06:34
Copy link

@Martinhoff-maker
Copy link
Member

Martinhoff-maker commented Sep 5, 2025

As discussed, since we agree to use CONFIG_PM_DEVICE=y and having in mind that going to sleep will completely turn off the device without any register retention on siwx917 board.

return -EBUSY;
}
} else if (IS_ENABLED(CONFIG_PM_DEVICE) && (action == PM_DEVICE_ACTION_SUSPEND)) {
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

As explained here: #94695 (comment)
You also need to turn off clocks as I understand for the future with pm device runtime mode. (Because you can suspend the device without sleeping)

Copy link
Contributor Author

@fimohame fimohame Sep 25, 2025

Choose a reason for hiding this comment

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

addressed

}
if (action == PM_DEVICE_ACTION_RESUME) {
ret = clock_control_on(cfg->clock_dev, cfg->clock_subsys);
if (ret) {
Copy link
Contributor

Choose a reason for hiding this comment

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

clock_control_on() may return -EALREADY which is not really an error (I know... this API is annoying).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed

return -EINVAL;
}
udma_handle = UDMAx_Initialize(&udma_resources, udma_resources.desc, NULL,
(uint32_t *)&data->udma_handle);
Copy link
Contributor

@jerome-pouiller jerome-pouiller Sep 5, 2025

Choose a reason for hiding this comment

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

Do you think UDMAx_Initialize() should be called on PM_DEVICE_ACTION_RESUME or on PM_DEVICE_ACTION_TURN_ON?

I believe Device runtime PM will only play with PM_DEVICE_ACTION_SUSPEND. PM_DEVICE_ACTION_SUSPEND may stop the clocks and the regulator but I believe it will retains the registers.

I assume System Managed PM (or power domains) won't retains the registers but it will call PM_DEVICE_ACTION_TURN_OFF and PM_DEVICE_ACTION_TURN_ON. So, UDMAx_Initialize() should be only done in PM_DEVICE_ACTION_TURN_ON.

@Martinhoff-maker, @asmellby, can you confirm my understanding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed

@fimohame fimohame marked this pull request as draft September 24, 2025 06:50
@fimohame fimohame force-pushed the device_pm_silabs_siwx91x_dma branch from 0ac614f to cc83786 Compare September 24, 2025 20:29
@fimohame fimohame force-pushed the device_pm_silabs_siwx91x_dma branch 2 times, most recently from 2701c32 to 569979a Compare September 24, 2025 20:42
@fimohame fimohame marked this pull request as ready for review September 25, 2025 07:23
This commit enables the pm device driver support
for the dma_silabs_siwx91x driver.

Signed-off-by: S Mohamed Fiaz <[email protected]>
@fimohame fimohame force-pushed the device_pm_silabs_siwx91x_dma branch from 569979a to 845009c Compare September 25, 2025 09:22
Copy link

case PM_DEVICE_ACTION_SUSPEND:
break;
case PM_DEVICE_ACTION_TURN_ON:
ret = clock_control_on(cfg->clock_dev, cfg->clock_subsys);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to turn this clock in PM_DEVICE_ACTION_TURN_ON, or this can be done later in PM_DEVICE_ACTION_RESUME?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it was discussed to place it here

Comment on lines +307 to +308
power-domains = <&siwx91x_soc_pd>;
zephyr,pm-device-runtime-auto;
Copy link
Member

Choose a reason for hiding this comment

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

don't you think we can also apply it to ulpdma ? in ps4 sleep state, we will have have the same behavior than the HP uDMA (no register retention)


/* Connect the DMA interrupt */
cfg->irq_configure();
cfg->irq_configure();
Copy link
Member

Choose a reason for hiding this comment

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

we don't need to reconfigure the irq after each wake-up, are we ? this can be done only in the init function IMO

Copy link
Member

@Martinhoff-maker Martinhoff-maker left a comment

Choose a reason for hiding this comment

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

Just to make sure that we got the same understanding (and it's between all the PM PR):

Since you got no runtime get and put inside of this uDMA driver, you consider that the device will always be suspended or turned off if the power domain is suspended ? Then since we are on the same power-domain than the peripheral that use the uDMA, when you will do a "get" inside of this peripheral, it will turn on the power domain and then put the uDMA from OFF to suspended (but that will be good since everything's is alive in our "suspended" mode) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: DMA Direct Memory Access platform: Silabs Silicon Labs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants