Skip to content

Commit b62a130

Browse files
ADESTMvinodkoul
authored andcommitted
dmaengine: stm32-dma3: add device_pause and device_resume ops
STM32 DMA3 controller is able to suspend an ongoing transfer (the transfer is suspended after the ongoing burst is flushed to the destination) and resume it from the point it was suspended. No need to reconfigure any register. Signed-off-by: Amelie Delaunay <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent b3b893a commit b62a130

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/dma/stm32/stm32-dma3.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,35 @@ static int stm32_dma3_config(struct dma_chan *c, struct dma_slave_config *config
12491249
return 0;
12501250
}
12511251

1252+
static int stm32_dma3_pause(struct dma_chan *c)
1253+
{
1254+
struct stm32_dma3_chan *chan = to_stm32_dma3_chan(c);
1255+
int ret;
1256+
1257+
ret = stm32_dma3_chan_suspend(chan, true);
1258+
if (ret)
1259+
return ret;
1260+
1261+
chan->dma_status = DMA_PAUSED;
1262+
1263+
dev_dbg(chan2dev(chan), "vchan %pK: paused\n", &chan->vchan);
1264+
1265+
return 0;
1266+
}
1267+
1268+
static int stm32_dma3_resume(struct dma_chan *c)
1269+
{
1270+
struct stm32_dma3_chan *chan = to_stm32_dma3_chan(c);
1271+
1272+
stm32_dma3_chan_suspend(chan, false);
1273+
1274+
chan->dma_status = DMA_IN_PROGRESS;
1275+
1276+
dev_dbg(chan2dev(chan), "vchan %pK: resumed\n", &chan->vchan);
1277+
1278+
return 0;
1279+
}
1280+
12521281
static int stm32_dma3_terminate_all(struct dma_chan *c)
12531282
{
12541283
struct stm32_dma3_chan *chan = to_stm32_dma3_chan(c);
@@ -1485,6 +1514,8 @@ static int stm32_dma3_probe(struct platform_device *pdev)
14851514
dma_dev->device_prep_dma_cyclic = stm32_dma3_prep_dma_cyclic;
14861515
dma_dev->device_caps = stm32_dma3_caps;
14871516
dma_dev->device_config = stm32_dma3_config;
1517+
dma_dev->device_pause = stm32_dma3_pause;
1518+
dma_dev->device_resume = stm32_dma3_resume;
14881519
dma_dev->device_terminate_all = stm32_dma3_terminate_all;
14891520
dma_dev->device_synchronize = stm32_dma3_synchronize;
14901521
dma_dev->device_tx_status = dma_cookie_status;

0 commit comments

Comments
 (0)