[LAD] Writing a driver for a device which clears the buffer on the start trigger

Paul Pawlowski mrarmdev at gmail.com
Wed Jul 31 21:34:45 CEST 2019

I'm writing a driver for a device which clears the BAR DMA buffer if I send
the Start IO command to it. I'm not sure how to workaround this issue.

I have got the driver working to some extent by moving the Start IO command
code to the open() callback instead of the trigger(SNDRV_PCM_TRIGGER_START)
however that's obviously a hack and causes issues (the first ~0.1s of audio
is lost).

I also tried to memcpy() the memory to a temporary buffer in the
SNDRV_PCM_TRIGGER_START trigger, however that turned out to be a
performance bottleneck (it took about ~300ms to copy that memory back,
which is ~the period size, probably related).

I'm also aware that using some sort of a copy buffer could work, but that
sounds like a performance waste as it's not needed after the playback is

I tried to search for existing kernel drivers utilizing a similar mechanism
(there's the SNDRV_PCM_INFO_DOUBLE flag after all), but could not find any
results that made sense.

Any help is appreciated.

Thank you,
Paul Pawlowski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.linuxaudio.org/archives/linux-audio-dev/attachments/20190731/1a6e79d8/attachment.html>

More information about the Linux-audio-dev mailing list