From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Cyclic DMA - callback properties and tx_status residue
Date: Wed, 9 May 2012 10:33:34 +0100 [thread overview]
Message-ID: <20120509093334.GS26481@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CACRpkdYTpP_nW+CJiJNPLgU6fXtR6ku3-OQaA4ceYtB3ZM5sqQ@mail.gmail.com>
On Wed, May 09, 2012 at 11:27:17AM +0200, Linus Walleij wrote:
> On Wed, May 2, 2012 at 6:27 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>
> >> > What is the desired behaviour of the callback for cyclic DMA?
> >>
> >> Typically cyclic DMA is used in the case of sound. This is where alsa
> >> expects the "period" callback for every DMA period.
> >> Generally, such notification serves the purpose of letting client know
> >> that one "block" has been completed.
> >
> > Yes, though as we have this interface as something generic I didn't want
> > to call it "the alsa dma interface".
>
> There is a DMAengine helper in ALSA SoC these days,
> sound/soc/soc-dmaengine-pcm.c which does not yet include
> get position calls, but I expect that's where the ALSA glue will
> end up.
I'm more or less ignoring that because with current DMA engine stuff, it's
buggy. The presence of such a user doesn't really define how this
interface supposed to work either.
> >> IIRC had pointed Lars to this API, but quick check of code reveals that
> >> this is unused. I think returning residue as remaining bytes of current
> >> "block" makes sense. This easily gives knowledge of where DMA pointer is
> >> wrt current ongoing transaction. Was that your meaning of end of cyclic
> >> buffer, not sure what end means here?
> >
> > I think the residue thing was something Linus created, which is why he's
> > included in this thread...
>
> Lars-Peter Clausen is the person writing the ALSA SoC wrapper.
> Lars-Peter: do you have plans to implement residue calls for
> getting buffer position?
>
> It was originally created to be able to use DMA for ALSA SoC on
> the U300. I still don't know if there is some other viable usecase
> but I expect that things like multimedia codecs would use a DMA
> engine much the same way.
Given that counting the number of period callbacks to determine the
position is buggy, soc-dmaengine-pcm.c is buggy as it currently stands.
I'm willing to bet that if ALSA requests a small period size, and you
load a system up with lots of activity, you'll eventually hear
corrupted audio.
It's difficult to test because the corruption will probably only be
occasional and it'll be purely audio based - it'll basically play the
bit of the buffer that's currently being loaded with new data from time
to time because ALSAs idea of where the DMA is vs where the hardware
is will gradually slip over time.
next prev parent reply other threads:[~2012-05-09 9:33 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 14:45 Cyclic DMA - callback properties and tx_status residue Russell King - ARM Linux
2012-05-02 16:01 ` Vinod Koul
2012-05-02 16:27 ` Russell King - ARM Linux
2012-05-04 12:26 ` Russell King - ARM Linux
2012-05-04 12:45 ` Vinod Koul
2012-05-10 22:54 ` Russell King - ARM Linux
2012-05-11 3:00 ` Vinod Koul
2012-05-11 12:24 ` Linus Walleij
2012-05-11 13:03 ` Russell King - ARM Linux
2012-05-15 5:02 ` Vinod Koul
2012-05-09 9:27 ` Linus Walleij
2012-05-09 9:33 ` Russell King - ARM Linux [this message]
2012-05-09 11:16 ` Mark Brown
2012-05-09 12:19 ` Russell King - ARM Linux
2012-05-09 12:49 ` Lars-Peter Clausen
2012-05-09 14:03 ` Mark Brown
2012-05-10 3:44 ` Vinod Koul
2012-05-10 7:44 ` Russell King - ARM Linux
2012-05-10 10:58 ` Vinod Koul
2012-05-10 13:19 ` Huang Shijie
2012-05-10 14:54 ` Vinod Koul
2012-05-10 9:42 ` Mark Brown
2012-05-10 11:01 ` Vinod Koul
2012-05-11 14:02 ` Mark Brown
2012-05-11 14:07 ` Russell King - ARM Linux
2012-05-11 14:18 ` Mark Brown
2012-05-11 14:29 ` Russell King - ARM Linux
2012-05-11 15:07 ` Mark Brown
2012-05-15 5:07 ` Vinod Koul
2012-05-15 7:37 ` Russell King - ARM Linux
2012-05-15 8:58 ` Vinod Koul
2012-05-09 12:35 ` Lars-Peter Clausen
2012-05-07 10:40 ` Mark Brown
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=20120509093334.GS26481@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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 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).