Skip to contentSkip to conversation

dma: tegra: implement flags parameters for cyclic transfer

PATCH Superseded Laxman Dewangan 2 participants 7 messages Dec 19, 2012 – Jan 7, 2013

Subsystems (3)
lore
Share & tools
lore

Laxman Dewangan

author maintainer
#0 lore raw

PATCH 1/1 dma: tegra: implement flags parameters for cyclic transfer

The flag parameter is added in the cyclic transfer request. Use the flag option of:
- DMA_PREP_INTERRUPT for enabling interrupt.
- DMA_CTRL_ACK for deciding whether ack is requred or not for descriptor.

---
 drivers/dma/tegra20-apb-dma.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/dma/tegra20-apb-dma.c +6 -2
index efdfffa..bf58bb8 100644
@@ -266,6 +266,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get(
 		if (async_tx_test_ack(&dma_desc->txd)) {
 			list_del(&dma_desc->node);
 			spin_unlock_irqrestore(&tdc->lock, flags);
+			dma_desc->txd.flags = 0;
 			return dma_desc;
 		}
 	}
@@ -1050,7 +1051,9 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
 					TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT;
 	ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32;
 
-	csr |= TEGRA_APBDMA_CSR_FLOW | TEGRA_APBDMA_CSR_IE_EOC;
+	csr |= TEGRA_APBDMA_CSR_FLOW;
+	if (flags & DMA_PREP_INTERRUPT)
+		csr |= TEGRA_APBDMA_CSR_IE_EOC;
 	csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
 
 	apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
@@ -1095,7 +1098,8 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
 		mem += len;
 	}
 	sg_req->last_sg = true;
-	dma_desc->txd.flags = 0;
+	if (flags & DMA_CTRL_ACK)
+		dma_desc->txd.flags = DMA_CTRL_ACK;
 
 	/*
 	 * Make sure that mode should not be conflicting with currently
Signature · 1 line
1.7.1.1
#1 lore raw
Quoted 5 lines · Laxman Dewangan

The flag parameter is added in the cyclic transfer request. Use the flag option of:
- DMA_PREP_INTERRUPT for enabling interrupt.
- DMA_CTRL_ACK for deciding whether ack is requred or not for descriptor.

Do the relevant drivers that use Tegra's DMA engine already set flags correctly, so that this change won't cause any regressions?

Why would you not want to enable interrupts; how does a client know when to refill the buffer?

author maintainer
#2 lore raw
Quoted 9 lines · Stephen Warren
Quoted 5 lines · Laxman Dewangan

The flag parameter is added in the cyclic transfer request. Use the flag option of:
- DMA_PREP_INTERRUPT for enabling interrupt.
- DMA_CTRL_ACK for deciding whether ack is requred or not for descriptor.

Do the relevant drivers that use Tegra's DMA engine already set flags correctly, so that this change won't cause any regressions?

Currently, the sound soc driver uses the cyclic mode of dma transfer and it has already enable the proper flags. This was done recently after adding flags in cyclic api. Also, there was bug in our dma driver for not setting DMA_CTRL_ACK by default for cyclic case.
This will fix the issue.

Quoted 2 lines

Why would you not want to enable interrupts; how does a client know when to refill the buffer?

This came recently from the cyclic api after adding flags that client can pass proper flag to enable inetrrupt or not. Changes from Peter:
/*
commit ec8b5e48c03790a68cb875fe5064007a9cbdfdd0

Author: Peter Ujfalusi <[email protected]>
Date:   Fri Sep 14 15:05:47 2012 +0300

dmaengine: Pass flags via device_prep_dma_cyclic() callback

Change the parameter list of device_prep_dma_cyclic() so the DMA
drivers
can receive the flags coming from clients.
This feature can be used during audio operation to disable all audio related interrupts when the DMA_PREP_INTERRUPT is cleared from the
flags.
*/

#3 lore raw
Quoted 11 lines · Laxman Dewangan
Quoted 9 lines · Stephen Warren
Quoted 5 lines · Laxman Dewangan

The flag parameter is added in the cyclic transfer request. Use the flag option of:
- DMA_PREP_INTERRUPT for enabling interrupt.
- DMA_CTRL_ACK for deciding whether ack is requred or not for descriptor.

Do the relevant drivers that use Tegra's DMA engine already set flags correctly, so that this change won't cause any regressions?

Quoted 6 lines

Currently, the sound soc driver uses the cyclic mode of dma transfer and it has already enable the proper flags. This was done recently after adding flags in cyclic api.
Also, there was bug in our dma driver for not setting DMA_CTRL_ACK by default for cyclic case.
This will fix the issue.

OK. I assume "This was done recently after adding flags in cyclic api." was a patch that went into 3.8? So, this patch is a bug-fix that should be included in 3.8 then?

author maintainer
#4 lore raw
Quoted 17 lines · Stephen Warren
Quoted 10 lines · Laxman Dewangan
Quoted 9 lines · Stephen Warren
Quoted 5 lines · Laxman Dewangan

The flag parameter is added in the cyclic transfer request. Use the flag option of:
- DMA_PREP_INTERRUPT for enabling interrupt.
- DMA_CTRL_ACK for deciding whether ack is requred or not for descriptor.

Do the relevant drivers that use Tegra's DMA engine already set flags correctly, so that this change won't cause any regressions?

Quoted 6 lines

Currently, the sound soc driver uses the cyclic mode of dma transfer and it has already enable the proper flags. This was done recently after adding flags in cyclic api.
Also, there was bug in our dma driver for not setting DMA_CTRL_ACK by default for cyclic case.
This will fix the issue.

Quoted 3 lines

OK. I assume "This was done recently after adding flags in cyclic api." was a patch that went into 3.8? So, this patch is a bug-fix that should be included in 3.8 then?

I can see this in Linux 3.7 tag.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=history;f=drivers/dma/tegra20-apb-dma.c;h=528c62dd4b00e1b52928ff66f3a54e7ae206680f;hb=29594404d7fe73cd80eaa4ee8c43dcc53970c60e

#5 lore raw
Quoted 19 lines · Laxman Dewangan
Quoted 18 lines · Stephen Warren
Quoted 16 lines · Laxman Dewangan
Quoted 8 lines · Stephen Warren
Quoted 5 lines · Laxman Dewangan

The flag parameter is added in the cyclic transfer request. Use the flag option of:
- DMA_PREP_INTERRUPT for enabling interrupt.
- DMA_CTRL_ACK for deciding whether ack is requred or not for descriptor.

Do the relevant drivers that use Tegra's DMA engine already set flags correctly, so that this change won't cause any regressions?

Currently, the sound soc driver uses the cyclic mode of dma transfer and it has already enable the proper flags. This was done recently after adding flags in cyclic api.
Also, there was bug in our dma driver for not setting DMA_CTRL_ACK by default for cyclic case.
This will fix the issue.

Quoted 5 lines
Quoted 3 lines

OK. I assume "This was done recently after adding flags in cyclic api." was a patch that went into 3.8? So, this patch is a bug-fix that should be included in 3.8 then?

I can see this in Linux 3.7 tag.

So I assume that means that when Vinod applies *this* patch, it should be Cc: stable for 3.7 and up?

Quoted 1 line

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=history;f=drivers/dma/tegra20-apb-dma.c;h=528c62dd4b00e1b52928ff66f3a54e7ae206680f;hb=29594404d7fe73cd80eaa4ee8c43dcc53970c60e

I don't think that points where you want; it just shows a log of 3.7 for me.

author maintainer
#6 lore raw
Quoted 21 lines · Stephen Warren
Quoted 20 lines · Laxman Dewangan
Quoted 19 lines · Stephen Warren
Quoted 7 lines · Laxman Dewangan
Quoted 6 lines · Stephen Warren
Quoted 5 lines · Laxman Dewangan

The flag parameter is added in the cyclic transfer request. Use the flag option of:
- DMA_PREP_INTERRUPT for enabling interrupt.
- DMA_CTRL_ACK for deciding whether ack is requred or not for descriptor.

Quoted 8 lines
Quoted 2 lines

Do the relevant drivers that use Tegra's DMA engine already set flags correctly, so that this change won't cause any regressions?

Currently, the sound soc driver uses the cyclic mode of dma transfer and it has already enable the proper flags. This was done recently after adding flags in cyclic api.
Also, there was bug in our dma driver for not setting DMA_CTRL_ACK by default for cyclic case.
This will fix the issue.

OK. I assume "This was done recently after adding flags in cyclic api." was a patch that went into 3.8? So, this patch is a bug-fix that should be included in 3.8 then?

Quoted 6 lines
Quoted 1 line

I can see this in Linux 3.7 tag.

So I assume that means that when Vinod applies *this* patch, it should be Cc: stable for 3.7 and up?

Quoted 1 line

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=history;f=drivers/dma/tegra20-apb-dma.c;h=528c62dd4b00e1b52928ff66f3a54e7ae206680f;hb=29594404d7fe73cd80eaa4ee8c43dcc53970c60e

I don't think that points where you want; it just shows a log of 3.7 for me.

Oops, I just wanted to say that 3.7 branch and history of drivers/dma/tegra20-apb-dma.c shows the above change of inclusion of flags. Seems link is messed up.