* Grygorii Strashko <grygorii.strashko@xxxxxx> [191023 20:56]: > On 23/10/2019 23:18, Tony Lindgren wrote: > > And no, adding pm_runtime_get_sync() to issue_pending is not > > a solution. There may be clocks and regulators that need to > > be powered up, and we don't want to use pm_runtime_irq_safe() > > because of the permanent use count on the parent. > > 5 cents. > > I think the right thing might be to get rid of pm_runtime_xxx() > in cppi41_dma_issue_pending(). So overall approach will be: > > - new job -> cppi41_dma_prep_slave_sg() -> pm_runtime_get() > - issue_pending: fill backlog if suspended or run_queue if active (pm_runtime_active()) > - job done: dmaengine_desc_get_callback_invoke() -> > > dmaengine_desc_get_callback_invoke(); > pm_runtime_mark_last_busy(cdd->ddev.dev); > pm_runtime_put_autosuspend(cdd->ddev.dev); > in all places. > > It even might allow to get rid of cdd->lock. Well I don't think cppi41_dma_prep_slave_sg() is necessarily paired with anything currently. This can potentially leading to pm_runtime_get() called multiple times? So I think we'd also need cppi41_dma_cleanup_slave_sg() or similar, and require they get called in a paired manner. It might be better to add seprate PM runtime specific functions that dma consumers can optionally call. Regards, Tony