I discovered one thing which lead me to believe something is wrong in my *.pointer* callback. I would like to share it for expert suggestions.
So when a audio playback starts I initialize the buffer pointer to "0" in the *.prepare* function. During my 1st playback the audio driver works great, I see the *.pointer* function getting called a lot of times.
I update the buffer pointer in the URB completion function. Here goes a code segment from my URB completion function:
https://gist.github.com/azizulhakim/d24a36ef753f9a1536fa
And this is my *.pointer* function:
https://gist.github.com/azizulhakim/b15b002f74e77f88cd5a
Now during the 2nd playback, the driver initializes the buffer pointer to "0" again inside the *.prepare* function. And then I see it calls the *.pointer* function only once and afterwards stop with the error message
*ALSA
sound/core/pcm_lib.c:1910 playback write error (DMA or IRQ trouble?)*
So I stopped initializing the buffer pointer to "0" during the second playback assuming that the buffer pointer should stay at the place it stopped from previous playback. But that also didn't work for me. I get
the
same error message. Note that same driver works on Ubuntu without any problem and as many times as I want.
It would be really helpful if I get some suggestion from the given code.
In
case you wonder, the full code is available here <https://github.com/azizulhakim/beagleusb/blob/master/beagle-audio.c
Do your driver really support one period per buffer when you specify .periods_min = 1 ?