Re: [PATCH v6 11/16] dmaengine: tegra-apb: Keep clock enabled only during of DMA transfer

From: Jon Hunter
Date: Fri Jan 31 2020 - 04:05:49 EST



On 30/01/2020 04:37, Dmitry Osipenko wrote:
> It's a bit impractical to enable hardware's clock at the time of DMA
> channel's allocation because most of DMA client drivers allocate DMA
> channel at the time of the driver's probing, and thus, DMA clock is kept
> always-enabled in practice, defeating the whole purpose of runtime PM.
>
> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
> ---
> drivers/dma/tegra20-apb-dma.c | 47 ++++++++++++++++++++++++-----------
> 1 file changed, 32 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> index 22b88ccff05d..0ee28d8e3c96 100644
> --- a/drivers/dma/tegra20-apb-dma.c
> +++ b/drivers/dma/tegra20-apb-dma.c
> @@ -436,6 +436,8 @@ static void tegra_dma_stop(struct tegra_dma_channel *tdc)
> tdc_write(tdc, TEGRA_APBDMA_CHAN_STATUS, status);
> }
> tdc->busy = false;
> +
> + pm_runtime_put(tdc->tdma->dev);

There are only 3 places where tegra_dma_stop is called, does it simplify
the code if we move the pm_runtime_put() outside of tegra_dma_stop? In
other words, everywhere there is a tegra_dma_stop, afterwards we then
call pm_runtime_put?

This would allow us to get rid of the extra pm_runtime_get in
terminate_all.

Jon

--
nvpublic