All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com
Subject: Re: [PATCH v2 5/9] ASoC: sti: Add platform driver
Date: Wed, 27 May 2015 10:48:04 +0200	[thread overview]
Message-ID: <556584C4.3080004@st.com> (raw)
In-Reply-To: <20150525125002.GQ21391@sirena.org.uk>



On 05/25/2015 02:50 PM, Mark Brown wrote:
> On Mon, May 18, 2015 at 02:12:52PM +0200, Arnaud Pouliquen wrote:
>> +	return snd_dmaengine_pcm_prepare_slave_config(substream, params,
>> +						     &dma_params->slave_config);
>
> You're using dmaengine but at least one of the earlier patches supplied
> a snd_pcm_hardware - the dmaengine code should be able to figure out
> constraints from the dmaengine driver in current code, is that causing
> you problems?
>
>> +static int sti_pcm_trigger(struct snd_pcm_substream *substream,
>> +			   int cmd)
>> +{
>> +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
>> +	struct snd_pcm_runtime *runtime = substream->runtime;
>> +	struct sti_pcm_dma_params *params = runtime->private_data;
>> +	enum dma_transfer_direction direction;
>> +	struct dma_async_tx_descriptor *desc;
>> +	unsigned long flags = DMA_CTRL_ACK;
>> +	int ret = 0;
>> +
>> +	switch (cmd) {
>> +	case SNDRV_PCM_TRIGGER_START:
>> +	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
>> +	case SNDRV_PCM_TRIGGER_RESUME:
>> +		direction = snd_pcm_substream_to_dma_direction(substream);
>> +
>> +		desc = dmaengine_prep_dma_cyclic(
>> +				params->dma_channel,	runtime->dma_addr,
>> +				snd_pcm_lib_buffer_bytes(substream),
>> +				snd_pcm_lib_period_bytes(substream),
>> +				direction, flags);
>
> Can you use snd_dmaengine_pcm_trigger?
>
>> +static snd_pcm_uframes_t sti_pcm_pointer(struct snd_pcm_substream *substream)
>> +{
>
> snd_dmaengine_pcm_pointer()?
>
As dmaengine_pcm_runtime_data is static, in this case i need to use also 
all the other ops function. i tried this before without success.
But as i don't remember the reason , I will test it again...

>> +static int sti_platform_engine_probe(struct platform_device *pdev)
>> +{
>> +	/*
>> +	 * Driver can not use snd_dmaengine_pcm_register.
>> +	 * Reason is that DMA needs to load a firmware.
>> +	 * This firmware is loaded on request_channel from file system.
>> +	 * So can not be done in probe while alsa card enumerated before
>> +	 * file system is mounted
>> +	 */
>
> This is not the only driver with similar needs, the Intel drivers use
> firmwares as well (all the DMA is done by the DSP which needs firmware)
> and even if it were we should be able to arrange for this to work rather
> than having to open code things.  That might mean having the dmaengine
> driver requesting firmware with _nowait() and then waiting until the
> firmware appears before registering as a DMA controller for example.  We
> may also be able to have the DMA engine only load the firmware when it's
> used rather than at probe (that might allow us to keep the DMA
> controller powered off for longer which would be a power win if possible).
>
> It's not just restricted to audio either.
>

Move dmaengine_pcm_request_chan from register to open could be a good 
compromise with (i hope) no impact on drivers that already use 
soc_generic_dma_engine. This is the implementation already proposed in 
of pcm_dmaengine.c
Another issue i'm facing, is that i have one DMA channel per CPU_DAI 
instance. As simple card imposes to define CPU_DAIs in one platform 
device, i need to define specific DMA name per CPU_DAI.
What is your recommendation on this point:
Do you want that i use snd_dmaengine_pcm_register and propose 
soc_gebneric_dmaengine driver patches?
or simply reuse pcm_dmaengine helper functions as much as possible.

>> +static const struct of_device_id snd_soc_sti_match[] = {
>> +	{ .compatible = "st,sti-audio-platform", },
>> +	{},
>> +};
>
> This doesn't seem to represent actual hardware, it seems to be an
> abstraction layer between dmaengine and your DAI drivers.  This is fine
> and normal but it means the driver shouldn't appear in DT.  Take a look
> at how other drivers like Tegra or the Freescale ones handle this.
>
No sure to full understand your comment...
I checked some Tegra and Freescale drivers,look similar...with 
declaration in DT.
Should i rename file and compatible name associated to DAI name
as example sti_uniperif.c  and .compatible = "st,sti-uniperif"

  reply	other threads:[~2015-05-27  8:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18 12:12 [PATCH v2 0/9] asoc: Add audio for sti platforms Arnaud Pouliquen
2015-05-18 12:12 ` [PATCH v2 1/9] ASoC: sti: add binding for ASoc driver Arnaud Pouliquen
2015-05-22 12:43   ` Mark Brown
2015-05-22 13:24     ` Arnaud Pouliquen
2015-05-25 12:14       ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 2/9] ASoC: sti: Add uniperipheral header file Arnaud Pouliquen
2015-05-18 12:12 ` [PATCH v2 3/9] ASoC: sti: Add CPU DAI driver for playback Arnaud Pouliquen
2015-05-25 12:37   ` Mark Brown
2015-05-26 13:51     ` Arnaud Pouliquen
2015-05-18 12:12 ` [PATCH v2 4/9] ASoC: sti: Add CPU DAI driver for capture Arnaud Pouliquen
2015-05-25 12:39   ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 5/9] ASoC: sti: Add platform driver Arnaud Pouliquen
2015-05-25 12:50   ` Mark Brown
2015-05-27  8:48     ` Arnaud Pouliquen [this message]
2015-05-27 12:06       ` Lars-Peter Clausen
2015-05-18 12:12 ` [PATCH v2 6/9] ASoC: Add ability to build sti drivers Arnaud Pouliquen
2015-05-25 12:50   ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 7/9] ASoC: Codec: Add sti platform codec Arnaud Pouliquen
2015-05-25 13:01   ` Mark Brown
2015-06-01 17:41     ` Arnaud Pouliquen
2015-06-02 19:12       ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 8/9] ASoC: sti: Add clock adjustement control Arnaud Pouliquen
2015-05-25 14:37   ` Mark Brown
2015-05-18 12:12 ` [PATCH v2 9/9] ASoC: sti: Add IEC control Arnaud Pouliquen
2015-05-25 14:36   ` 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=556584C4.3080004@st.com \
    --to=arnaud.pouliquen@st.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@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 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.