alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>
To: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	joelf-l0cyMroinI0@public.gmane.org,
	vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jyri Sarha <jsarha-l0cyMroinI0@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	mporter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [alsa-devel] [PATCH 14/18] ASoC: davinci: Add edma dmaengine platform driver
Date: Thu, 13 Mar 2014 13:56:56 +0200	[thread overview]
Message-ID: <53219D08.9070308@ti.com> (raw)
In-Reply-To: <53218835.3080909-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>

On 03/13/2014 12:28 PM, Lars-Peter Clausen wrote:
> On 03/13/2014 10:18 AM, Peter Ujfalusi wrote: [...]
>> +static const struct snd_pcm_hardware edma_pcm_hardware = { +    .info
>> = SNDRV_PCM_INFO_MMAP | +                  SNDRV_PCM_INFO_MMAP_VALID | +
>> SNDRV_PCM_INFO_BATCH | +                  SNDRV_PCM_INFO_PAUSE |
>> SNDRV_PCM_INFO_RESUME | +                  SNDRV_PCM_INFO_INTERLEAVED, +
>> .buffer_bytes_max    = 128 * 1024, +    .period_bytes_min    = 32, +
>> .period_bytes_max    = 64 * 1024, +    .periods_min        = 2, +
>> .periods_max        = 19, /* Limit by edma dmaengine driver */ +};
> 
> The idea is that we can auto-discover all the things using the
> dma_slave_caps API. Too bad we removed the possibility to specify the
> maximum number of segments from the API. Maybe we need to add it back. Is
> the 19 a hard-limit or could it be worked around by software in the
> dmaengine driver?

The edma dmaengine driver will refuse to configure more than 20 paRAM slots (1
for the channel + 19 for the periods). Depending on the SoC we might have
different number of paRAM entries available. The intention with the limit was
to prevent cases when we run out of paRAM entires for other devices because
audio took most of them.

>> + +static const struct snd_dmaengine_pcm_config edma_dmaengine_pcm_config
>> = { +    .pcm_hardware = &edma_pcm_hardware, +    .prepare_slave_config =
>> snd_dmaengine_pcm_prepare_slave_config, +    .prealloc_buffer_size = 128
>> * 1024,
> 
> Unless there is a very good reason for exactly this size, just leave it 0
> and let the generic dmaengine driver use the default.

I'd rather keep this here. Since I have the .pcm_hardware the core will ignore
the snd_pcm_hardware.buffer_bytes_max when preallocating and it is in fact
going to go for:
	prealloc_buffer_size = 512 * 1024;
	max_buffer_size = SIZE_MAX;

While I have 128 * 1024 for the snd_pcm_hardware.buffer_bytes_max.

I think as long as I have the .pcm_hardware provided from the edma-pcm driver
I will have the .prealloc_buffer_size as well.

>> +}; + +static const struct snd_dmaengine_pcm_config 
>> edma_compat_dmaengine_pcm_config = { +    .pcm_hardware =
>> &edma_pcm_hardware, +    .prepare_slave_config =
>> snd_dmaengine_pcm_prepare_slave_config, +    .compat_filter_fn =
>> edma_filter_fn, +    .prealloc_buffer_size = 128 * 1024, +};
> 
> There is no need for different configs for DT and non-DT.
> 
>> + +int edma_pcm_platform_register(struct device *dev) +{ +    if
>> (dev->of_node) +        return snd_dmaengine_pcm_register(dev, +
>> &edma_dmaengine_pcm_config, +
>> SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
> 
> Since the edma dmaengine driver implements the slave cap API there is no
> need to manually specify SND_DMAENGINE_PCM_FLAG_NO_RESIDUE manually. But
> since the edma driver sets the granularity to
> DMA_RESIDUE_GRANULARITY_DESCRIPTOR in this case the generic dmaengine will
> not set SND_DMAENGINE_PCM_FLAG_NO_RESIDUE automatically since it assumes
> that the dmaengine driver is capable of properly reporting the DMA
> position.
> 
>> +    else +        return snd_dmaengine_pcm_register(dev, +
>> &edma_compat_dmaengine_pcm_config, +
>> SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | +
>> SND_DMAENGINE_PCM_FLAG_NO_DT | +
>> SND_DMAENGINE_PCM_FLAG_COMPAT);
> 
> 
> If you set the flags to just SND_DMAENGINE_PCM_FLAG_COMPAT it will do the 
> right thing in the generic dmaengine driver depending on whether
> dev->of_node is set or not.

I have missed these in the core. Makes the code simpler for sure.

> There is also a devm_ version of snd_dmaengine_pcm_register() it probably 
> makes sense to use it here.

I forgot about the devm_ version. True, I'll use that instead.

-- 
Péter

  parent reply	other threads:[~2014-03-13 11:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-13  9:18 [PATCH 00/18] edma/ASoC: dmaengine PCM for AM335x and AM447x Peter Ujfalusi
     [not found] ` <1394702320-21743-1-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2014-03-13  9:18   ` [PATCH 01/18] platform_data: edma: Be precise with the paRAM struct Peter Ujfalusi
2014-03-13  9:18   ` [PATCH 02/18] dma: edma: Add support for DMA_PAUSE/RESUME operation Peter Ujfalusi
2014-03-13  9:18   ` [PATCH 03/18] dma: edma: Set DMA_CYCLIC capability flag Peter Ujfalusi
2014-03-13  9:18   ` [PATCH 09/18] dma: edma: Simplify direction configuration in edma_config_pset() Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 04/18] arm: common: edma: Select event queue 1 as default when booted with DT Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 05/18] arm: common: edma: Save the number of event queues/TCs Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 06/18] arm: common: edma: API to request non default queue for a channel Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 07/18] DMA: edma: Use different eventq for cyclic channels Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 08/18] dma: edma: Implement device_slave_caps callback Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 10/18] dma: edma: Reduce debug print verbosity for non verbose debugging Peter Ujfalusi
2014-03-13 12:53   ` Shevchenko, Andriy
     [not found]     ` <1394715211.28803.239.camel-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-03-13 13:37       ` Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 11/18] dma: edma: Prefix debug prints where the text were identical in prep callbacks Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 12/18] dma: edma: Add channel number to debug prints Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 13/18] dma: edma: Print the direction value as well when it is not supported Peter Ujfalusi
2014-03-13 13:03   ` Shevchenko, Andriy
2014-03-13 13:40     ` Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 14/18] ASoC: davinci: Add edma dmaengine platform driver Peter Ujfalusi
2014-03-13 10:28   ` [alsa-devel] " Lars-Peter Clausen
     [not found]     ` <53218835.3080909-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-03-13 11:56       ` Peter Ujfalusi [this message]
2014-03-13 12:09         ` Lars-Peter Clausen
2014-03-13 13:03     ` Peter Ujfalusi
2014-03-13 13:38       ` Lars-Peter Clausen
2014-03-13  9:18 ` [PATCH 15/18] ASoC: davinci-mcasp: Use dmaengine based platform driver for AM335x/447x Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 16/18] ASoC: davinci-mcasp: Provide correct filter_data for dmaengine for non-DT boot Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 17/18] ASoC: davinci-mcasp: Assign the dma_data earlier in dai_probe callback Peter Ujfalusi
2014-03-13  9:18 ` [PATCH 18/18] ASoC: davinci-mcasp: Place constraint on the period size based on FIFO config Peter Ujfalusi
2014-03-13 13:46 ` [PATCH 00/18] edma/ASoC: dmaengine PCM for AM335x and AM447x Mark Brown
2014-03-14  9:38   ` Peter Ujfalusi
2014-03-14 10:13     ` 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=53219D08.9070308@ti.com \
    --to=peter.ujfalusi-l0cymroini0@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
    --cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=joelf-l0cyMroinI0@public.gmane.org \
    --cc=jsarha-l0cyMroinI0@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mporter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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).