At Thu, 06 Sep 2007 11:57:03 +0530, Markus Franke wrote:
I just found out that the problem of multiple calls of TRIGGER_START/TRIGGER_STOP might be caused by using ossplay (oss emulation layer) for testing. If I use aplay, TRIGGER_START gets called once but then Alsa goes in a loop continuously calling pcm_pointer().
OK this explains the behavior partly. The repeating call of TRIGGER_START is because of the automatic recovery from XRUN status in OSS emulation code. In ALSA code, it's not automatically recovered but kept stopped as default.
But, it still doesn't explain why XRUN is detected.
Return values of pcm_pointer() look like the following:
---snip--- pcm_pointer returns 0 pcm_pointer returns 1024 pcm_pointer returns 2048 pcm_pointer returns 3072 pcm_pointer returns 4096 pcm_pointer returns 5120 pcm_pointer returns 6144 pcm_pointer returns 7168 pcm_pointer returns 0 pcm_pointer returns 1024 pcm_pointer returns 2048 pcm_pointer returns 3072 pcm_pointer returns 4096 pcm_pointer returns 5120 pcm_pointer returns 6144 pcm_pointer returns 7168 ---snap---
Finally I get a message saying:
---snip--- ALSA sound/core/pcm_native.c:1525: playback drain error (DMA or IRQ trouble?) ---snap---
So, until this the driver runs well but at this point, the driver gets no longer irq. Maybe you can add some debug messages in the irq handler and the code reprogramming the next DMA chunk. Also, in prepare callback, try to output the important parameters, such as format, channels, period_size and buffer_size. Unless you set extra hw_constraints, the buffer_size and period_size aren't always aligned.
Takashi