From: Lars-Peter Clausen <lars@metafoo.de>
To: Vinod Koul <vinod.koul@linux.intel.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Wolfram Sang <w.sang@pengutronix.de>,
	Ralf Baechle <ralf@linux-mips.org>,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH 19/19] ASoC: fsi: Add DMAEngine support
Date: Sat, 04 Feb 2012 18:00:06 +0100	[thread overview]
Message-ID: <4F2D6416.2050400@metafoo.de> (raw)
In-Reply-To: <1328373092.26182.27.camel@vkoul-udesk3>
On 02/04/2012 05:31 PM, Vinod Koul wrote:
> On Fri, 2012-02-03 at 14:14 +0000, Mark Brown wrote:
>> On Fri, Feb 03, 2012 at 03:05:12PM +0100, Lars-Peter Clausen wrote:
>>
>>> Yes, I was faced with the task of writing yet another dmaengine based ASoC
>>> PCM driver last week. At first I thought it might be a good idea to come up
>>> with a common ASoC PCM driver which could be used by all platforms using DMA
>>> engine. Unfortunately this turned out to be not feasible due to how
>>> dmaengine works. Each dmaengine driver has it's custom API for configuring
>>> the DMA controller. :/
> Not really, if the driver is written properly its doable..
yes, _if_. Though with the current state of the dmaengine drivers you need at
least custom code for configuring the DMA controller and for matching the channel.
>>
>> That doesn't sound insurmountible - you need a callback to allow the
>> individual drivers to set the parameters but hopefully the data flow is
>> more generic?  There will probably be some other setup type stuff that
>> needs doing.
> I had though about this sometime back, and if we add dmaengine support
> into asoc, we wouldn't need to add this kind of support in every driver.
> 
> Typically, finding the right channel involves some handshaking between
> client and dma driver, so this is something the PCM driver should do as
> part of setup.
> The dma_chan can be part of the DAI, including the dma_add_t of the
> peripheral. Any required dmac parametrs should be set using
> dma_slave_config at setup.
> Once the stream is opened, asoc core on finding dma_chan in DAI should
> call the dmaengine APIs to get cyclic descriptor (in prepare) and then
> submit. The trigger START should invoke issue_pending callback of DMA.
> Similarly the trigger PAUSE, RESUME maps to dmanegine PAUSE and RESUME
> respectively (if implemented by dmac).
This is sort of what I have implemented right now. Although I also prepare and
submit the dma descriptor in trigger START instead of prepare. Mainly beacuse I
mapped trigger STOP to dmaengine_terminate_all. Or is issue_pending supposed to
just restart the transfer if it is circular, even though terminate_all has been
called?
I also have a helper function which maps a hw_params to a dma_slave_config.
Individual drivers still have to implement their own hw_params callback since
not all fields of a dma_slave_config can be deduced from a hw_params (e.g. the
burst size).
- Lars
next prev parent reply	other threads:[~2012-02-04 17:00 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03  8:48 ASoC: fsi: Add FSI DMAEngine support Kuninori Morimoto
2012-02-03  8:50 ` [PATCH 01/19] ASoC: fsi: reduce runtime calculation by using pre-setting Kuninori Morimoto
2012-02-03  8:50 ` [PATCH 02/19] ASoC: fsi: tidyup: fsi_stream_xx() functions were gathered Kuninori Morimoto
2012-02-03 11:42   ` Mark Brown
2012-02-03  8:50 ` [PATCH 03/19] ASoC: fsi: data push/pop calculation part was divided Kuninori Morimoto
2012-02-03  8:51 ` [PATCH 04/19] ASoC: fsi: rename fsi_dma_soft_xxx() to fsi_pio_xxx() Kuninori Morimoto
2012-02-03  8:51 ` [PATCH 05/19] ASoC: fsi: tidyup: move fsi_fifo_init() onto fsi_hw_startup() Kuninori Morimoto
2012-02-03  8:51 ` [PATCH 06/19] ASoC: fsi: remove unnecessary parameter from fsi_hw_shutdown() Kuninori Morimoto
2012-02-03  8:52 ` [PATCH 07/19] ASoC: fsi: rename fsi_stream_push/pop() to fsi_stream_init/quit() Kuninori Morimoto
2012-02-03  8:52 ` [PATCH 08/19] ASoC: fsi: modify fsi_pio_get_area() parameter and using position Kuninori Morimoto
2012-02-03  8:54 ` [PATCH 09/19] ASoC: fsi: re-define fsi_is_play() and fsi_stream_is_play() Kuninori Morimoto
2012-02-03 11:46   ` Mark Brown
2012-02-03  8:55 ` [PATCH 10/19] ASoC: fsi: use fsi_stream in fsi_get_current_fifo_samples() parameter Kuninori Morimoto
2012-02-03  8:55 ` [PATCH 11/19] ASoC: fsi: add fsi_stream_handler and PIO handler Kuninori Morimoto
2012-02-03  8:56 ` [PATCH 12/19] ASoC: fsi: tidyup: fsi_pio_xxx() are gathered Kuninori Morimoto
2012-02-03  8:56 ` [PATCH 13/19] ASoC: fsi: don't use is_play as a parameter of fsi functions Kuninori Morimoto
2012-02-03  8:57 ` [PATCH 14/19] ASoC: fsi: add .start_stop handler to fsi_stream_handler Kuninori Morimoto
2012-02-03  8:57 ` [PATCH 15/19] ASoC: fsi: fsi_stream_is_working() care substream->runtime Kuninori Morimoto
2012-02-03  8:58 ` [PATCH 16/19] ASoC: fsi: PortA/B information was controlled by sh_fsi_port_info Kuninori Morimoto
2012-02-03  8:59 ` [PATCH 17/19] ASoC: fsi: add .init/.quit handler support Kuninori Morimoto
2012-02-03  8:59 ` [PATCH 18/19] ASoC: fsi: fixup fsi_pointer() calculation method Kuninori Morimoto
2012-02-03 11:55   ` Mark Brown
2012-02-06  0:36     ` Kuninori Morimoto
2012-02-06 16:46       ` Mark Brown
2012-02-07  0:13         ` Kuninori Morimoto
2012-02-07 11:29           ` Mark Brown
2012-02-08  0:08             ` Kuninori Morimoto
2012-02-08 11:50               ` Mark Brown
2012-02-09  0:57                 ` [PATCH 18/19 v2] " Kuninori Morimoto
2012-02-09 10:56                   ` Mark Brown
2012-02-03  8:59 ` [PATCH 19/19] ASoC: fsi: Add DMAEngine support Kuninori Morimoto
2012-02-03 13:48   ` Mark Brown
2012-02-03 14:05     ` Lars-Peter Clausen
2012-02-03 14:14       ` Mark Brown
2012-02-04 16:31         ` Vinod Koul
2012-02-04 17:00           ` Lars-Peter Clausen [this message]
2012-02-04 18:01             ` Vinod Koul
2012-02-04 18:06             ` Vinod Koul
2012-02-04 18:25               ` Lars-Peter Clausen
2012-02-04 18:40                 ` Vinod Koul
2012-02-06  8:47                   ` Lars-Peter Clausen
2012-02-06 14:46                     ` Vinod Koul
2012-02-06 14:50                       ` Lars-Peter Clausen
2012-02-04 17:12           ` Mark Brown
2012-02-20  2:40   ` Mark Brown
2012-02-20  6:58     ` Kuninori Morimoto
2012-02-03 11:56 ` ASoC: fsi: Add FSI " Mark Brown
2012-02-06  0:40   ` Kuninori Morimoto
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=4F2D6416.2050400@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=hsweeten@visionengravers.com \
    --cc=kuninori.morimoto.gx@gmail.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=ralf@linux-mips.org \
    --cc=s.hauer@pengutronix.de \
    --cc=vinod.koul@linux.intel.com \
    --cc=w.sang@pengutronix.de \
    /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).