| @@ -317,6 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data) · 316 unmodified lines |
| 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) · 15 unmodified lines |
| 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) · 17 unmodified lines |
| 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) · 15 unmodified lines |
| 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) · 67 unmodified lines |
| 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) · 4 unmodified lines |
| 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: · 580 unmodified lines |
| 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: · 5 unmodified lines |
| 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 | |