From: Timur Tabi <timur@freescale.com>
To: Trent Piepho <xyzzy@speakeasy.org>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: problems writing pcm driver
Date: Tue, 21 Aug 2007 16:30:26 -0500 [thread overview]
Message-ID: <46CB5972.5000603@freescale.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0708210907460.30669@shell2.speakeasy.net>
Trent Piepho wrote:
> The driver writing howto says for hw_params, "is that this callback is
> non-atomic (schedulable)."
>
> If it's non-atomic, that would mean to me that it can be called multiple
> times at once, and at the same time as other callbacks. But, you're saying
> that's not the case?
Sounds like the documentation using a wrong definition of "atomic". Perhaps
it's confused with GFP_ATOMIC, which is a parameter used for kmalloc() when
you don't want the kernel to schedule another task.
> Suppose the ring buffer has 256 frames of valid data in it, from position 0
> to position 255. Do I return 255 or 256? It could be either one,
> depending on how your ring buffer operates.
If you have 256 frames of valid data in a 256-frame buffer, then you are about
to have an underrun condition. I think it would be better if your driver
reported an underrun before it got the 256th frame. Just don't allow the
buffer to be completely full.
Most circular buffers don't really support that concept anyway - they
generally require at least one empty slot.
> I have the pointer callback read a hardware register to get the number of
> frames transferred. Maybe I should instead have the irq handler save this
> register in the chip struct, and just read the value from there in the
> pointer callback? This means I have to use locking between the irq handler
> and the pointer callback, which I have been able to avoid so far.
Is reading a hardware register really that slow?
--
Timur Tabi
Linux Kernel Developer @ Freescale
next prev parent reply other threads:[~2007-08-21 21:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 20:47 problems writing pcm driver Trent Piepho
2007-08-21 9:43 ` Takashi Iwai
2007-08-21 21:22 ` Trent Piepho
2007-08-21 21:30 ` Timur Tabi [this message]
2007-08-21 22:02 ` Eliot Blennerhassett
2007-08-22 5:13 ` Trent Piepho
2007-08-22 9:24 ` Takashi Iwai
2007-08-22 9:07 ` Takashi Iwai
2007-08-22 9:54 ` Trent Piepho
2007-08-22 10:08 ` Takashi Iwai
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=46CB5972.5000603@freescale.com \
--to=timur@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
--cc=xyzzy@speakeasy.org \
/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.