Skip to content

Commit 664475c

Browse files
digetxvinodkoul
authored andcommitted
dmaengine: tegra-apb: Ensure that clock is enabled during of DMA synchronization
DMA synchronization hook checks whether interrupt is raised by testing corresponding bit in a hardware status register, and thus, clock should be enabled in this case, otherwise CPU may hang if synchronization is invoked while Runtime PM is in suspended state. This patch resumes the RPM during of the DMA synchronization process in order to avoid potential problems. It is a minor clean up of a previous commit, no real problem is fixed by this patch because currently RPM is always in a resumed state while DMA is synchronized, although this may change in the future. Fixes: 6697255 ("dmaengine: tegra-apb: Improve DMA synchronization") Signed-off-by: Dmitry Osipenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 0821009 commit 664475c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/dma/tegra20-apb-dma.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,13 @@ static bool tegra_dma_eoc_interrupt_deasserted(struct tegra_dma_channel *tdc)
816816
static void tegra_dma_synchronize(struct dma_chan *dc)
817817
{
818818
struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
819+
int err;
820+
821+
err = pm_runtime_get_sync(tdc->tdma->dev);
822+
if (err < 0) {
823+
dev_err(tdc2dev(tdc), "Failed to synchronize DMA: %d\n", err);
824+
return;
825+
}
819826

820827
/*
821828
* CPU, which handles interrupt, could be busy in
@@ -825,6 +832,8 @@ static void tegra_dma_synchronize(struct dma_chan *dc)
825832
wait_event(tdc->wq, tegra_dma_eoc_interrupt_deasserted(tdc));
826833

827834
tasklet_kill(&tdc->tasklet);
835+
836+
pm_runtime_put(tdc->tdma->dev);
828837
}
829838

830839
static unsigned int tegra_dma_sg_bytes_xferred(struct tegra_dma_channel *tdc,

0 commit comments

Comments
 (0)