From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Jacinto Alvarez <fidorul@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: TWL4030 low-latency
Date: Tue, 14 Feb 2012 09:46:15 +0200 [thread overview]
Message-ID: <4F3A1147.4070209@ti.com> (raw)
In-Reply-To: <CA+fpFZ9-QQ=5uihMfjCQaJBMYeq3QBHMgmYAW3DBQHQTAwK1gw@mail.gmail.com>
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
next prev parent reply other threads:[~2012-02-14 7:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-14 18:24 TWL4030 low-latency Edgar Berdahl
2011-10-14 19:45 ` Ujfalusi, Peter
2011-10-15 20:28 ` Gabriel M. Beddingfield
2011-10-17 1:39 ` Edgar Berdahl
2011-10-17 5:12 ` Ujfalusi, Peter
2011-10-17 11:23 ` Clemens Ladisch
2012-01-04 18:35 ` Jacinto Alvarez
2012-01-09 12:32 ` Peter Ujfalusi
[not found] ` <CA+fpFZ9-QQ=5uihMfjCQaJBMYeq3QBHMgmYAW3DBQHQTAwK1gw@mail.gmail.com>
2012-02-14 7:46 ` Peter Ujfalusi [this message]
2011-10-25 0:21 ` Edgar Berdahl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F3A1147.4070209@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=fidorul@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).