All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Timur Tabi <timur@freescale.com>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: Accuracy of substream->ops->pointer?
Date: Wed, 11 Mar 2009 09:20:20 +0100	[thread overview]
Message-ID: <49B77444.6070104@ladisch.de> (raw)
In-Reply-To: <49B6C7F7.2090800@freescale.com>

Timur Tabi wrote:
> During capture, my hardware can take up to two milliseconds for the DMA
> to start transferring data to the buffer.  This is because the internal
> FIFO needs to fill up before DMA starts.
> 
> Today, my .trigger function (during a START request) just waits until
> the FIFO is full before returning control back to ALSA.  This seems to
> work, except that I wait by using a busy-loop.  As you can imagine, a
> 2ms busy loop is not a good idea.

Especially as the trigger callback is called inside a spinlock with
interrupts disabled.

> An alternative idea is to have my .pointer function return 0 if DMA has
> not yet started.  This appears to work, but I want to make sure it's a
> good idea.
> 
> My concern is that I might confuse ALSA because it is expecting some
> data in the buffer after capture has started.  Is my approach correct?

0 is the only value that you can return in this situation, because any
other value would imply that the buffer actually contains some valid
data.

The USB driver has bigger delays when starting, and it works.


HTH
Clemens

      reply	other threads:[~2009-03-11  8:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10 20:05 Accuracy of substream->ops->pointer? Timur Tabi
2009-03-11  8:20 ` Clemens Ladisch [this message]

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=49B77444.6070104@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=timur@freescale.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.