Commit 058276303dbc4ed089c1f7dad0871810b1f5ddf1

Authored by Linus Walleij
Committed by Dan Williams
1 parent 4aed79b281

DMAENGINE: extend the control command to include an arg

This adds an argument to the DMAengine control function, so that
we can later provide control commands that need some external data
passed in through an argument akin to the ioctl() operation
prototype.

[dan.j.williams@intel.com: fix up some missed conversions]
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Showing 14 changed files with 32 additions and 21 deletions Side-by-side Diff

drivers/dma/at_hdmac.c
... ... @@ -759,7 +759,8 @@
759 759 return NULL;
760 760 }
761 761  
762   -static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  762 +static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  763 + unsigned long arg)
763 764 {
764 765 struct at_dma_chan *atchan = to_at_dma_chan(chan);
765 766 struct at_dma *atdma = to_at_dma(chan->device);
drivers/dma/coh901318.c
... ... @@ -942,7 +942,7 @@
942 942  
943 943 spin_unlock_irqrestore(&cohc->lock, flags);
944 944  
945   - chan->device->device_control(chan, DMA_TERMINATE_ALL);
  945 + chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
946 946 }
947 947  
948 948  
... ... @@ -1176,7 +1176,8 @@
1176 1176 }
1177 1177  
1178 1178 static int
1179   -coh901318_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  1179 +coh901318_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  1180 + unsigned long arg)
1180 1181 {
1181 1182 unsigned long flags;
1182 1183 struct coh901318_chan *cohc = to_coh901318_chan(chan);
drivers/dma/dw_dmac.c
... ... @@ -781,7 +781,8 @@
781 781 return NULL;
782 782 }
783 783  
784   -static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  784 +static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  785 + unsigned long arg)
785 786 {
786 787 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
787 788 struct dw_dma *dw = to_dw_dma(chan->device);
drivers/dma/fsldma.c
... ... @@ -775,7 +775,7 @@
775 775 }
776 776  
777 777 static int fsl_dma_device_control(struct dma_chan *dchan,
778   - enum dma_ctrl_cmd cmd)
  778 + enum dma_ctrl_cmd cmd, unsigned long arg)
779 779 {
780 780 struct fsldma_chan *chan;
781 781 unsigned long flags;
drivers/dma/ipu/ipu_idmac.c
... ... @@ -1472,7 +1472,8 @@
1472 1472 */
1473 1473 }
1474 1474  
1475   -static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  1475 +static int __idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  1476 + unsigned long arg)
1476 1477 {
1477 1478 struct idmac_channel *ichan = to_idmac_chan(chan);
1478 1479 struct idmac *idmac = to_idmac(chan->device);
1479 1480  
... ... @@ -1513,14 +1514,15 @@
1513 1514 return 0;
1514 1515 }
1515 1516  
1516   -static int idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  1517 +static int idmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  1518 + unsigned long arg)
1517 1519 {
1518 1520 struct idmac_channel *ichan = to_idmac_chan(chan);
1519 1521 int ret;
1520 1522  
1521 1523 mutex_lock(&ichan->chan_mutex);
1522 1524  
1523   - ret = __idmac_control(chan, cmd);
  1525 + ret = __idmac_control(chan, cmd, arg);
1524 1526  
1525 1527 mutex_unlock(&ichan->chan_mutex);
1526 1528  
... ... @@ -1616,7 +1618,7 @@
1616 1618  
1617 1619 mutex_lock(&ichan->chan_mutex);
1618 1620  
1619   - __idmac_control(chan, DMA_TERMINATE_ALL);
  1621 + __idmac_control(chan, DMA_TERMINATE_ALL, 0);
1620 1622  
1621 1623 if (ichan->status > IPU_CHANNEL_FREE) {
1622 1624 #ifdef DEBUG
... ... @@ -1709,7 +1711,7 @@
1709 1711 for (i = 0; i < IPU_CHANNELS_NUM; i++) {
1710 1712 struct idmac_channel *ichan = ipu->channel + i;
1711 1713  
1712   - idmac_control(&ichan->dma_chan, DMA_TERMINATE_ALL);
  1714 + idmac_control(&ichan->dma_chan, DMA_TERMINATE_ALL, 0);
1713 1715 idmac_prep_slave_sg(&ichan->dma_chan, NULL, 0, DMA_NONE, 0);
1714 1716 }
1715 1717  
... ... @@ -580,7 +580,8 @@
580 580 direction, flags);
581 581 }
582 582  
583   -static int sh_dmae_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  583 +static int sh_dmae_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  584 + unsigned long arg)
584 585 {
585 586 struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
586 587  
drivers/dma/ste_dma40.c
... ... @@ -2065,7 +2065,8 @@
2065 2065 spin_unlock_irqrestore(&d40c->lock, flags);
2066 2066 }
2067 2067  
2068   -static int d40_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  2068 +static int d40_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  2069 + unsigned long arg)
2069 2070 {
2070 2071 unsigned long flags;
2071 2072 struct d40_chan *d40c = container_of(chan, struct d40_chan, chan);
drivers/dma/timb_dma.c
... ... @@ -611,7 +611,8 @@
611 611 return &td_desc->txd;
612 612 }
613 613  
614   -static int td_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  614 +static int td_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  615 + unsigned long arg)
615 616 {
616 617 struct timb_dma_chan *td_chan =
617 618 container_of(chan, struct timb_dma_chan, chan);
drivers/dma/txx9dmac.c
... ... @@ -938,7 +938,8 @@
938 938 return &first->txd;
939 939 }
940 940  
941   -static int txx9dmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd)
  941 +static int txx9dmac_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  942 + unsigned long arg)
942 943 {
943 944 struct txx9dmac_chan *dc = to_txx9dmac_chan(chan);
944 945 struct txx9dmac_desc *desc, *_desc;
drivers/mmc/host/atmel-mci.c
... ... @@ -578,7 +578,7 @@
578 578 struct dma_chan *chan = host->data_chan;
579 579  
580 580 if (chan) {
581   - chan->device->device_control(chan, DMA_TERMINATE_ALL);
  581 + chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
582 582 atmci_dma_cleanup(host);
583 583 } else {
584 584 /* Data transfer was stopped by the interrupt handler */
drivers/serial/sh-sci.c
... ... @@ -1087,7 +1087,7 @@
1087 1087 unsigned long flags;
1088 1088 int count;
1089 1089  
1090   - chan->device->device_control(chan, DMA_TERMINATE_ALL);
  1090 + chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
1091 1091 dev_dbg(port->dev, "Read %u bytes with cookie %d\n",
1092 1092 sh_desc->partial, sh_desc->cookie);
1093 1093  
drivers/video/mx3fb.c
... ... @@ -388,7 +388,7 @@
388 388 spin_unlock_irqrestore(&mx3fb->lock, flags);
389 389  
390 390 mx3_fbi->txd->chan->device->device_control(mx3_fbi->txd->chan,
391   - DMA_TERMINATE_ALL);
  391 + DMA_TERMINATE_ALL, 0);
392 392 mx3_fbi->txd = NULL;
393 393 mx3_fbi->cookie = -EINVAL;
394 394 }
include/linux/dmaengine.h
... ... @@ -347,7 +347,8 @@
347 347 struct dma_chan *chan, struct scatterlist *sgl,
348 348 unsigned int sg_len, enum dma_data_direction direction,
349 349 unsigned long flags);
350   - int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd);
  350 + int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  351 + unsigned long arg);
351 352  
352 353 enum dma_status (*device_tx_status)(struct dma_chan *chan,
353 354 dma_cookie_t cookie,
sound/soc/txx9/txx9aclc.c
... ... @@ -159,7 +159,7 @@
159 159 void __iomem *base = drvdata->base;
160 160  
161 161 spin_unlock_irqrestore(&dmadata->dma_lock, flags);
162   - chan->device->device_control(chan, DMA_TERMINATE_ALL);
  162 + chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
163 163 /* first time */
164 164 for (i = 0; i < NR_DMA_CHAIN; i++) {
165 165 desc = txx9aclc_dma_submit(dmadata,
... ... @@ -267,7 +267,7 @@
267 267 struct dma_chan *chan = dmadata->dma_chan;
268 268  
269 269 dmadata->frag_count = -1;
270   - chan->device->device_control(chan, DMA_TERMINATE_ALL);
  270 + chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
271 271 return 0;
272 272 }
273 273  
... ... @@ -396,7 +396,8 @@
396 396 struct dma_chan *chan = dmadata->dma_chan;
397 397 if (chan) {
398 398 dmadata->frag_count = -1;
399   - chan->device->device_control(chan, DMA_TERMINATE_ALL);
  399 + chan->device->device_control(chan,
  400 + DMA_TERMINATE_ALL, 0);
400 401 dma_release_channel(chan);
401 402 }
402 403 dev->dmadata[i].dma_chan = NULL;