diff options
author | Jai Luthra <j-luthra@ti.com> | 2024-06-11 15:32:55 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-06-11 19:13:31 +0300 |
commit | e8343410ddf08fc36a9b9cc7c51a4e53a262d4c6 (patch) | |
tree | cb7d5a69b3b007d8f3192ee45c937afb97de276f /sound/core/pcm_dmaengine.c | |
parent | b9dd212b14d27a53b63fc6621c452c0b3a01f61d (diff) | |
download | linux-e8343410ddf08fc36a9b9cc7c51a4e53a262d4c6.tar.xz |
ALSA: dmaengine: Synchronize dma channel after drop()
Sometimes the stream may be stopped due to XRUN events, in which case
the userspace can call snd_pcm_drop() and snd_pcm_prepare() to stop and
start the stream again.
In these cases, we must wait for the DMA channel to synchronize before
marking the stream as prepared for playback, as the DMA channel gets
stopped by drop() without any synchronization. Make sure the ALSA core
synchronizes the DMA channel by adding a sync_stop() hook.
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Link: https://lore.kernel.org/r/20240611-asoc_next-v3-1-fcfd84b12164@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/core/pcm_dmaengine.c')
-rw-r--r-- | sound/core/pcm_dmaengine.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c index 12aa1cef11a1..ed07fa5693d2 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -349,6 +349,16 @@ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream, } EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_chan); +int snd_dmaengine_pcm_sync_stop(struct snd_pcm_substream *substream) +{ + struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); + + dmaengine_synchronize(prtd->dma_chan); + + return 0; +} +EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_sync_stop); + /** * snd_dmaengine_pcm_close - Close a dmaengine based PCM substream * @substream: PCM substream |