-
Notifications
You must be signed in to change notification settings - Fork 8.3k
soc: silabs: siwx91x: link pm state to power domain and adjust driver #100116
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?
soc: silabs: siwx91x: link pm state to power domain and adjust driver #100116
Conversation
This patch is needed to block the pm_state "PM_STATE_SUSPEND_TO_IDLE" when a device on the power domain (actually all the peripherals) is active. Without this patch, cpu can decide to go to deep sleep while a peripheral is active. Signed-off-by: Martin Hoff <[email protected]>
| } | ||
|
|
||
| /* Get the power management policy state lock */ | ||
| if (!data->zephyr_channel_info[channel].channel_active) { |
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.
Should we also call pm_device_runtime_put() and pm_device_runtime_get() in DMA drivers to ensure that the user doesn’t have to explicitly manage this for memory-to-memory transfers?
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 wonder to add that like intel has done here: dma_intel_adsp_hda.c
I will try but I fear that we miss some cases that introduce some bugs.
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.
that's done, seems to works
Added calls to pm_device_runtime_put() to ensure proper device runtime management when configuration or DMA transceive operations fail. Signed-off-by: Martin Hoff <[email protected]>
3dfaad9 to
8523b0e
Compare
| /* Perform DMA transceive */ | ||
| ret = gspi_siwx91x_transceive_dma(dev, config); | ||
| if (ret < 0) { | ||
| pm_device_runtime_put(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 happens if asynchronous==false && dma=true && ret==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.
Since this PR is mainly about PM, would do it in another PR.
| if (ret < 0) { | ||
| pm_device_runtime_put(dev); | ||
| } | ||
| spi_context_release(&data->ctx, 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.
BTW, is the context released when asynchronous==true && dma=true && ret<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.
same as above comment.
8523b0e to
e60e513
Compare
Removed unnecessary power management state lock calls since the DMA is on a power domain that already handles state locking. It will now managed directly pm_device which will active power_domain and then block pm_state. Signed-off-by: Martin Hoff <[email protected]>
This patch fix a reg write that needs to be done before calling the callback. Since the user can start a new dma transfer in the callback, it can miss the interrupt from the new transfer if the new transfer is done before the interrupt bit is cleared. Signed-off-by: Martin Hoff <[email protected]>
Removed conditional checks for device runtime put in DMA RX and TX callbacks, ensuring that device runtime is always released asynchronously. Signed-off-by: Martin Hoff <[email protected]>
e60e513 to
9f1da5c
Compare
|



The goal of this PR is to have correlation between pm state of the cpu and the soc power domain.
It also correct the driver behavior that are on the power domain.