Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dbaluta
Copy link
Collaborator

@dbaluta dbaluta commented May 22, 2025

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.

@github-actions github-actions bot added area: DMA Direct Memory Access platform: NXP Drivers NXP Semiconductors, drivers labels May 22, 2025
dbaluta added 2 commits May 23, 2025 14:49
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]>
@dbaluta
Copy link
Collaborator Author

dbaluta commented May 23, 2025

@LaurentiuM1234 @iuliana-prodan please review.

Copy link

@@ -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);
Copy link
Collaborator

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);
Copy link
Collaborator

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,
Copy link
Collaborator

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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems unused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DMA Direct Memory Access platform: NXP Drivers NXP Semiconductors, drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants