Skip to content

Conversation

@iuliana-prodan
Copy link
Contributor

@iuliana-prodan iuliana-prodan commented Mar 18, 2021

Cherry-pick some fixes from DAI and IMX for v1.7 final release.

Original pull request was #3867
Fixes: #3809

To stop/suspend an active DMA channel:
1. Stop the DMA service request at the peripheral first (stop the DAI);
2. Disable the hardware service request on the appropriate DMA channel.

For start/resume:
1. Enable the DMA service request on the appropriate channel;
2. Enable the DMA service request at the peripheral (enable DAI).

When the start/stop order for DMA and DAI is different, on multiple
start/stop runs for playback or record or combined, we get an
underrun/overflow.
That's because the DAI makes a DMA request, before the DMA channel is
enabled.

Some platforms cannot just simple disable DMA channel during
the transfer, because it will hang the whole DMA controller.
Therefore, for DMA_SUSPEND_DRAIN, stop the DMA first
and let the DAI drain the FIFO in order to stop the channel
as soon as possible.

Fixes: thesofproject#3809

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Set SAI watermark only once, on sai_set_config().
There is no need to set it each time, on start().

SAI watermark is kept on half FIFO size.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
For SAI, we have the synchronous mode enabled: the transmitter is
configured for asynchronous operation and the receiver for
synchronous operation.
In this case, transmitter bit clock and frame sync are used by both
the transmitter and receiver. So, when enabling RX we need to enable TX
(if not already enabled).

Therefore, for a clear start, we first do a software reset for the current
direction, but checking the state of RX and TX.
This will reset the internal transmitter/receiver logic including the FIFO
pointers.

For capture we can disable the receiver data channel, but on playback,
we can disable the transmitter only if the RX has the DMA requests
disabled.
Also, for capture, there's no need to enable the transmit data channel.
It's sufficient to enable only the transmitter, which enables the bit
clock (shared with RX).

On stop, we just need to disable the DMA request, the transmit/receive data
channel, the interrupts and the receiver and/or the transmitter.

Fixes: thesofproject#3809

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
On start W1C the Work Start Flag, Sync Error Flag and
FIFO Error Flag.

Write a logic 1 to this field to clear each of this
flags and have a clean start for SAI.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Copy link
Collaborator

@paulstelian97 paulstelian97 left a comment

Choose a reason for hiding this comment

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

I assume Intel was OK with the ordering change in the original PR so approving based on that.

@lgirdwood
Copy link
Member

@paulstelian97 @iuliana-prodan please confirm all patches are in master ?

@paulstelian97
Copy link
Collaborator

@paulstelian97 @iuliana-prodan please confirm all patches are in master ?

It's exactly the 4 commits from #3867.

@iuliana-prodan
Copy link
Contributor Author

@paulstelian97 @iuliana-prodan please confirm all patches are in master ?

It's exactly the 4 commits from #3867.

Yes, are the exact patches from master.

@lgirdwood
Copy link
Member

CI showing docker build timeout and known issue on BYT

@lgirdwood lgirdwood merged commit 00708c2 into thesofproject:stable-v1.7 Mar 18, 2021
@marc-hb
Copy link
Collaborator

marc-hb commented Mar 18, 2021

It's exactly the 4 commits from #3867.

Next time use the -x option: git cherry-pick -x [ --stdin ]. Example in #3925

More backporting tips learned from backporting tens of thousands of commits: https://chromium.googlesource.com/chromiumos/docs/+/master/kernel_development.md#How-do-I-backport-an-upstream-patch
Some tips are ChromeOS-specific (ignore them), others are not.

@iuliana-prodan
Copy link
Contributor Author

Next time use the -x option: git cherry-pick -x [ --stdin ]. Example in #3925

More backporting tips learned from backporting tens of thousands of commits: https://chromium.googlesource.com/chromiumos/docs/+/master/kernel_development.md#How-do-I-backport-an-upstream-patch
Some tips are ChromeOS-specific (ignore them), others are not.

@marc-hb Thanks! I'll use -x option next time.

@iuliana-prodan iuliana-prodan deleted the for_stable-v1.7 branch March 29, 2021 08:43
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