From 7709924f16accd45fc2b159d983d84f6e994afd6 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Tue, 20 Oct 2020 11:51:24 +0300 Subject: [PATCH] drivers: imx: sai: Make sure Tx/Rx is disabled at stop TE/RE bit will remain set until the end of current frame. So, for example, even if we set TE to 0 the transmitter will still be enabled until the end of current frame. This can have unexpected results when quickly restarting a channel. Signed-off-by: Daniel Baluta --- src/drivers/imx/sai.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/drivers/imx/sai.c b/src/drivers/imx/sai.c index 084379ffc..07827bf63 100644 --- a/src/drivers/imx/sai.c +++ b/src/drivers/imx/sai.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -85,7 +86,12 @@ static void sai_stop(struct dai *dai, int direction) if (!(xcsr & REG_SAI_CSR_FRDE)) { /* Disable both directions and reset their FIFOs */ dai_update_bits(dai, REG_SAI_TCSR, REG_SAI_CSR_TERE, 0); + poll_for_register_delay(dai_base(dai) + REG_SAI_TCSR, + REG_SAI_CSR_TERE, 0, 100); + dai_update_bits(dai, REG_SAI_RCSR, REG_SAI_CSR_TERE, 0); + poll_for_register_delay(dai_base(dai) + REG_SAI_RCSR, + REG_SAI_CSR_TERE, 0, 100); /* Software Reset for both Tx and Rx */ dai_update_bits(dai, REG_SAI_TCSR, REG_SAI_CSR_SR,