Skip to content

Ssp rx flush - #3550

Merged
lgirdwood merged 2 commits into
thesofproject:masterfrom
keyonjie:ssp_rx_flush
Nov 16, 2020
Merged

lgirdwood merged 2 commits into
thesofproject:masterfrom
keyonjie:ssp_rx_flush

Conversation

@keyonjie

Copy link
Copy Markdown
Contributor
ssp: refine the RX FIFO flushing logic

The SSSR_BSY is not necessary for flushing, we need to read out entries
every time the FIFO is not empty. This flushing may need take place
several rounds, and we need to wait 1 sample time between 2 flushing
rounds.

Fixes #3525

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>

@keyonjie

Copy link
Copy Markdown
Contributor Author

SOFCI TEST

@jdrzaszcz

Copy link
Copy Markdown

Looks like this PR fix this issue: #3525 on external loopack.
I ran tests with trigger pause/stop/start on capture pipeline (100 playback iteration for audio format) on WHL RVP with external loopback and there was no swapped channels.

@keyonjie

Copy link
Copy Markdown
Contributor Author

SOFCI TEST

@keyonjie

Copy link
Copy Markdown
Contributor Author

Looks like this PR fix this issue: #3525 on external loopack.
I ran tests with trigger pause/stop/start on capture pipeline (100 playback iteration for audio format) on WHL RVP with external loopback and there was no swapped channels.

Thank you so much @jdrzaszcz !

Hi @lgirdwood good news that we finally got the external normal SSP capture channel swap issue fixed with this PR, please help to review, we could add similar fixes for BYT next.

@jdrzaszcz

Copy link
Copy Markdown

@keyonjie I have a TGL RVP with external loopback on SSP.
I'm running tests with pause/stop/start on capture pipeline and on this platform channels are still swapped.

This is some example log with: dai_info on "ssp_empty_rx_fifo(), before flushing, entries %d"

dma_trace_1.log

@keyonjie

Copy link
Copy Markdown
Contributor Author

@keyonjie I have a TGL RVP with external loopback on SSP.
I'm running tests with pause/stop/start on capture pipeline and on this platform channels are still swapped.

This is some example log with: dai_info on "ssp_empty_rx_fifo(), before flushing, entries %d"

dma_trace_1.log

Interesting, so looks there is difference between WHL and TGL, let me debug it more.

Comment thread src/include/sof/lib/clk.h 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.

clock_ticks_per_sample(clock, rate);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

clock_ticks_per_sample(clock, rate);

good, let me change.

Comment thread src/lib/clk.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.

inline comments here explaining usage. I'm assuming we get number of ticks per sample ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, let me add inline comments.

Comment thread src/include/sof/drivers/ssp.h 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.

Aren't we using rate here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Aren't we using rate here ?

I wanted to use it as the total timeout control, now I change my mind to use something like this:

#define  SSP_RX_FLUSH_SAMPLE_MAX 16

Will update it in the PR.

@keyonjie

keyonjie commented Nov 6, 2020

Copy link
Copy Markdown
Contributor Author

@lgirdwood FYI that this is to fix normal SSP capture channel swap issue on cAVS (< 2.5) platforms, for cAVS 2.5+, the solution is still open as there is some IP design change and known limitation there. So let's get this merged first before jumping to the TGL issues.

@keyonjie

keyonjie commented Nov 9, 2020

Copy link
Copy Markdown
Contributor Author

SOFCI TEST

Comment thread src/lib/clk.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.

sample_rate is mandatory here. If it's not passed in then return 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sample_rate is mandatory here. If it's not passed in then return 0

Fair, let me change.

Comment thread src/lib/clk.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.

Btw, why are you committing this ? You are not changing anything in clk. I would have expected to invalidate this before we calculate the ticks ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Btw, why are you committing this ? You are not changing anything in clk. I would have expected to invalidate this before we calculate the ticks ?

Indeed, platform_shared_get() should be used to invalidate the clk_info. It was copy-paste from clock_ms_to_ticks(), let me correct it.

Add helper clock_ticks_per_sample() to calculate and return the clock ticks
for a specific sample rate.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
The SSSR_BSY is not necessary for flushing, we need to read out entries
every time the FIFO is not empty. This flushing may need take place
several rounds, and we need to wait 1 sample time between 2 flushing
rounds.

Fixes thesofproject#3525

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
@lgirdwood
lgirdwood merged commit 60dfaa7 into thesofproject:master Nov 16, 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.

3 participants