Commit 2dcdf570 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

dmaengine: omap: Add support for pause/resume in cyclic dma mode

The audio stack used omap_stop_dma/omap_start_dma to pause/resume the DMA.
This method has been used for years on OMAP based products.
We only allow pause/resume when the DMA has been configured in cyclic mode
which is used by the audio stack.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
Tested-by: default avatarJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent ccffa387
...@@ -34,6 +34,7 @@ struct omap_chan { ...@@ -34,6 +34,7 @@ struct omap_chan {
struct dma_slave_config cfg; struct dma_slave_config cfg;
unsigned dma_sig; unsigned dma_sig;
bool cyclic; bool cyclic;
bool paused;
int dma_ch; int dma_ch;
struct omap_desc *desc; struct omap_desc *desc;
...@@ -470,11 +471,14 @@ static int omap_dma_terminate_all(struct omap_chan *c) ...@@ -470,11 +471,14 @@ static int omap_dma_terminate_all(struct omap_chan *c)
*/ */
if (c->desc) { if (c->desc) {
c->desc = NULL; c->desc = NULL;
/* Avoid stopping the dma twice */
if (!c->paused)
omap_stop_dma(c->dma_ch); omap_stop_dma(c->dma_ch);
} }
if (c->cyclic) { if (c->cyclic) {
c->cyclic = false; c->cyclic = false;
c->paused = false;
omap_dma_unlink_lch(c->dma_ch, c->dma_ch); omap_dma_unlink_lch(c->dma_ch, c->dma_ch);
} }
...@@ -487,14 +491,30 @@ static int omap_dma_terminate_all(struct omap_chan *c) ...@@ -487,14 +491,30 @@ static int omap_dma_terminate_all(struct omap_chan *c)
static int omap_dma_pause(struct omap_chan *c) static int omap_dma_pause(struct omap_chan *c)
{ {
/* FIXME: not supported by platform private API */ /* Pause/Resume only allowed with cyclic mode */
if (!c->cyclic)
return -EINVAL; return -EINVAL;
if (!c->paused) {
omap_stop_dma(c->dma_ch);
c->paused = true;
}
return 0;
} }
static int omap_dma_resume(struct omap_chan *c) static int omap_dma_resume(struct omap_chan *c)
{ {
/* FIXME: not supported by platform private API */ /* Pause/Resume only allowed with cyclic mode */
if (!c->cyclic)
return -EINVAL; return -EINVAL;
if (c->paused) {
omap_start_dma(c->dma_ch);
c->paused = false;
}
return 0;
} }
static int omap_dma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, static int omap_dma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment