All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>, Tony Lindgren <tony@atomide.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Vinod Koul <vinod.koul@intel.com>, Dan Williams <djbw@fb.com>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>,
	alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>,
	Ricardo Neri <ricardo.neri@ti.com>
Subject: Re: [PATCH v2 03/15] dmaengine: Add no_wakeup parameter to dmaengine_prep_dma_cyclic()
Date: Fri, 14 Sep 2012 10:12:25 +0300	[thread overview]
Message-ID: <5052D8D9.8060802@ti.com> (raw)
In-Reply-To: <5051FB4D.3000009@metafoo.de>

Hi,

On 09/13/2012 06:27 PM, Lars-Peter Clausen wrote:
> On 09/13/2012 03:37 PM, Peter Ujfalusi wrote:
>> The dmaengine_prep_dma_cyclic() function primarily used by audio for cyclic
>> transfer required by ALSA.
>> With this new parameter it is going to be possible to enable the
>> SNDRV_PCM_INFO_NO_PERIOD_WAKEUP mode on platforms where it is possible.
>> This patch only changes the public API first. Followup patch will change
>> the device_prep_dma_cyclic() callback parameters to pass this information
>> towards the dma drivers.
>>
> 
> Hi,
> 
> Hm... Do you think it would work as well if we implement this by setting the
> callback for the descriptor to NULL? If the callback is NULL there is
> nothing to at the end of a transfer/period and the dma engine driver may
> choose to disable interrupts. This would also benefit non cyclic transfers
> where the callback is NULL and we do not need add the new parameter to
> dmaengine_prep_dma_cyclic.

We could do that but dma drivers enable the interrupts within
dmaengine_prep_dma_cyclic() call, and we fill up the callback for
dmaengine_submit() dmaengine API call.
We need to tell the dma drivers in dmaengine_prep_dma_cyclic() to suppress the
interrupts.

Note: First I was trying this to be done in hw_params() time via the
dmaengine_slave_config() call, but substream->runtime->no_period_wakeup is not
configured in there. It is set for _prepare() and _trigger().

As Vinod and Russell suggested I will modify the dmaengine_prep_dma_cyclic()
API to pass flags as well instead of the no_wakeup parameter.

> 
> - Lars
> 
>> ---
>>  include/linux/dmaengine.h     | 3 ++-
>>  sound/soc/soc-dmaengine-pcm.c | 3 ++-
>>  2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
>> index 9c02a45..990444b 100644
>> --- a/include/linux/dmaengine.h
>> +++ b/include/linux/dmaengine.h
>> @@ -653,7 +653,8 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
>>  
>>  static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
>>  		struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
>> -		size_t period_len, enum dma_transfer_direction dir)
>> +		size_t period_len, enum dma_transfer_direction dir,
>> +		bool no_wakeup)
>>  {
>>  	return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
>>  						period_len, dir, NULL);
>> diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
>> index 5df529e..6b70adb 100644
>> --- a/sound/soc/soc-dmaengine-pcm.c
>> +++ b/sound/soc/soc-dmaengine-pcm.c
>> @@ -147,7 +147,8 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream)
>>  	desc = dmaengine_prep_dma_cyclic(chan,
>>  		substream->runtime->dma_addr,
>>  		snd_pcm_lib_buffer_bytes(substream),
>> -		snd_pcm_lib_period_bytes(substream), direction);
>> +		snd_pcm_lib_period_bytes(substream), direction,
>> +		substream->runtime->no_period_wakeup);
>>  
>>  	if (!desc)
>>  		return -ENOMEM;
> 


-- 
Péter

WARNING: multiple messages have this Message-ID (diff)
From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 03/15] dmaengine: Add no_wakeup parameter to dmaengine_prep_dma_cyclic()
Date: Fri, 14 Sep 2012 10:12:25 +0300	[thread overview]
Message-ID: <5052D8D9.8060802@ti.com> (raw)
In-Reply-To: <5051FB4D.3000009@metafoo.de>

Hi,

On 09/13/2012 06:27 PM, Lars-Peter Clausen wrote:
> On 09/13/2012 03:37 PM, Peter Ujfalusi wrote:
>> The dmaengine_prep_dma_cyclic() function primarily used by audio for cyclic
>> transfer required by ALSA.
>> With this new parameter it is going to be possible to enable the
>> SNDRV_PCM_INFO_NO_PERIOD_WAKEUP mode on platforms where it is possible.
>> This patch only changes the public API first. Followup patch will change
>> the device_prep_dma_cyclic() callback parameters to pass this information
>> towards the dma drivers.
>>
> 
> Hi,
> 
> Hm... Do you think it would work as well if we implement this by setting the
> callback for the descriptor to NULL? If the callback is NULL there is
> nothing to at the end of a transfer/period and the dma engine driver may
> choose to disable interrupts. This would also benefit non cyclic transfers
> where the callback is NULL and we do not need add the new parameter to
> dmaengine_prep_dma_cyclic.

We could do that but dma drivers enable the interrupts within
dmaengine_prep_dma_cyclic() call, and we fill up the callback for
dmaengine_submit() dmaengine API call.
We need to tell the dma drivers in dmaengine_prep_dma_cyclic() to suppress the
interrupts.

Note: First I was trying this to be done in hw_params() time via the
dmaengine_slave_config() call, but substream->runtime->no_period_wakeup is not
configured in there. It is set for _prepare() and _trigger().

As Vinod and Russell suggested I will modify the dmaengine_prep_dma_cyclic()
API to pass flags as well instead of the no_wakeup parameter.

> 
> - Lars
> 
>> ---
>>  include/linux/dmaengine.h     | 3 ++-
>>  sound/soc/soc-dmaengine-pcm.c | 3 ++-
>>  2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
>> index 9c02a45..990444b 100644
>> --- a/include/linux/dmaengine.h
>> +++ b/include/linux/dmaengine.h
>> @@ -653,7 +653,8 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
>>  
>>  static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
>>  		struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
>> -		size_t period_len, enum dma_transfer_direction dir)
>> +		size_t period_len, enum dma_transfer_direction dir,
>> +		bool no_wakeup)
>>  {
>>  	return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
>>  						period_len, dir, NULL);
>> diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
>> index 5df529e..6b70adb 100644
>> --- a/sound/soc/soc-dmaengine-pcm.c
>> +++ b/sound/soc/soc-dmaengine-pcm.c
>> @@ -147,7 +147,8 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream)
>>  	desc = dmaengine_prep_dma_cyclic(chan,
>>  		substream->runtime->dma_addr,
>>  		snd_pcm_lib_buffer_bytes(substream),
>> -		snd_pcm_lib_period_bytes(substream), direction);
>> +		snd_pcm_lib_period_bytes(substream), direction,
>> +		substream->runtime->no_period_wakeup);
>>  
>>  	if (!desc)
>>  		return -ENOMEM;
> 


-- 
P?ter

  parent reply	other threads:[~2012-09-14  7:12 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13 13:37 [PATCH v2 00/15] ASoC: OMAP: Convert to use dmaengine Peter Ujfalusi
2012-09-13 13:37 ` Peter Ujfalusi
2012-09-13 13:37 ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 01/15] dmaengine: omap: Support for element mode in cyclic DMA Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 02/15] dmaengine: omap: Add support for pause/resume in cyclic dma mode Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 03/15] dmaengine: Add no_wakeup parameter to dmaengine_prep_dma_cyclic() Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 15:27   ` Lars-Peter Clausen
2012-09-13 15:27     ` Lars-Peter Clausen
2012-09-13 15:27     ` Lars-Peter Clausen
2012-09-13 15:38     ` Russell King - ARM Linux
2012-09-13 15:38       ` Russell King - ARM Linux
2012-09-14  3:27       ` Vinod Koul
2012-09-14  3:27         ` Vinod Koul
2012-09-14  3:27         ` Vinod Koul
2012-09-14  7:15       ` Peter Ujfalusi
2012-09-14  7:15         ` Peter Ujfalusi
2012-09-14  7:15         ` Peter Ujfalusi
2012-09-14  3:26     ` Vinod Koul
2012-09-14  3:26       ` Vinod Koul
2012-09-14  3:26       ` Vinod Koul
2012-09-14  7:18       ` Peter Ujfalusi
2012-09-14  7:18         ` [alsa-devel] " Peter Ujfalusi
2012-09-14  7:18         ` Peter Ujfalusi
2012-09-14  8:13       ` Lars-Peter Clausen
2012-09-14  8:13         ` Lars-Peter Clausen
2012-09-14  8:13         ` Lars-Peter Clausen
2012-09-14  8:50         ` Vinod Koul
2012-09-14  8:50           ` Vinod Koul
2012-09-14  8:50           ` Vinod Koul
2012-09-14  9:28           ` Peter Ujfalusi
2012-09-14  9:28             ` Peter Ujfalusi
2012-09-14  9:28             ` Peter Ujfalusi
2012-09-14  9:38             ` Vinod Koul
2012-09-14  9:38               ` Vinod Koul
2012-09-14  9:38               ` Vinod Koul
2012-09-14 10:01             ` Russell King - ARM Linux
2012-09-14 10:01               ` Russell King - ARM Linux
2012-09-14  7:12     ` Peter Ujfalusi [this message]
2012-09-14  7:12       ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 04/15] dmaengine: Pass no_wakeup parameter via device_prep_dma_cyclic() callback Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-14  3:24   ` Vinod Koul
2012-09-14  3:24     ` Vinod Koul
2012-09-14  3:24     ` Vinod Koul
2012-09-14  7:07     ` Peter Ujfalusi
2012-09-14  7:07       ` Peter Ujfalusi
2012-09-14  7:07       ` Peter Ujfalusi
2012-09-17  6:34   ` Shawn Guo
2012-09-17  6:34     ` Shawn Guo
2012-09-17  6:34     ` Shawn Guo
2012-09-17  7:16     ` Peter Ujfalusi
2012-09-17  7:16       ` Peter Ujfalusi
2012-09-17  7:16       ` Peter Ujfalusi
2012-09-17  7:23       ` Shawn Guo
2012-09-17  7:23         ` Shawn Guo
2012-09-17  9:01   ` Linus Walleij
2012-09-17  9:01     ` Linus Walleij
2012-09-17  9:01     ` Linus Walleij
2012-09-18  8:31     ` Russell King - ARM Linux
2012-09-18  8:31       ` Russell King - ARM Linux
2012-09-18  8:31       ` Russell King - ARM Linux
2012-09-18  9:00       ` Vinod Koul
2012-09-18  9:00         ` Vinod Koul
2012-09-18  9:00         ` Vinod Koul
2012-09-18 12:22         ` Linus Walleij
2012-09-18 12:22           ` Linus Walleij
2012-09-18 12:22           ` Linus Walleij
2012-09-13 13:37 ` [PATCH v2 05/15] dmaengine: omap-dma: Add support for no_wakeup in cyclic mode Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 06/15] ASoC: omap-mcbsp: Use sDMA packet mode instead of frame mode Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 07/15] ASoC: omap-pcm: Select sDMA synchronization based on packet_size Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 08/15] ASoC: OMAP: Remove sync_mode from omap_pcm_dma_data struct Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 09/15] ASoC: omap-pcm: Prepare to configure the DMA data_type based on stream properties Peter Ujfalusi
2012-09-13 13:37   ` Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 10/15] ARM: OMAP4: hwmod_data: Add resource names to McPDM memory ranges Peter Ujfalusi
2012-09-13 13:38   ` Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 11/15] ASoC: omap-mcpdm: Use platform_get_resource_* to get resources Peter Ujfalusi
2012-09-13 13:38   ` Peter Ujfalusi
2012-09-13 13:38   ` Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 12/15] ASoC: OMAP: mcbsp, mcpdm, dmic: Let omap-pcm to pick the dma_type Peter Ujfalusi
2012-09-13 13:38   ` Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 13/15] ASoC: omap-pcm, omap-dmic: Change the use of omap_pcm_dma_data->data_type Peter Ujfalusi
2012-09-13 13:38   ` Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 14/15] ASoC: OMAP: mcbsp, mcpdm, dmic, hdmi: Set dma_data at startup time Peter Ujfalusi
2012-09-13 13:38   ` Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 15/15] ASoC: omap-pcm: Convert to use dmaengine Peter Ujfalusi
2012-09-13 13:38   ` Peter Ujfalusi

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=5052D8D9.8060802@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=djbw@fb.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=jkrzyszt@tis.icnet.pl \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=ricardo.neri@ti.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=tony@atomide.com \
    --cc=vinod.koul@intel.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.