On Fri, Dec 17, 2010 at 1:38 PM, Jaroslav Kysela <perex@xxxxxxxx> wrote: > On Fri, 17 Dec 2010, Manu Abraham wrote: > >> Thanks, that was very helpful. I am looking at it. I did find an issue >> looking at the pointer callback itself straight away. >> >> The logs do look thus now: http://pastebin.ca/2021872 > > This is your problem (first irq_handler): > > saa7231_irq_handler (0): status=0x800 vector=43 event=43 handler:f83b91ff > saa7231_capture_pointer (0): DEBUG:() Index:0 with frames:0, total 48 pages > saa7231_capture_trigger (0): Trying to STOP stream, cmd=0 > > The pointer should return how many samples are filled (probably value 6144 > in your case). The midlevel code expects that at least one period has been > recorded, but your pointer() callbacks returned 0 here. It is wrong. > Ignoring STOP/START is just a bad workaround for the broken driver. Initially, I had to ignore the CMD's to understand what was happening, ie why the DMA engine was giving me buffer index:0 and hence I did ignore the START/STOP CMD's. I did hardcoded the max frames per buffer to be 6144 (as your guess), as you can see... stride = 768; /* meaningless in 1D mode */ buf_size = 24576; //7680; x_length = 32;// 4 /* max bytes in a line/frame/packet */ // y_length = 1920; /* max lines/frames/packets per buffer */ y_length = 6144; //1920; /* max lines/frames/packets per buffer */ SAA7231_WR(x_length, SAA7231_BAR0, module, S2D_CHx_B1_X_LENGTH(0)); SAA7231_WR(y_length, SAA7231_BAR0, module, S2D_CHx_B1_Y_LENGTH(0)); Initially, I was of the understanding that capture pointer wanted the start of the buffer and hence started with 0, 6144 and multiples of it... Now that you mention it; I modified it to return 6144 frames after each interrupt. static snd_pcm_uframes_t saa7231_capture_pointer(struct snd_pcm_substream *pcm) { struct saa7231_audio *audio = snd_pcm_substream_chip(pcm); struct saa7231_dev *saa7231 = audio->saa7231; struct snd_pcm_runtime *rt = pcm->runtime; u32 frames, buf_size; buf_size = 24576; frames = (buf_size / 4) * (audio->index + 1); dprintk(SAA7231_DEBUG, 1, "DEBUG:() Index:%d with frames:%d, total %d pages", audio->index, frames, audio->pages); return frames; } Eventually the arecord overrun error is gone completely testbox v4l # arecord -D plughw:2,0 --format S16_LE --rate=48000 -c 2 > /tmp/test3.wav Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo ^CAborted by signal Interrupt... Eventually, fixed the capture_trigger > >> Now, I do get a .wav file The contents of which seems to be junk ?? >> >> http://202.88.242.108:8000/test/test.wav >> >> Tried to play it back with alsaplayer and mplyer with no results, >> mplayer shows no issues though.. Maybe PCM corruptions ? But at least >> some noises it should make ? > > Try add some printk directly to the driver to show the few recorded samples > in the DMA buffers. I did add a few printks, the data seems to be all 0's. http://pastebin.ca/2021947 I guess the NULL data is not an Alsa related issue ? Thanks again for all the help. Thanks, Manu _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel