-
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
0ac614f
to
cc83786
Compare
2701c32
to
569979a
Compare
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)
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
|
||
/* 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.
addressed
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) ?
845009c
to
b34cfa4
Compare
3e0728e
to
b91c743
Compare
I have updated with pm policy state lock get and put for the driver. |
…driver This commit enables the pm policy state lock support for the dma_silabs_siwx91x driver. Signed-off-by: S Mohamed Fiaz <[email protected]>
b91c743
to
33452cd
Compare
|
I don't think we want to use pm_policy because it's going back to System managed PM. Why don't you used pm_device_runtime_get() instead ? |
Edit: After discussing with @asmellby, I think that using pm_policy lock is mandatory. that's ok. how do you test that it works properly ? |
*/ | ||
}; | ||
|
||
static void siwx91x_dma_pm_policy_state_lock_get(const struct device *dev) |
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.
what is the use of *dev in this function?
} | ||
|
||
/* Get the power management policy state lock */ | ||
siwx91x_dma_pm_policy_state_lock_get(dev); |
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 actually implement PM in GPDMA and see one source of error. In the DMA api definition in zephyr, the user can call dma_start on an already started transfer and it should return no error. Then you will get multiple lock and never going to sleep again. I think you need to take the look only if you didn't have an already running DMA on this channel. Btw, this is he same for dma_stop().
This commit enables the pm device driver support for the dma_silabs_siwx91x driver.