Skip to content
Closed
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
8 changes: 4 additions & 4 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,7 @@ static void dai_update_start_position(struct comp_dev *dev)
static int dai_comp_trigger_internal(struct comp_dev *dev, int cmd)
{
struct dai_data *dd = comp_get_drvdata(dev);
int prev_state = dev->state;
int ret;

comp_dbg(dev, "dai_comp_trigger_internal(), command = %u", cmd);
Expand Down Expand Up @@ -1101,17 +1102,16 @@ static int dai_comp_trigger_internal(struct comp_dev *dev, int cmd)
dai_trigger_op(dd->dai, cmd, dev->direction);
#else
dai_trigger_op(dd->dai, cmd, dev->direction);
if (dev->state == COMP_STATE_ACTIVE) {
ret = dma_stop(dd->chan->dma->z_dev, dd->chan->index);
} else {
ret = dma_stop(dd->chan->dma->z_dev, dd->chan->index);
if (ret) {
comp_warn(dev, "dma was stopped earlier");
ret = 0;
}
#endif
break;
case COMP_TRIGGER_PAUSE:
comp_dbg(dev, "dai_comp_trigger_internal(), PAUSE");
if (dev->state == COMP_STATE_ACTIVE) {
if (prev_state == COMP_STATE_ACTIVE) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@juimonen Yup, I originally had three places to replace with "prev_state", but one change was not correct. I removed the first check in this PR already., so that only leaves this one check before dma_suspend(). Reading the Zephyr dma.h docs again, it seems also dma_suspend() is safe to call (even if channel is not active. So probably we can make the change and simplify this series.

ret = dma_suspend(dd->chan->dma->z_dev, dd->chan->index);
} else {
comp_warn(dev, "dma was stopped earlier");
Expand Down