-
Notifications
You must be signed in to change notification settings - Fork 7.4k
SDMA: Fix sound issues after a pause/resume operation #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
base: main
Are you sure you want to change the base?
Conversation
In order to validate DMA operations introduce channel states. This is done to catch situations where some operations are called in an invalid context. e.g starting a channel before configuring it. Signed-off-by: Daniel Baluta <[email protected]>
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 <[email protected]>
@LaurentiuM1234 @iuliana-prodan please review. |
|
@@ -395,6 +423,12 @@ static int dma_nxp_sdma_reload(const struct device *dev, uint32_t channel, uint3 | |||
return 0; | |||
} | |||
|
|||
/* allow reload only for active channels */ | |||
if (chan_data->state != SDMA_CHAN_STATE_STARTED) { | |||
LOG_ERR("%s: invalid state %d", __func__, chan_data->state); |
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.
drop the function name prefix. CONFIG_LOG_FUNC_NAME_PREFIX_
should already do the job.
@@ -347,8 +365,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 && | |||
chan_data->state != SDMA_CHAN_STATE_CONFIGURED) { | |||
LOG_ERR("%s: invalid state %d", __func__, chan_data->state); |
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 here
SDMA_CHAN_STATE_STARTED, | ||
SDMA_CHAN_STATE_STOPPED, | ||
SDMA_CHAN_STATE_SUSPENDED, | ||
SDMA_CHAN_STATE_RELEASING, |
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.
seems unused?
SDMA_CHAN_STATE_CONFIGURED, | ||
SDMA_CHAN_STATE_STARTED, | ||
SDMA_CHAN_STATE_STOPPED, | ||
SDMA_CHAN_STATE_SUSPENDED, |
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.
seems unused?
This patch series introduces sdma channel states in order to prevent invalid state transitions and adds a fix for pause/resume sound issue because computation for total buffer length was wrong.