Skip to contentSkip to conversation

dma: Add a PAUSE_RESUME capability

PATCH In review Lars-Peter Clausen 4 participants 5 messages May 29, 2013 – Jun 1, 2013 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dma: Add a PAUSE_RESUME capability

Add a capability which allows dmaengine consumers to query whether a dmaengine controller supports the DMA_PAUSE and DMA_RESUME commands. Sometimes a user of the dmaengine API needs to know in advance if a channel will support pause/resume. E.g. in ALSA the information whether it is possible to pause/resume a audio stream or whether it is necessary to abort and restart the stream is communicated to userspace so it can act accordingly.

---
 include/linux/dmaengine.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/dmaengine.h +1 -0
index 96d3e4a..ad98dfb 100644
@@ -74,6 +74,7 @@ enum dma_transaction_type {
 	DMA_SLAVE,
 	DMA_CYCLIC,
 	DMA_INTERLEAVE,
+	DMA_PAUSE_RESUME,
 /* last transaction type for creation of the capabilities mask */
 	DMA_TX_TYPE_END,
 };
Signature · 1 line
1.8.0

A message that is not in the archive (sent off-list or not yet received): 1369827743-5533-1-git-send-email-lars-Qo5EllUWu/[email protected]

#2 lore raw

PATCH 2/2 dma: Set PAUSE_RESUME capability for drivers which support it

Set the newly introduced PAUSE_RESUME capability for driver which support pausing/resuming the DMA stream.

---
 drivers/dma/amba-pl08x.c    | 1 +
 drivers/dma/at_hdmac.c      | 1 +
 drivers/dma/coh901318.c     | 1 +
 drivers/dma/dw_dmac.c       | 1 +
 drivers/dma/ipu/ipu_idmac.c | 1 +
 drivers/dma/mmp_tdma.c      | 1 +
 drivers/dma/mxs-dma.c       | 1 +
 drivers/dma/omap-dma.c      | 1 +
 drivers/dma/sa11x0-dma.c    | 1 +
 drivers/dma/sirf-dma.c      | 1 +
 drivers/dma/ste_dma40.c     | 1 +
 11 files changed, 11 insertions(+)
drivers/dma/amba-pl08x.c +1 -0
index 8bad254..fa25199 100644
@@ -1873,6 +1873,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 
 	/* Initialize slave engine */
 	dma_cap_set(DMA_SLAVE, pl08x->slave.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, pl08x->slave.cap_mask);
 	pl08x->slave.dev = &adev->dev;
 	pl08x->slave.device_alloc_chan_resources = pl08x_alloc_chan_resources;
 	pl08x->slave.device_free_chan_resources = pl08x_free_chan_resources;
drivers/dma/at_hdmac.c +1 -0
index 5ce8936..d7a44a8 100644
@@ -1431,6 +1431,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
 	dma_cap_set(DMA_MEMCPY, at91sam9rl_config.cap_mask);
 	dma_cap_set(DMA_MEMCPY, at91sam9g45_config.cap_mask);
 	dma_cap_set(DMA_SLAVE, at91sam9g45_config.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, at91sam9g45_config.cap_mask);
 
 	/* get DMA parameters from controller type */
 	plat_dat = at_dma_get_driver_data(pdev);
drivers/dma/coh901318.c +1 -0
index 3b23061..95ef299 100644
@@ -2697,6 +2697,7 @@ static int __init coh901318_probe(struct platform_device *pdev)
 
 	dma_cap_zero(base->dma_slave.cap_mask);
 	dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, base->dma_slave.cap_mask);
 
 	base->dma_slave.device_alloc_chan_resources = coh901318_alloc_chan_resources;
 	base->dma_slave.device_free_chan_resources = coh901318_free_chan_resources;
drivers/dma/dw_dmac.c +1 -0
index 2e5deaa..23d5ea5f 100644
@@ -1832,6 +1832,7 @@ static int dw_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_MEMCPY, dw->dma.cap_mask);
 	dma_cap_set(DMA_SLAVE, dw->dma.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, dw->dma.cap_mask);
 	if (pdata->is_private)
 		dma_cap_set(DMA_PRIVATE, dw->dma.cap_mask);
 	dw->dma.dev = &pdev->dev;
drivers/dma/ipu/ipu_idmac.c +1 -0
index d39c2cd..5a4eabb 100644
@@ -1607,6 +1607,7 @@ static int __init ipu_idmac_init(struct ipu *ipu)
 
 	dma_cap_set(DMA_SLAVE, dma->cap_mask);
 	dma_cap_set(DMA_PRIVATE, dma->cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, dma->cap_mask);
 
 	/* Compulsory common fields */
 	dma->dev				= ipu->dev;
drivers/dma/mmp_tdma.c +1 -0
index 43d5a6c..a296aee 100644
@@ -572,6 +572,7 @@ static int mmp_tdma_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_SLAVE, tdev->device.cap_mask);
 	dma_cap_set(DMA_CYCLIC, tdev->device.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, tdev->device.cap_mask);
 	tdev->device.dev = &pdev->dev;
 	tdev->device.device_alloc_chan_resources =
 					mmp_tdma_alloc_chan_resources;
drivers/dma/mxs-dma.c +1 -0
index 7195930..19fe380 100644
@@ -753,6 +753,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_SLAVE, mxs_dma->dma_device.cap_mask);
 	dma_cap_set(DMA_CYCLIC, mxs_dma->dma_device.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, mxs_dma->dma_device.cap_mask);
 
 	INIT_LIST_HEAD(&mxs_dma->dma_device.channels);
 
drivers/dma/omap-dma.c +1 -0
index ec3fc4f..fe8643b 100644
@@ -608,6 +608,7 @@ static int omap_dma_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_SLAVE, od->ddev.cap_mask);
 	dma_cap_set(DMA_CYCLIC, od->ddev.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, od->ddev.cap_mask);
 	od->ddev.device_alloc_chan_resources = omap_dma_alloc_chan_resources;
 	od->ddev.device_free_chan_resources = omap_dma_free_chan_resources;
 	od->ddev.device_tx_status = omap_dma_tx_status;
drivers/dma/sa11x0-dma.c +1 -0
index 461a91a..81eefb3 100644
@@ -942,6 +942,7 @@ static int sa11x0_dma_probe(struct platform_device *pdev)
 
 	dma_cap_set(DMA_SLAVE, d->slave.cap_mask);
 	dma_cap_set(DMA_CYCLIC, d->slave.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, d->slave.cap_mask);
 	d->slave.device_prep_slave_sg = sa11x0_dma_prep_slave_sg;
 	d->slave.device_prep_dma_cyclic = sa11x0_dma_prep_dma_cyclic;
 	ret = sa11x0_dma_init_dmadev(&d->slave, &pdev->dev);
drivers/dma/sirf-dma.c +1 -0
index 1765a0a..163e8e5 100644
@@ -687,6 +687,7 @@ static int sirfsoc_dma_probe(struct platform_device *op)
 	dma_cap_set(DMA_CYCLIC, dma->cap_mask);
 	dma_cap_set(DMA_INTERLEAVE, dma->cap_mask);
 	dma_cap_set(DMA_PRIVATE, dma->cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, dma->cap_mask);
 
 	for (i = 0; i < dma->chancnt; i++) {
 		schan = &sdma->channels[i];
drivers/dma/ste_dma40.c +1 -0
index 71bf4ec..c1dc544 100644
@@ -2918,6 +2918,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
 	dma_cap_zero(base->dma_slave.cap_mask);
 	dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask);
 	dma_cap_set(DMA_CYCLIC, base->dma_slave.cap_mask);
+	dma_cap_set(DMA_PAUSE_RESUME, base->dma_slave.cap_mask);
 
 	d40_ops_init(base, &base->dma_slave);
 
Signature · 1 line
1.8.0
#3 lore raw
In reply to Lars-Peter Clausen
Quoted 6 lines · Lars-Peter Clausen

Add a capability which allows dmaengine consumers to query whether a dmaengine controller supports the DMA_PAUSE and DMA_RESUME commands. Sometimes a user of the dmaengine API needs to know in advance if a channel will support pause/resume. E.g. in ALSA the information whether it is possible to pause/resume a audio stream or whether it is necessary to abort and restart the stream is communicated to userspace so it can act accordingly.

- This mail-list is not correct for this patch
- use get_maintainer.pl, if you dont know but you already know!
- always CC maintainers

the enum dma_transaction_type reports what kind of transactions DMA controller is capable of. This is not for capabilities of a given transaction type, so this approach is not right.

Unfortunately, this is not supported by dmaengine atm. We had discussed this in last plumbers, and discussion with Matt was to add capability API (at least for slave usages). The work from Matt had reached a good point but unfortunately didn't reach its conclusion. [1]

Let me resurrect those patches and add the pause, resume query to it in more generic way

--
~Vinod

[1]: https://patchwork.kernel.org/patch/2094891/

#4 lore raw
Quoted 10 lines · Vinod Koul
Quoted 6 lines · Lars-Peter Clausen

Add a capability which allows dmaengine consumers to query whether a dmaengine controller supports the DMA_PAUSE and DMA_RESUME commands. Sometimes a user of the dmaengine API needs to know in advance if a channel will support pause/resume. E.g. in ALSA the information whether it is possible to pause/resume a audio stream or whether it is necessary to abort and restart the stream is communicated to userspace so it can act accordingly.

- This mail-list is not correct for this patch
- use get_maintainer.pl, if you dont know but you already know!
- always CC maintainers

Hm, I have no idea what happened with the Cc list. I might have hit the up key one time to many after --dry-run, since this is the Cc list of a different patch series.

Quoted 4 lines

the enum dma_transaction_type reports what kind of transactions DMA controller is capable of. This is not for capabilities of a given transaction type, so this approach is not right.

hm, ok.

Quoted 8 lines

Unfortunately, this is not supported by dmaengine atm. We had discussed this in last plumbers, and discussion with Matt was to add capability API (at least for slave usages). The work from Matt had reached a good point but unfortunately didn't reach its conclusion. [1]

Let me resurrect those patches and add the pause, resume query to it in more generic way

I've pinged Matt about these patches yesterday or so. He has been rather quite lately, maybe he's been sucked into the Linaro blackhole.

- Lars

#5 lore raw
In reply to Vinod Koul
Quoted 2 lines · Vinod Koul

- This mail-list is not correct for this patch
- use get_maintainer.pl, if you dont know but you already know!

These two bits of advice unfortunately conflict with each other a bit if one of the lists involved is lkml - since lkml isn't listed in MAINTAINERS and is always added implicitly get_maintainers won't tell you if it is actually a list you should be using as opposed to just something that it shoves on the end of the list of addreses (which most of the time means it's not actually sensible to send there).