diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-19 14:05:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-19 14:05:47 -0500 |
commit | eab8d4bc0aa79d0d401bde62bf33b4adaab08db9 (patch) | |
tree | aa1ff3e21e7b7a668b633204f160e8dedf3a795e | |
parent | 20afa6e2f9c129e13031cc4a21834a03641cb8a4 (diff) | |
parent | d5afc1b68a6ddc27746d31f775025afe75ec8122 (diff) |
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()
-rw-r--r-- | drivers/dma/Kconfig | 1 | ||||
-rw-r--r-- | drivers/dma/cppi41.c | 31 | ||||
-rw-r--r-- | drivers/dma/edma.c | 1 | ||||
-rw-r--r-- | drivers/dma/sun6i-dma.c | 2 |
4 files changed, 29 insertions, 6 deletions
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index af63a6bcf564..141aefbe37ec 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -306,6 +306,7 @@ config MMP_TDMA | |||
306 | depends on ARCH_MMP || COMPILE_TEST | 306 | depends on ARCH_MMP || COMPILE_TEST |
307 | select DMA_ENGINE | 307 | select DMA_ENGINE |
308 | select MMP_SRAM if ARCH_MMP | 308 | select MMP_SRAM if ARCH_MMP |
309 | select GENERIC_ALLOCATOR | ||
309 | help | 310 | help |
310 | Support the MMP Two-Channel DMA engine. | 311 | Support the MMP Two-Channel DMA engine. |
311 | This engine used for MMP Audio DMA and pxa910 SQU. | 312 | This engine used for MMP Audio DMA and pxa910 SQU. |
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index bac5f023013b..d5ba43a87a68 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c | |||
@@ -317,6 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data) | |||
317 | 317 | ||
318 | while (val) { | 318 | while (val) { |
319 | u32 desc, len; | 319 | u32 desc, len; |
320 | int error; | ||
321 | |||
322 | error = pm_runtime_get(cdd->ddev.dev); | ||
323 | if (error < 0) | ||
324 | dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n", | ||
325 | __func__, error); | ||
320 | 326 | ||
321 | q_num = __fls(val); | 327 | q_num = __fls(val); |
322 | val &= ~(1 << q_num); | 328 | val &= ~(1 << q_num); |
@@ -338,7 +344,6 @@ static irqreturn_t cppi41_irq(int irq, void *data) | |||
338 | dma_cookie_complete(&c->txd); | 344 | dma_cookie_complete(&c->txd); |
339 | dmaengine_desc_get_callback_invoke(&c->txd, NULL); | 345 | dmaengine_desc_get_callback_invoke(&c->txd, NULL); |
340 | 346 | ||
341 | /* Paired with cppi41_dma_issue_pending */ | ||
342 | pm_runtime_mark_last_busy(cdd->ddev.dev); | 347 | pm_runtime_mark_last_busy(cdd->ddev.dev); |
343 | pm_runtime_put_autosuspend(cdd->ddev.dev); | 348 | pm_runtime_put_autosuspend(cdd->ddev.dev); |
344 | } | 349 | } |
@@ -362,8 +367,13 @@ static int cppi41_dma_alloc_chan_resources(struct dma_chan *chan) | |||
362 | int error; | 367 | int error; |
363 | 368 | ||
364 | error = pm_runtime_get_sync(cdd->ddev.dev); | 369 | error = pm_runtime_get_sync(cdd->ddev.dev); |
365 | if (error < 0) | 370 | if (error < 0) { |
371 | dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n", | ||
372 | __func__, error); | ||
373 | pm_runtime_put_noidle(cdd->ddev.dev); | ||
374 | |||
366 | return error; | 375 | return error; |
376 | } | ||
367 | 377 | ||
368 | dma_cookie_init(chan); | 378 | dma_cookie_init(chan); |
369 | dma_async_tx_descriptor_init(&c->txd, chan); | 379 | dma_async_tx_descriptor_init(&c->txd, chan); |
@@ -385,8 +395,11 @@ static void cppi41_dma_free_chan_resources(struct dma_chan *chan) | |||
385 | int error; | 395 | int error; |
386 | 396 | ||
387 | error = pm_runtime_get_sync(cdd->ddev.dev); | 397 | error = pm_runtime_get_sync(cdd->ddev.dev); |
388 | if (error < 0) | 398 | if (error < 0) { |
399 | pm_runtime_put_noidle(cdd->ddev.dev); | ||
400 | |||
389 | return; | 401 | return; |
402 | } | ||
390 | 403 | ||
391 | WARN_ON(!list_empty(&cdd->pending)); | 404 | WARN_ON(!list_empty(&cdd->pending)); |
392 | 405 | ||
@@ -460,9 +473,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) | |||
460 | struct cppi41_dd *cdd = c->cdd; | 473 | struct cppi41_dd *cdd = c->cdd; |
461 | int error; | 474 | int error; |
462 | 475 | ||
463 | /* PM runtime paired with dmaengine_desc_get_callback_invoke */ | ||
464 | error = pm_runtime_get(cdd->ddev.dev); | 476 | error = pm_runtime_get(cdd->ddev.dev); |
465 | if ((error != -EINPROGRESS) && error < 0) { | 477 | if ((error != -EINPROGRESS) && error < 0) { |
478 | pm_runtime_put_noidle(cdd->ddev.dev); | ||
466 | dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", | 479 | dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", |
467 | error); | 480 | error); |
468 | 481 | ||
@@ -473,6 +486,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) | |||
473 | push_desc_queue(c); | 486 | push_desc_queue(c); |
474 | else | 487 | else |
475 | pending_desc(c); | 488 | pending_desc(c); |
489 | |||
490 | pm_runtime_mark_last_busy(cdd->ddev.dev); | ||
491 | pm_runtime_put_autosuspend(cdd->ddev.dev); | ||
476 | } | 492 | } |
477 | 493 | ||
478 | static u32 get_host_pd0(u32 length) | 494 | static u32 get_host_pd0(u32 length) |
@@ -1059,8 +1075,8 @@ err_chans: | |||
1059 | deinit_cppi41(dev, cdd); | 1075 | deinit_cppi41(dev, cdd); |
1060 | err_init_cppi: | 1076 | err_init_cppi: |
1061 | pm_runtime_dont_use_autosuspend(dev); | 1077 | pm_runtime_dont_use_autosuspend(dev); |
1062 | pm_runtime_put_sync(dev); | ||
1063 | err_get_sync: | 1078 | err_get_sync: |
1079 | pm_runtime_put_sync(dev); | ||
1064 | pm_runtime_disable(dev); | 1080 | pm_runtime_disable(dev); |
1065 | iounmap(cdd->usbss_mem); | 1081 | iounmap(cdd->usbss_mem); |
1066 | iounmap(cdd->ctrl_mem); | 1082 | iounmap(cdd->ctrl_mem); |
@@ -1072,7 +1088,12 @@ err_get_sync: | |||
1072 | static int cppi41_dma_remove(struct platform_device *pdev) | 1088 | static int cppi41_dma_remove(struct platform_device *pdev) |
1073 | { | 1089 | { |
1074 | struct cppi41_dd *cdd = platform_get_drvdata(pdev); | 1090 | struct cppi41_dd *cdd = platform_get_drvdata(pdev); |
1091 | int error; | ||
1075 | 1092 | ||
1093 | error = pm_runtime_get_sync(&pdev->dev); | ||
1094 | if (error < 0) | ||
1095 | dev_err(&pdev->dev, "%s could not pm_runtime_get: %i\n", | ||
1096 | __func__, error); | ||
1076 | of_dma_controller_free(pdev->dev.of_node); | 1097 | of_dma_controller_free(pdev->dev.of_node); |
1077 | dma_async_device_unregister(&cdd->ddev); | 1098 | dma_async_device_unregister(&cdd->ddev); |
1078 | 1099 | ||
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index e18a58068bca..77242b37ef87 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -1628,6 +1628,7 @@ static int edma_alloc_chan_resources(struct dma_chan *chan) | |||
1628 | if (echan->slot[0] < 0) { | 1628 | if (echan->slot[0] < 0) { |
1629 | dev_err(dev, "Entry slot allocation failed for channel %u\n", | 1629 | dev_err(dev, "Entry slot allocation failed for channel %u\n", |
1630 | EDMA_CHAN_SLOT(echan->ch_num)); | 1630 | EDMA_CHAN_SLOT(echan->ch_num)); |
1631 | ret = echan->slot[0]; | ||
1631 | goto err_slot; | 1632 | goto err_slot; |
1632 | } | 1633 | } |
1633 | 1634 | ||
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 83461994e418..a2358780ab2c 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c | |||
@@ -578,7 +578,7 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
578 | 578 | ||
579 | burst = convert_burst(8); | 579 | burst = convert_burst(8); |
580 | width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES); | 580 | width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES); |
581 | v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | | 581 | v_lli->cfg = DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | |
582 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | | 582 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | |
583 | DMA_CHAN_CFG_DST_LINEAR_MODE | | 583 | DMA_CHAN_CFG_DST_LINEAR_MODE | |
584 | DMA_CHAN_CFG_SRC_LINEAR_MODE | | 584 | DMA_CHAN_CFG_SRC_LINEAR_MODE | |