[alsa-devel] TWL4030 low-latency
Peter Ujfalusi
peter.ujfalusi at ti.com
Tue Feb 14 08:46:15 CET 2012
On 01/12/2012 02:09 AM, Jacinto Alvarez wrote:
> Hi Peter,
>
> Thanks for your reply.
>
> Not sure what you mean under latency. For me the latency is the time
> needed to play out the sample at the DMA pointer in main memory.
> In case of McBSP2 (which has 1280 word long buffer) it is maximum of:
> (1280/<number of channels>)/sampling frequency
> In case of stereo sample it is 14.51ms with 44.1KHz, and 13.3ms with
> 48KHz.
>
>
> With latency I refer to the round-trip of the combined capture-playback
> operation. The application I am using creates a couple of input/output
> streams and bounds them together with snd_pcm_link(). The shortest time
> I can get for this round-trip is 1024 frames (~23 ms) and I get that by
> initializing the streams with 8 periods of 128 frames each.
>
>
> In McBSP element mode the McBSP FIFO will be kept full all the time
> (threshold is 0). This means that the McBSP will request one word from
> the DMA if there's a single free slot in the FIFO.
>
> If you switch to threshold mode things will be different under the hood
> (providing better power saving):
> the McBSP threshold value will be calculated according to the period
> size. In this mode the DMA will request for a chunk of data based on the
> threshold value, so the FIFO will be filled with DMA bursts. You still
> have the FIFO caused latency, but the system can rest between bursts.
> I think if you use McBSP threshold mode with 3x 5ms periods you should
> be fine (the ALSA buffer is going to be 15ms).
>
>
> Is this threshold mode set by the application with the
> snd_pcm_sw_params_set_start_threshold() command (e.g., passing a
> non-zero parameter) or are you talking of some tweak INSIDE the driver's
> code?
It is McBSP driver specific. we do not have (yet) ALSA level control for
it. The best fit would be some type of QoS, but I'm not sure of it.
> Currently the application is initializing the streams with
> snd_pcm_sw_params_set_start_threshold() and a value equal to the period
> size (128 frames).
Lets' try this (assuming you are using McBSP2):
echo threshold > /sys/devices/platform/omap/omap-mcbsp.2/dma_op_mode
Do you see difference in the round-trip?
--
Péter
More information about the Alsa-devel
mailing list