Skip to content

Commit 9aa33d5

Browse files
hcodinabroonie
authored andcommitted
ASoC: fsl: fsl_qmc_audio: Reset audio data pointers on TRIGGER_START event
On SNDRV_PCM_TRIGGER_START event, audio data pointers are not reset. This leads to wrong data buffer usage when multiple TRIGGER_START are received and ends to incorrect buffer usage between the user-space and the driver. Indeed, the driver can read data that are not already set by the user-space or the user-space and the driver are writing and reading the same area. Fix that resetting data pointers on each SNDRV_PCM_TRIGGER_START events. Fixes: 075c712 ("ASoC: fsl: Add support for QMC audio") Cc: stable@vger.kernel.org Signed-off-by: Herve Codina <herve.codina@bootlin.com> Link: https://patch.msgid.link/20250410091643.535627-1-herve.codina@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5fc7d2b commit 9aa33d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/soc/fsl/fsl_qmc_audio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ static int qmc_audio_pcm_trigger(struct snd_soc_component *component,
250250
switch (cmd) {
251251
case SNDRV_PCM_TRIGGER_START:
252252
bitmap_zero(prtd->chans_pending, 64);
253+
prtd->buffer_ended = 0;
254+
prtd->ch_dma_addr_current = prtd->ch_dma_addr_start;
255+
253256
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
254257
for (i = 0; i < prtd->channels; i++)
255258
prtd->qmc_dai->chans[i].prtd_tx = prtd;

0 commit comments

Comments
 (0)