-
Notifications
You must be signed in to change notification settings - Fork 7.4k
SDMA: Fix sound issues caused by SDMA driver #90330
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
Conversation
@LaurentiuM1234 @iuliana-prodan please review. |
Removed unused states and remove |
6beedc6
drivers/dma/dma_nxp_sdma.c
Outdated
@@ -347,8 +363,15 @@ static int dma_nxp_sdma_start(const struct device *dev, uint32_t channel) | |||
|
|||
chan_data = &dev_data->chan[channel]; | |||
|
|||
if (chan_data->state != SDMA_CHAN_STATE_STOPPED && |
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.
repeated start is allowable as is resume from start, but in both cases should likely be a a do nothing request, please make sure that the following bits make sense in that scenario, this seems like it would be -EINVAL which isn't quite matching the expected state machine
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.
Er meant to request changes, the state machine doesn't quite match the documented expectations
Each time we configure an SDMA channel we also compute the total allocated DMA buffer length but we assume is initialized with zero. This is true each time a channel is requested. But if there are multiple calls to configure without releasing the channel the buffer length is not correctly computed. So, we need to initialize it with zero each time we reconfigure the dma channel. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
DMA channel stats like pending_length or free is not protected and can be modified in parallel by a consumer and a producer. This can result in non-atomic updates which in turn will result in using stale data. Fix this by making regions of code accessing dma stats atomic. Fixes: e94c86f ("drivers: dma: Add initial support for NXP SDMA") Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
@teburd I removed the patch that handles the states for now. Lets merge the 2 bugfixes. Will need to study more the DMA state changes diagram. In the DMA state diagram looks like you cannot call directly dma_stop() while in RUNNING state which is odd. I will come back the states when implementing PM support for SDMA driver. |
|
It's there, but the diagram is a bit dense for sure. dma_stop() is allowable at any time and will take the state back to a configured state (once configured the dma channel is always configured to the last known configuration is the thinking...) |
This patch series: