From 9933300592107702c6766fa3795387703bf7f97b Mon Sep 17 00:00:00 2001 From: IBEN EL HADJ MESSAOUD Marwa Date: Mon, 27 May 2024 15:59:12 +0200 Subject: [PATCH] drivers: i2s: i2s_ll_stm32: tx_stream_disable: Add busy wait Add a k_busy_wait to the function tx_stream_disable to be able to complete the drain of the TX queue before disabling. Signed-off-by: IBEN EL HADJ MESSAOUD Marwa --- drivers/i2s/i2s_ll_stm32.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2s/i2s_ll_stm32.c b/drivers/i2s/i2s_ll_stm32.c index d9fbe3e9f8942b1..a8c3fbedf8b4896 100644 --- a/drivers/i2s/i2s_ll_stm32.c +++ b/drivers/i2s/i2s_ll_stm32.c @@ -931,6 +931,8 @@ static void tx_stream_disable(struct stream *stream, const struct device *dev) stream->mem_block = NULL; } + /* Wait for TX queue to drain before disabling */ + k_busy_wait(100); LL_I2S_Disable(cfg->i2s); active_dma_tx_channel[stream->dma_channel] = NULL;