| @@ -317,6 +317,12 @@ static irqreturn_t cppi41_irq(int irq, void *data) · 316 unmodified lines |
| 317 | 317 | |
| 318 | 318 | while (val) { |
| 319 | 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 | 327 | q_num = __fls(val); |
| 322 | 328 | val &= ~(1 << q_num); |
| @@ -338,7 +344,6 @@ static irqreturn_t cppi41_irq(int irq, void *data) · 15 unmodified lines |
| 338 | 344 | dma_cookie_complete(&c->txd); |
| 339 | 345 | dmaengine_desc_get_callback_invoke(&c->txd, NULL); |
| 340 | 346 | |
| 341 | | − /* Paired with cppi41_dma_issue_pending */ |
| 342 | 347 | pm_runtime_mark_last_busy(cdd->ddev.dev); |
| 343 | 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 | 367 | int error; |
| 363 | 368 | |
| 364 | 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 | 375 | return error; |
| 376 | + } |
| 367 | 377 | |
| 368 | 378 | dma_cookie_init(chan); |
| 369 | 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 | 395 | int error; |
| 386 | 396 | |
| 387 | 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 | 401 | return; |
| 402 | + } |
| 390 | 403 | |
| 391 | 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 | 473 | struct cppi41_dd *cdd = c->cdd; |
| 461 | 474 | int error; |
| 462 | 475 | |
| 463 | | − /* PM runtime paired with dmaengine_desc_get_callback_invoke */ |
| 464 | 476 | error = pm_runtime_get(cdd->ddev.dev); |
| 465 | 477 | if ((error != -EINPROGRESS) && error < 0) { |
| 478 | + pm_runtime_put_noidle(cdd->ddev.dev); |
| 466 | 479 | dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n", |
| 467 | 480 | error); |
| 468 | 481 | |
| @@ -473,6 +486,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) · 4 unmodified lines |
| 473 | 486 | push_desc_queue(c); |
| 474 | 487 | else |
| 475 | 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 | 494 | static u32 get_host_pd0(u32 length) |
| @@ -1059,8 +1075,8 @@ err_chans: · 580 unmodified lines |
| 1059 | 1075 | deinit_cppi41(dev, cdd); |
| 1060 | 1076 | err_init_cppi: |
| 1061 | 1077 | pm_runtime_dont_use_autosuspend(dev); |
| 1062 | | − pm_runtime_put_sync(dev); |
| 1063 | 1078 | err_get_sync: |
| 1079 | + pm_runtime_put_sync(dev); |
| 1064 | 1080 | pm_runtime_disable(dev); |
| 1065 | 1081 | iounmap(cdd->usbss_mem); |
| 1066 | 1082 | iounmap(cdd->ctrl_mem); |
| @@ -1072,7 +1088,12 @@ err_get_sync: · 5 unmodified lines |
| 1072 | 1088 | static int cppi41_dma_remove(struct platform_device *pdev) |
| 1073 | 1089 | { |
| 1074 | 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 | 1097 | of_dma_controller_free(pdev->dev.of_node); |
| 1077 | 1098 | dma_async_device_unregister(&cdd->ddev); |
| 1078 | 1099 | |