Commit eab8d4bc authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'dmaengine-fix-4.9-rc6' of git://git.infradead.org/users/vkoul/slave-dma

Pull dmaengine fixes from Vinod Koul:
 "Some driver fixes which we pending in my tree:

   - return error code fix in edma driver
   - Kconfig fix for genric allocator in mmp_tdma
   - fix uninitialized value in sun6i
   - Runtime pm fixes for cppi"

* tag 'dmaengine-fix-4.9-rc6' of git://git.infradead.org/users/vkoul/slave-dma:
  dmaengine: cppi41: More PM runtime fixes
  dmaengine: cpp41: Fix handling of error path
  dmaengine: cppi41: Fix unpaired pm runtime when only a USB hub is connected
  dmaengine: cppi41: Fix list not empty warning on module removal
  dmaengine: sun6i: fix the uninitialized value for v_lli
  dmaengine: mmp_tdma: add missing select GENERIC_ALLOCATOR in Kconfig
  dmaengine: edma: Fix error return code in edma_alloc_chan_resources()
parents 20afa6e2 d5afc1b6
...@@ -306,6 +306,7 @@ config MMP_TDMA ...@@ -306,6 +306,7 @@ config MMP_TDMA
depends on ARCH_MMP || COMPILE_TEST depends on ARCH_MMP || COMPILE_TEST
select DMA_ENGINE select DMA_ENGINE
select MMP_SRAM if ARCH_MMP select MMP_SRAM if ARCH_MMP
select GENERIC_ALLOCATOR
help help
Support the MMP Two-Channel DMA engine. Support the MMP Two-Channel DMA engine.
This engine used for MMP Audio DMA and pxa910 SQU. This engine used for MMP Audio DMA and pxa910 SQU.
......
...@@ -317,6 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data) ...@@ -317,6 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data)
while (val) { while (val) {
u32 desc, len; u32 desc, len;
int error;
error = pm_runtime_get(cdd->ddev.dev);
if (error < 0)
dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
__func__, error);
q_num = __fls(val); q_num = __fls(val);
val &= ~(1 << q_num); val &= ~(1 << q_num);
...@@ -338,7 +344,6 @@ static irqreturn_t cppi41_irq(int irq, void *data) ...@@ -338,7 +344,6 @@ static irqreturn_t cppi41_irq(int irq, void *data)
dma_cookie_complete(&c->txd); dma_cookie_complete(&c->txd);
dmaengine_desc_get_callback_invoke(&c->txd, NULL); dmaengine_desc_get_callback_invoke(&c->txd, NULL);
/* Paired with cppi41_dma_issue_pending */
pm_runtime_mark_last_busy(cdd->ddev.dev); pm_runtime_mark_last_busy(cdd->ddev.dev);
pm_runtime_put_autosuspend(cdd->ddev.dev); pm_runtime_put_autosuspend(cdd->ddev.dev);
} }
...@@ -362,8 +367,13 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan) ...@@ -362,8 +367,13 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan)
int error; int error;
error = pm_runtime_get_sync(cdd->ddev.dev); error = pm_runtime_get_sync(cdd->ddev.dev);
if (error < 0) if (error < 0) {
dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
__func__, error);
pm_runtime_put_noidle(cdd->ddev.dev);
return error; return error;
}
dma_cookie_init(chan); dma_cookie_init(chan);
dma_async_tx_descriptor_init(&c->txd, chan); dma_async_tx_descriptor_init(&c->txd, chan);
...@@ -385,8 +395,11 @@ static void cppi41_dma_free_chan_resources(struct dma_chan *chan) ...@@ -385,8 +395,11 @@ static void cppi41_dma_free_chan_resources(struct dma_chan *chan)
int error; int error;
error = pm_runtime_get_sync(cdd->ddev.dev); error = pm_runtime_get_sync(cdd->ddev.dev);
if (error < 0) if (error < 0) {
pm_runtime_put_noidle(cdd->ddev.dev);
return; return;
}
WARN_ON(!list_empty(&cdd->pending)); WARN_ON(!list_empty(&cdd->pending));
...@@ -460,9 +473,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) ...@@ -460,9 +473,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
struct cppi41_dd *cdd = c->cdd; struct cppi41_dd *cdd = c->cdd;
int error; int error;
/* PM runtime paired with dmaengine_desc_get_callback_invoke */
error = pm_runtime_get(cdd->ddev.dev); error = pm_runtime_get(cdd->ddev.dev);
if ((error != -EINPROGRESS) && error < 0) { if ((error != -EINPROGRESS) && error < 0) {
pm_runtime_put_noidle(cdd->ddev.dev);
dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n",
error); error);
...@@ -473,6 +486,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) ...@@ -473,6 +486,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
push_desc_queue(c); push_desc_queue(c);
else else
pending_desc(c); pending_desc(c);
pm_runtime_mark_last_busy(cdd->ddev.dev);
pm_runtime_put_autosuspend(cdd->ddev.dev);
} }
static u32 get_host_pd0(u32 length) static u32 get_host_pd0(u32 length)
...@@ -1059,8 +1075,8 @@ static int cppi41_dma_probe(struct platform_device *pdev) ...@@ -1059,8 +1075,8 @@ static int cppi41_dma_probe(struct platform_device *pdev)
deinit_cppi41(dev, cdd); deinit_cppi41(dev, cdd);
err_init_cppi: err_init_cppi:
pm_runtime_dont_use_autosuspend(dev); pm_runtime_dont_use_autosuspend(dev);
pm_runtime_put_sync(dev);
err_get_sync: err_get_sync:
pm_runtime_put_sync(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
iounmap(cdd->usbss_mem); iounmap(cdd->usbss_mem);
iounmap(cdd->ctrl_mem); iounmap(cdd->ctrl_mem);
...@@ -1072,7 +1088,12 @@ static int cppi41_dma_probe(struct platform_device *pdev) ...@@ -1072,7 +1088,12 @@ static int cppi41_dma_probe(struct platform_device *pdev)
static int cppi41_dma_remove(struct platform_device *pdev) static int cppi41_dma_remove(struct platform_device *pdev)
{ {
struct cppi41_dd *cdd = platform_get_drvdata(pdev); struct cppi41_dd *cdd = platform_get_drvdata(pdev);
int error;
error = pm_runtime_get_sync(&pdev->dev);
if (error < 0)
dev_err(&pdev->dev, "%s could not pm_runtime_get: %i\n",
__func__, error);
of_dma_controller_free(pdev->dev.of_node); of_dma_controller_free(pdev->dev.of_node);
dma_async_device_unregister(&cdd->ddev); dma_async_device_unregister(&cdd->ddev);
......
...@@ -1628,6 +1628,7 @@ static int edma_alloc_chan_resources(struct dma_chan *chan) ...@@ -1628,6 +1628,7 @@ static int edma_alloc_chan_resources(struct dma_chan *chan)
if (echan->slot[0] < 0) { if (echan->slot[0] < 0) {
dev_err(dev, "Entry slot allocation failed for channel %u\n", dev_err(dev, "Entry slot allocation failed for channel %u\n",
EDMA_CHAN_SLOT(echan->ch_num)); EDMA_CHAN_SLOT(echan->ch_num));
ret = echan->slot[0];
goto err_slot; goto err_slot;
} }
......
...@@ -578,7 +578,7 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( ...@@ -578,7 +578,7 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy(
burst = convert_burst(8); burst = convert_burst(8);
width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES); width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES);
v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | v_lli->cfg = DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) |
DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) |
DMA_CHAN_CFG_DST_LINEAR_MODE | DMA_CHAN_CFG_DST_LINEAR_MODE |
DMA_CHAN_CFG_SRC_LINEAR_MODE | DMA_CHAN_CFG_SRC_LINEAR_MODE |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment