Skip to content

Commit a70ff65

Browse files
digetxthierryreding
authored andcommitted
i2c: tegra: Synchronize DMA before termination
DMA transfer could be completed, but CPU (which handles DMA interrupt) may get too busy and can't handle the interrupt in a timely manner, despite of DMA IRQ being raised. In this case the DMA state needs to synchronized before terminating DMA transfer in order not to miss the DMA transfer completion. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 566c05f commit a70ff65

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/i2c/busses/i2c-tegra.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,15 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
12191219
time_left = tegra_i2c_wait_completion_timeout(
12201220
i2c_dev, &i2c_dev->dma_complete, xfer_time);
12211221

1222+
/*
1223+
* Synchronize DMA first, since dmaengine_terminate_sync()
1224+
* performs synchronization after the transfer's termination
1225+
* and we want to get a completion if transfer succeeded.
1226+
*/
1227+
dmaengine_synchronize(i2c_dev->msg_read ?
1228+
i2c_dev->rx_dma_chan :
1229+
i2c_dev->tx_dma_chan);
1230+
12221231
dmaengine_terminate_sync(i2c_dev->msg_read ?
12231232
i2c_dev->rx_dma_chan :
12241233
i2c_dev->tx_dma_chan);

0 commit comments

Comments
 (0)