dmaengine: xilinx: xdma: Add terminate_all/synchronize callbacks
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 30 Nov 2023 11:13:15 +0000 (12:13 +0100)
committerVinod Koul <vkoul@kernel.org>
Thu, 21 Dec 2023 16:21:28 +0000 (21:51 +0530)
commitf5c392d106e7cc58c7705799ef4c36c3b2f60b31
treec708a8bd96b9c9132385f845397c9f9465ae64fe
parentb3072be7f955e56789a0508c18e9870f45cd9a11
dmaengine: xilinx: xdma: Add terminate_all/synchronize callbacks

The driver is capable of starting scatter-gather transfers and needs to
wait until their end. It is also capable of starting cyclic transfers
and will only be "reset" next time the channel will be reused. In
practice most of the time we hear no audio glitch because the sound card
stops the flow on its side so the DMA transfers are just
discarded. There are however some cases (when playing a bit with a
number of frames and with a discontinuous sound file) when the sound
card seems to be slightly too slow at stopping the flow, leading to a
glitch that can be heard.

In all cases, we need to earn better control of the DMA engine and
adding proper ->device_terminate_all() and ->device_synchronize()
callbacks feels totally relevant. With these two callbacks, no glitch
can be heard anymore.

Fixes: cd8c732ce1a5 ("dmaengine: xilinx: xdma: Support cyclic transfers")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Tested-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://lore.kernel.org/r/20231130111315.729430-5-miquel.raynal@bootlin.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/xilinx/xdma.c