-
Notifications
You must be signed in to change notification settings - Fork 8.1k
driver: dma: dma_silabs_siwx91x: Add pm device support for dma driver #94374
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
base: main
Are you sure you want to change the base?
driver: dma: dma_silabs_siwx91x: Add pm device support for dma driver #94374
Conversation
c73b89c
to
620f008
Compare
620f008
to
e603e6d
Compare
0a0e6e1
to
0ac614f
Compare
|
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. |
drivers/dma/dma_silabs_siwx91x.c
Outdated
return -EBUSY; | ||
} | ||
} else if (IS_ENABLED(CONFIG_PM_DEVICE) && (action == PM_DEVICE_ACTION_SUSPEND)) { | ||
return 0; |
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.
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)
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.
addressed
drivers/dma/dma_silabs_siwx91x.c
Outdated
} | ||
if (action == PM_DEVICE_ACTION_RESUME) { | ||
ret = clock_control_on(cfg->clock_dev, cfg->clock_subsys); | ||
if (ret) { |
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.
clock_control_on()
may return -EALREADY
which is not really an error (I know... this API is annoying).
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.
addressed
return -EINVAL; | ||
} | ||
udma_handle = UDMAx_Initialize(&udma_resources, udma_resources.desc, NULL, | ||
(uint32_t *)&data->udma_handle); |
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.
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?
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.
addressed
0ac614f
to
cc83786
Compare
2701c32
to
569979a
Compare
This commit enables the pm device driver support for the dma_silabs_siwx91x driver. Signed-off-by: S Mohamed Fiaz <[email protected]>
569979a
to
845009c
Compare
|
case PM_DEVICE_ACTION_SUSPEND: | ||
break; | ||
case PM_DEVICE_ACTION_TURN_ON: | ||
ret = clock_control_on(cfg->clock_dev, cfg->clock_subsys); |
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.
Do we need to turn this clock in PM_DEVICE_ACTION_TURN_ON
, or this can be done later in PM_DEVICE_ACTION_RESUME
?
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.
I think it was discussed to place it here
power-domains = <&siwx91x_soc_pd>; | ||
zephyr,pm-device-runtime-auto; |
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.
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(); |
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.
we don't need to reconfigure the irq after each wake-up, are we ? this can be done only in the init function IMO
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.
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) ?
This commit enables the pm device driver support for the dma_silabs_siwx91x driver.