]> git.hungrycats.org Git - linux/commitdiff
ALSA: pcm_dmaengine: Don't synchronize DMA channel when DMA is paused
authorShengjiu Wang <shengjiu.wang@nxp.com>
Wed, 17 Jul 2024 06:44:53 +0000 (14:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Jul 2024 09:36:18 +0000 (11:36 +0200)
commit 88e98af9f4b5b0d60c1fe7f7f2701b5467691e75 upstream.

When suspended, the DMA channel may enter PAUSE state if dmaengine_pause()
is supported by DMA.
At this state, dmaengine_synchronize() should not be called, otherwise
the DMA channel can't be resumed successfully.

Fixes: e8343410ddf0 ("ALSA: dmaengine: Synchronize dma channel after drop()")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Cc: <stable@vger.kernel.org>
Link: https://patch.msgid.link/1721198693-27636-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/pcm_dmaengine.c

index e299e8634751f4ca25e6a2fa1c5ff8f92e784659..62489677f3947ea380143d159a11b9e6658f51fa 100644 (file)
@@ -352,8 +352,12 @@ 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);
+       struct dma_tx_state state;
+       enum dma_status status;
 
-       dmaengine_synchronize(prtd->dma_chan);
+       status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state);
+       if (status != DMA_PAUSED)
+               dmaengine_synchronize(prtd->dma_chan);
 
        return 0;
 }