On Sun, 26 Apr 2009, Jon Smirl wrote:
On Sun, Apr 26, 2009 at 4:12 AM, Jaroslav Kysela perex@perex.cz wrote:
On Sat, 25 Apr 2009, Jon Smirl wrote:
This appears to be a bug in this code...
if (delta < 0) { delta += runtime->period_size * runtime->periods;
it was adding, buffer_size. But buffer_size is not correct when the periods don't evenly fit into the buffer
Could you show real values what you're getting here with your driver?
psc_dma_pcm_pointer pos 0 hw_ptr_interrupt 22052 new_hw_ptr 0
pos should be >2 here for buffer_size = 22050 and period_size = 5513.. Your driver code is broken - the routine must be called when period_size is processed - not before and .pointer callback must return correct value at this point..
So pos at interrupt time should be equal or slightly greater than:
5513, 11026, 16540, 22054 % 22050 = 4, 5517 etc..
pos is position from range 0 .. (buffer_size - 1) not from range 0 .. (periods * period_size).
Jaroslav
----- Jaroslav Kysela perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.