Skip to content

dw_dma: Suspend DMA channel in stop function - #2396

Merged
jajanusz merged 2 commits into
thesofproject:masterfrom
ktrzcinx:dw-dma-suspend
Mar 25, 2020
Merged

jajanusz merged 2 commits into
thesofproject:masterfrom
ktrzcinx:dw-dma-suspend

Conversation

@ktrzcinx

Copy link
Copy Markdown
Member

Suspend flag should be set regardless of draining mode to stop
draining data from source buffer.

Comment thread src/include/sof/drivers/dw-dma.h Resolved
@ktrzcinx
ktrzcinx force-pushed the dw-dma-suspend branch 2 times, most recently from aff4940 to a787a9e Compare February 18, 2020 08:41
Comment thread src/drivers/dw/dma.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking deeper, we could keep the single timeout and say

  1. host timeout = DW_DMA_TIMEOUT (100uS)
  2. DAI timeout = period size + DW_DMA_TIMEOUT (i.e. period + 100uS)

What do you think ? Simplifies further and means we are not restricted to 1ms periods.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Idea to use period size is ok, I introduce it in code, but I'm not sure about timeout value bigger than period size.
When we stand that processing time for whole topology should be up to period value (1ms), and agent will panic when this time grow to 2x period (2ms), then with timeout value bigger than period (1ms) we lead to firmware crash instead of trace warning about timeout -> 1ms for processing + 1.1 ms timeout > 2ms

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Simplest solution will be to change agent timeout value above 2x period (2.5 for example), then timeout up to one period will be ok.
The most complicated is creation of separate component state STOP_BEGIN - quite dirty.
Another one is to separate PAUSE and STOP, because in PAUSE there is no need to wait until FIFO will be empty (because we just stop data draining, DMA is still active).
I think that last option sounds best for me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, lets separate pause and stop. If DAI timeout is just for pause and stop then we can have it slightly bigger than remaining data in period (e.g. we can read SAR/DAR). This would guarantee our timeout is based on remaining data in current LLI only.

@lgirdwood

Copy link
Copy Markdown
Member

@ktrzcinx any update ?

@ktrzcinx

ktrzcinx commented Mar 2, 2020

Copy link
Copy Markdown
Member Author

@lgirdwood I'm waiting for #2364 merge because it could interfere.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@tlauda @lyakh any inputs ?

@ktrzcinx
ktrzcinx force-pushed the dw-dma-suspend branch 2 times, most recently from a12edb8 to ebc6866 Compare March 20, 2020 09:29
@lgirdwood

Copy link
Copy Markdown
Member

@ktrzcinx can you check internal CI, Jenkins is known issues.

@ktrzcinx

Copy link
Copy Markdown
Member Author

@lgirdwood some issue occurred with internal CI - not related with this PR - so I can't do that at this moment.

Keep code style consistent.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Data after pause command should be kept compatible to omit
pop noise on output. The solution may be waiting for FIFO
empty but it takes to long - up to 1 processing period time.
Another - introduced - solution is to stop draining new data
from buffer after pause, but keeping dma connection with dai
up to release command. In this place waiting for FIFO empty
shouldn't take so much time, so system agent won't panic and
data will be consistent.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
@lgirdwood

Copy link
Copy Markdown
Member

Jenkins showing legacy is good.

@tlauda

tlauda commented Mar 25, 2020

Copy link
Copy Markdown
Contributor

@lgirdwood Looks good to me.

@jajanusz
jajanusz merged commit 6713d90 into thesofproject:master Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants