linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability
@ 2012-06-22 11:42 Laxman Dewangan
       [not found] ` <1340365364-16276-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Laxman Dewangan @ 2012-06-22 11:42 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams; +Cc: linux-kernel, linux-tegra, Laxman Dewangan

Tegra's APB DMA driver support the cyclic mode of data
transfer and hence setting the DMA_CYCLIC caps for dma
channels.

This is require when generic sound dmaengine pcm driver
request for dma channel with CYCLIC capability.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/dma/tegra20-apb-dma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 134ea7c..b4bd50c 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1306,6 +1306,8 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
 	dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
+	dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask);
+
 	tdma->dma_dev.dev = &pdev->dev;
 	tdma->dma_dev.device_alloc_chan_resources =
 					tegra_dma_alloc_chan_resources;
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic mode
       [not found] ` <1340365364-16276-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-06-22 11:42   ` Laxman Dewangan
       [not found]     ` <1340365364-16276-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2012-06-22 17:09   ` [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability Stephen Warren
  2012-06-27 13:29   ` Vinod Koul
  2 siblings, 1 reply; 7+ messages in thread
From: Laxman Dewangan @ 2012-06-22 11:42 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Laxman Dewangan

The sound dmaengine pcm driver uses the dma in cyclic mode and
it does not ack the transfer descriptor  after transfer stops.
This may lead to hold that desc in chip's dma driver and does
not allow to reuse/free that descriptors. Hence not enabling
flag DMA_CTRL_ACK when dma runs in cyclic mode.

Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/dma/tegra20-apb-dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index b4bd50c..2e4c187 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1093,7 +1093,7 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
 		mem += len;
 	}
 	sg_req->last_sg = true;
-	dma_desc->txd.flags = DMA_CTRL_ACK;
+	dma_desc->txd.flags = 0;
 
 	/*
 	 * Make sure that mode should not be conflicting with currently
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability
       [not found] ` <1340365364-16276-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2012-06-22 11:42   ` [PATCH 2/2] dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic mode Laxman Dewangan
@ 2012-06-22 17:09   ` Stephen Warren
  2012-06-27 13:29   ` Vinod Koul
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2012-06-22 17:09 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On 06/22/2012 05:42 AM, Laxman Dewangan wrote:
> Tegra's APB DMA driver support the cyclic mode of data
> transfer and hence setting the DMA_CYCLIC caps for dma
> channels.
> 
> This is require when generic sound dmaengine pcm driver
> request for dma channel with CYCLIC capability.
> 
> Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic mode
       [not found]     ` <1340365364-16276-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-06-22 17:10       ` Stephen Warren
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2012-06-22 17:10 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On 06/22/2012 05:42 AM, Laxman Dewangan wrote:
> The sound dmaengine pcm driver uses the dma in cyclic mode and
> it does not ack the transfer descriptor  after transfer stops.
> This may lead to hold that desc in chip's dma driver and does
> not allow to reuse/free that descriptors. Hence not enabling
> flag DMA_CTRL_ACK when dma runs in cyclic mode.

> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> @@ -1093,7 +1093,7 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
> -	dma_desc->txd.flags = DMA_CTRL_ACK;
> +	dma_desc->txd.flags = 0;

I honestly have no idea about this one. If the dmaengine maintainers
think it's semantically correct, I have no objections.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability
       [not found] ` <1340365364-16276-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2012-06-22 11:42   ` [PATCH 2/2] dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic mode Laxman Dewangan
  2012-06-22 17:09   ` [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability Stephen Warren
@ 2012-06-27 13:29   ` Vinod Koul
  2012-06-27 13:42     ` Laxman Dewangan
  2 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2012-06-27 13:29 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Fri, 2012-06-22 at 17:12 +0530, Laxman Dewangan wrote:
> Tegra's APB DMA driver support the cyclic mode of data
> transfer and hence setting the DMA_CYCLIC caps for dma
> channels.
> 
> This is require when generic sound dmaengine pcm driver
> request for dma channel with CYCLIC capability.
> 
> Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/dma/tegra20-apb-dma.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> index 134ea7c..b4bd50c 100644
> --- a/drivers/dma/tegra20-apb-dma.c
> +++ b/drivers/dma/tegra20-apb-dma.c
> @@ -1306,6 +1306,8 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
>  
>  	dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
>  	dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
> +	dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask);
> +
>  	tdma->dma_dev.dev = &pdev->dev;
>  	tdma->dma_dev.device_alloc_chan_resources =
>  					tegra_dma_alloc_chan_resources;
What sort of testing went into this.
I can see that you are marking descriptor complete even for cyclic case,
that is wrong you should fix that as well. See the other drivers for
cyclic handling of descriptors.

-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability
  2012-06-27 13:29   ` Vinod Koul
@ 2012-06-27 13:42     ` Laxman Dewangan
       [not found]       ` <4FEB0DB6.7040105-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Laxman Dewangan @ 2012-06-27 13:42 UTC (permalink / raw)
  To: Vinod Koul
  Cc: dan.j.williams@intel.com, linux-kernel@vger.kernel.org,
	linux-tegra@vger.kernel.org

On Wednesday 27 June 2012 06:59 PM, Vinod Koul wrote:
> On Fri, 2012-06-22 at 17:12 +0530, Laxman Dewangan wrote:
>> Tegra's APB DMA driver support the cyclic mode of data
>> transfer and hence setting the DMA_CYCLIC caps for dma
>> channels.
>>
>> This is require when generic sound dmaengine pcm driver
>> request for dma channel with CYCLIC capability.
>>
>> Signed-off-by: Laxman Dewangan<ldewangan@nvidia.com>
>> ---
>>   drivers/dma/tegra20-apb-dma.c |    2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
>> index 134ea7c..b4bd50c 100644
>> --- a/drivers/dma/tegra20-apb-dma.c
>> +++ b/drivers/dma/tegra20-apb-dma.c
>> @@ -1306,6 +1306,8 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
>>
>>   	dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
>>   	dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
>> +	dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask);
>> +
>>   	tdma->dma_dev.dev =&pdev->dev;
>>   	tdma->dma_dev.device_alloc_chan_resources =
>>   					tegra_dma_alloc_chan_resources;
> What sort of testing went into this.

I used the function snd_dmaengine_pcm_open() in 
sound/soc/soc-dmaengine-pcm.c.
This fails because dmaengine_pcm_request_channel() require caps of 
DMA_CYCLIC
which is called by snd_dmaengine_pcm_open().


> I can see that you are marking descriptor complete even for cyclic case,
> that is wrong you should fix that as well. See the other drivers for
> cyclic handling of descriptors.
>

Not really,
I called dma_cookie_complete() only from the isr handle_once_dma_done() 
which is only called if it is non-cyclic mode.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability
       [not found]       ` <4FEB0DB6.7040105-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-06-27 13:49         ` Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2012-06-27 13:49 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Wed, 2012-06-27 at 19:12 +0530, Laxman Dewangan wrote:
> Not really,
> I called dma_cookie_complete() only from the isr
> handle_once_dma_done() 
> which is only called if it is non-cyclic mode.
Ah got it my bad.

Applied now, Thanks 
-- 
~Vinod

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-27 13:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-22 11:42 [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability Laxman Dewangan
     [not found] ` <1340365364-16276-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-22 11:42   ` [PATCH 2/2] dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic mode Laxman Dewangan
     [not found]     ` <1340365364-16276-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-22 17:10       ` Stephen Warren
2012-06-22 17:09   ` [PATCH 1/2] dma: tegra: set DMA_CYCLIC capability Stephen Warren
2012-06-27 13:29   ` Vinod Koul
2012-06-27 13:42     ` Laxman Dewangan
     [not found]       ` <4FEB0DB6.7040105-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-27 13:49         ` Vinod Koul

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).