Skip to contentSkip to conversation

dma: tegra: set DMA_CYCLIC capability

PATCH In review Laxman Dewangan 3 participants 7 messages Jun 22, 2012 – Jun 27, 2012

Subsystems (3)
lore
Share & tools
lore

Laxman Dewangan

author maintainer
#0 lore raw

PATCH 1/2 dma: tegra: set DMA_CYCLIC capability

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.

---
 drivers/dma/tegra20-apb-dma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/dma/tegra20-apb-dma.c +2 -0
index 134ea7c..b4bd50c 100644
@@ -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;
Signature · 1 line
1.7.1.1
author maintainer
#1 lore raw

PATCH 2/2 dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic mode

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.

---
 drivers/dma/tegra20-apb-dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/tegra20-apb-dma.c +1 -1
index b4bd50c..2e4c187 100644
@@ -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
Signature · 1 line
1.7.1.1
#2 lore raw

Re: [PATCH 2/2] dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic mode

In reply to Laxman Dewangan

drivers/dma/tegra20-apb-dma.c struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( · line 1093

Quoted 10 lines · 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.

drivers/dma/tegra20-apb-dma.c +1 -1
@@ -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.

#4 lore raw
In reply to Laxman Dewangan
Quoted 17 lines · 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.

---
 drivers/dma/tegra20-apb-dma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/dma/tegra20-apb-dma.c +0 -0
index 134ea7c..b4bd50c 100644

drivers/dma/tegra20-apb-dma.c static int __devinit tegra_dma_probe(struct platform_device *pdev) · line 1313

Quoted 8 lines
drivers/dma/tegra20-apb-dma.c +2 -0
@@ -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.

Signature · 1 line
~Vinod
author maintainer
#5 lore raw
Quoted 19 lines · Vinod Koul
Quoted 18 lines · 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.

---
  drivers/dma/tegra20-apb-dma.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
drivers/dma/tegra20-apb-dma.c +0 -0
index 134ea7c..b4bd50c 100644
@@ -1306,6 +1306,8 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
 
Quoted 8 lines

drivers/dma/tegra20-apb-dma.c static int __devinit tegra_dma_probe(struct platform_device *pdev) · line 1313

Quoted 7 lines
drivers/dma/tegra20-apb-dma.c +2 -0
  	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().

Quoted 4 lines

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.

#6 lore raw
Quoted 4 lines · Laxman Dewangan

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

Signature · 1 line
~Vinod