From b7f9bc5267d3517de8a7159219db96de7d12a37b Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 16 Jul 2014 15:29:20 +0300 Subject: dmaengine: edma: Update caps->residue_granularity to match with reality The edma can report accurate DMA position so update the residue_granularity to DMA_RESIDUE_GRANULARITY_BURST. Signed-off-by: Peter Ujfalusi Signed-off-by: Vinod Koul --- drivers/dma/edma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/dma/edma.c') diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index d08c4dedef35..8e400c0f3529 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -992,7 +992,7 @@ static int edma_dma_device_slave_caps(struct dma_chan *dchan, caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); caps->cmd_pause = true; caps->cmd_terminate = true; - caps->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR; + caps->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; return 0; } -- cgit v1.2.3 From a1f146f31724b649f74185ffc817bbd983eba5e2 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 16 Jul 2014 15:29:21 +0300 Subject: dmaengine: edma: Support to suppress the period interrupts in cyclic mode If the client (audio) does not request interrupts for every period we can disable them. With updated audio driver stack we can play audio w/o the need to process any edma interrupts. Signed-off-by: Peter Ujfalusi Signed-off-by: Vinod Koul --- drivers/dma/edma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/dma/edma.c') diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 8e400c0f3529..54f7408e14ef 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -718,10 +718,10 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( edesc->absync = ret; /* - * Enable interrupts for every period because callback - * has to be called for every period. + * Enable period interrupt only if it is requested */ - edesc->pset[i].param.opt |= TCINTEN; + if (tx_flags & DMA_PREP_INTERRUPT) + edesc->pset[i].param.opt |= TCINTEN; } return vchan_tx_prep(&echan->vchan, &edesc->vdesc, tx_flags); -- cgit v1.2.3 From 8e8805d5bf704f24acb14d67d506cbd4c5893be5 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 8 Jul 2014 13:46:38 +0300 Subject: dmaengine: edma: Serve cyclic (audio) channels with high priority queue Move the DMA channel used in cyclic mode (audio) to the highest priority event queue which helps to reduce audio problems. When the channel is terminated, move it back to the default queue. Signed-off-by: Peter Ujfalusi Signed-off-by: Vinod Koul --- drivers/dma/edma.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/dma/edma.c') diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 54f7408e14ef..3754ffa09f27 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -256,8 +256,13 @@ static int edma_terminate_all(struct edma_chan *echan) * echan->edesc is NULL and exit.) */ if (echan->edesc) { + int cyclic = echan->edesc->cyclic; echan->edesc = NULL; edma_stop(echan->ch_num); + /* Move the cyclic channel back to default queue */ + if (cyclic) + edma_assign_channel_eventq(echan->ch_num, + EVENTQ_DEFAULT); } vchan_get_all_descriptors(&echan->vchan, &head); @@ -724,6 +729,9 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( edesc->pset[i].param.opt |= TCINTEN; } + /* Place the cyclic channel to highest priority queue */ + edma_assign_channel_eventq(echan->ch_num, EVENTQ_0); + return vchan_tx_prep(&echan->vchan, &edesc->vdesc, tx_flags); } -- cgit v1.2.3 From 04d537d95e2f48295b6f61ef7029a2dba75e3677 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 31 Jul 2014 13:12:37 +0300 Subject: dmaengine: edma: Do not change the error code returned from edma_alloc_slot In case of edma_alloc_slot() failure during probe we should return the error unchanged to make debugging easier. Signed-off-by: Peter Ujfalusi Signed-off-by: Vinod Koul --- drivers/dma/edma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/dma/edma.c') diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 3754ffa09f27..4190976ababc 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -1047,7 +1047,7 @@ static int edma_probe(struct platform_device *pdev) ecc->dummy_slot = edma_alloc_slot(ecc->ctlr, EDMA_SLOT_ANY); if (ecc->dummy_slot < 0) { dev_err(&pdev->dev, "Can't allocate PaRAM dummy slot\n"); - return -EIO; + return ecc->dummy_slot; } dma_cap_zero(ecc->dma_slave.cap_mask); -- cgit v1.2.3 From ed64610f29414c0ea782bb6a462a3be72e7704dd Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 31 Jul 2014 13:12:38 +0300 Subject: dmaengine: edma: Do not register second device when booted with DT DT boot does not yet support more than one edma device. To avoid issues at runtime we should not register the second device when the kernel is booted with DT. Signed-off-by: Peter Ujfalusi Signed-off-by: Vinod Koul --- drivers/dma/edma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/dma/edma.c') diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 4190976ababc..a13f37f719ed 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -1132,7 +1133,7 @@ static int edma_init(void) } } - if (EDMA_CTLRS == 2) { + if (!of_have_populated_dt() && EDMA_CTLRS == 2) { pdev1 = platform_device_register_full(&edma_dev_info1); if (IS_ERR(pdev1)) { platform_driver_unregister(&edma_driver); -- cgit v1.2.3 From 31c1e5a1350ae8d1bc2018f5de8264266d9773e1 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 1 Aug 2014 12:20:10 +0200 Subject: dmaengine: Remove the context argument to the prep_dma_cyclic operation The argument is always set to NULL and never used. Remove it. Signed-off-by: Laurent Pinchart Signed-off-by: Vinod Koul --- drivers/dma/edma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/dma/edma.c') diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index a13f37f719ed..d566650abf62 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -598,7 +598,7 @@ struct dma_async_tx_descriptor *edma_prep_dma_memcpy( static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, size_t period_len, enum dma_transfer_direction direction, - unsigned long tx_flags, void *context) + unsigned long tx_flags) { struct edma_chan *echan = to_edma_chan(chan); struct device *dev = chan->device->dev; -- cgit v1.2.3