Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/audio/chain_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,28 @@ static int chain_host_stop(struct comp_dev *dev)
int err;

err = dma_stop(cd->chan_host->dma->z_dev, cd->chan_host->index);
if (err < 0)
if (err < 0) {
if (err == -EBUSY) {
int retries = 100;
Copy link
Collaborator

Choose a reason for hiding this comment

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

you probably want to fix the misplaced brace at line 143, and while at it (optionally) you could also consider doing

for (int i = 0; i < 100 && err == -EBUSY; i++) {
    if (!i)
        comp_warn(...);
    k_busy_wait(10);
    err = dma_stop(...);
}
if (err < 0)
    return err;


comp_warn(dev, "dma_stop() fail chan_index = %u, retrying...",
cd->chan_link->index);

/*
* FIXME: ugly workaround for
* https://github.com/thesofproject/sof/issues/8686
*/
while (err == -EBUSY && --retries) {
k_busy_wait(10);
err = dma_stop(cd->chan_link->dma->z_dev, cd->chan_link->index);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, @ujfalusi noted this is likely not doing actual stop from second iterations onwards, so this is a no-op operation (with the HD-DMA driver). Let me revise the workaround to be more explicit...

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this would be identical and more explicit:

diff --git a/src/audio/chain_dma.c b/src/audio/chain_dma.c
index 696973146404..cea2a2e5c8f3 100644
--- a/src/audio/chain_dma.c
+++ b/src/audio/chain_dma.c
@@ -121,7 +121,7 @@ static int chain_host_stop(struct comp_dev *dev)
 	int err;
 
 	err = dma_stop(cd->chan_host->dma->z_dev, cd->chan_host->index);
-	if (err < 0)
+	if (err < 0 && err != -EBUSY)
 		return err;
 
 	comp_info(dev, "chain_host_stop(): dma_stop() host chan_index = %u",

With added comment

if (!err)
goto out;
}
}
return err;
}

out:
comp_info(dev, "chain_host_stop(): dma_stop() host chan_index = %u",
cd->chan_host->index);

Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ manifest:

- name: zephyr
repo-path: zephyr
revision: 9852e8e15bc8536aa1a49cc2697c1e8f802e331f
revision: ad87d2667c3105b7de690af65da6eb08e2496c5a
remote: zephyrproject

# Import some projects listed in zephyr/west.yml@revision
Expand Down