Skip to content

Commit 6cef6ed

Browse files
claudiubezneagregkh
authored andcommitted
ASoC: renesas: rz-ssi: Terminate all the DMA transactions
commit 541011d upstream. The stop trigger invokes rz_ssi_stop() and rz_ssi_stream_quit(). - The purpose of rz_ssi_stop() is to disable TX/RX, terminate DMA transactions, and set the controller to idle. - The purpose of rz_ssi_stream_quit() is to reset the substream-specific software data by setting strm->running and strm->substream appropriately. The function rz_ssi_is_stream_running() checks if both strm->substream and strm->running are valid and returns true if so. Its implementation is as follows: static inline bool rz_ssi_is_stream_running(struct rz_ssi_stream *strm) { return strm->substream && strm->running; } When the controller is configured in full-duplex mode (with both playback and capture active), the rz_ssi_stop() function does not modify the controller settings when called for the first substream in the full-duplex setup. Instead, it simply sets strm->running = 0 and returns if the companion substream is still running. The following code illustrates this: static int rz_ssi_stop(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) { strm->running = 0; if (rz_ssi_is_stream_running(&ssi->playback) || rz_ssi_is_stream_running(&ssi->capture)) return 0; // ... } The controller settings, along with the DMA termination (for the last stopped substream), are only applied when the last substream in the full-duplex setup is stopped. While applying the controller settings only when the last substream stops is not problematic, terminating the DMA operations for only one substream causes failures when starting and stopping full-duplex operations multiple times in a loop. To address this issue, call dmaengine_terminate_async() for both substreams involved in the full-duplex setup when the last substream in the setup is stopped. Fixes: 4f8cd05 ("ASoC: sh: rz-ssi: Add full duplex support") Cc: [email protected] Reviewed-by: Biju Das <[email protected]> Signed-off-by: Claudiu Beznea <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c2b337b commit 6cef6ed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sound/soc/renesas/rz-ssi.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,12 @@ static int rz_ssi_stop(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
414414
rz_ssi_reg_mask_setl(ssi, SSICR, SSICR_TEN | SSICR_REN, 0);
415415

416416
/* Cancel all remaining DMA transactions */
417-
if (rz_ssi_is_dma_enabled(ssi))
418-
dmaengine_terminate_async(strm->dma_ch);
417+
if (rz_ssi_is_dma_enabled(ssi)) {
418+
if (ssi->playback.dma_ch)
419+
dmaengine_terminate_async(ssi->playback.dma_ch);
420+
if (ssi->capture.dma_ch)
421+
dmaengine_terminate_async(ssi->capture.dma_ch);
422+
}
419423

420424
rz_ssi_set_idle(ssi);
421425

0 commit comments

Comments
 (0)