[alsa-devel] [PATCH 3/3] ASoC: omap-mcbsp: make minimum period size larger than FIFO

Grazvydas Ignotas notasas at gmail.com
Mon Mar 12 13:05:55 CET 2012

On Sun, Mar 11, 2012 at 7:39 PM, Jarkko Nikula <jarkko.nikula at bitmer.com> wrote:
> On Fri, 2012-03-09 at 23:07 +0200, Grazvydas Ignotas wrote:
>> On Fri, Mar 9, 2012 at 3:42 PM, Peter Ujfalusi <peter.ujfalusi at ti.com> wrote:
>> > On 03/09/2012 03:25 PM, Grazvydas Ignotas wrote:
>> >>> If this is a real issue in Pandora, could it be solved with adding
>> >>> /etc/asound.conf to the filesystem, and limit the period size via that?
>> >>
>> >> We are already doing that, however we encourage people to install
>> >> their own distros on pandora, and now they have to drag whole ALSA
>> >> configuration for things to work. IMHO device driver like this must be
>> >> able to work without any special userspace configuration.
>> >
> I agree. What's the use case where the problem shows up?

When alsa program doesn't set high enough start_threshold and period
size, or when using OSS with smaller period (start_threshold is period
size there).

> Or actually hw
> parameters in that use case so can it be repeated using plain
> aplay/arecord?

aplay -D hw:0 -f s16_le -c 2 --period-size=512 --start-delay=50000 /dev/urandom

note that this will only show problems on OMAP3 McBSP2 due to it's long FIFO.

>> > We have two issues here:
>> > if you are using the element mode (dma_op_mode) you might want to have
>> > bigger period size than the FIFO size. However if you are using the
>> > threshold mode you will be fine with a period size between fifo_size/2,
>> > and fifo_size.
>> Threshold mode doesn't seem to help, I still need to go over FIFO
>> size. From what I can see in the code it's setting the threshold to
>> period size, so I still get underflow condition after first write, as
>> first write goes to FIFO, DMA shows that it has nothing left to send
>> after first write finishes.
> Period size smaller than FIFO size has used to work in element mode too
> but I think I have always used in my tests multiple periods. What I'm
> thinking if we have a boundary condition with 2-3 periods and where
> buffer size is near FIFO size.

I'm not sure what boundary means in ALSA, but ASoC never touches it or

> I think instead of limiting minimum period size to FIFO size we should
> find that boundary condition. Like if min buffer > FIFO + 1 period or
> something like that in order to keep possible to use small periods.

I was testing some hacks that force runtime->start_threshold to a bit
above FIFO size with good results, however none of ASoC code ever
touches it, so I guess it could be considered wrong thing to do, but
it works with everything I tested so far, including OSS emulation.


More information about the Alsa-devel mailing list