Skip to contentSkip to conversation

dmaengine: omap-dma: Fix cyclic suspend/resume

PATCH Applied Peter Ujfalusi 2 participants 5 messages Sep 16, 2014 – Sep 23, 2014 dmaengine

lore
Share & tools
lore
#0 lore raw

v3 cover dmaengine: omap-dma: Fix cyclic suspend/resume

Hi,

Changes since v2:
- fix typo in patch two
- Acked-by added from Russell

When the audio is paused/resumed (application paused the sream or board suspend) the audio was only playing back one period worth of data and then stops because the omap_dam_stop() clears the link configuration and it is not restored in start.

Also add memory barrier call to resume path since this could happen right after coming out from suspend.

Regards,
Peter
---
Peter Ujfalusi (2):
dmaengine: omap-dma: Add memory barrier to dma_resume path
dmaengine: omap-dma: Restore the CLINK_CTRL in resume path

 drivers/dma/omap-dma.c | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
2.1.0
#2 lore raw

PATCH v3 2/2 dmaengine: omap-dma: Restore the CLINK_CTRL in resume path

When the audio stream is paused or suspended we stop the sDMA and when it is unpaused/resumed we start the channel without reconfiguring it. The omap_dma_stop() clears the link configuration when we pause the dma, but it is not setting it back on start. This will result only one audio buffer to be played back and the DMA will stop, since the linking is disabled. We need to restore the CLINK_CTRL register in case of resume.

---
 drivers/dma/omap-dma.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/dma/omap-dma.c +3 -0
index c01ea505ee7c..bbea8243f9e8 100644
@@ -1019,6 +1019,9 @@ static int omap_dma_resume(struct omap_chan *c)
 	if (c->paused) {
 		mb();
 
+		/* Restore channel link register */
+		omap_dma_chan_write(c, CLNK_CTRL, c->desc->clnk_ctrl);
+
 		omap_dma_start(c, c->desc);
 		c->paused = false;
 	}
Signature · 1 line
2.1.0
#1 lore raw

PATCH v3 1/2 dmaengine: omap-dma: Add memory barrier to dma_resume path

In reply to Peter Ujfalusi

Add mb() call to resume path to ensure the necessary barrier. Resume can happen after waking up from suspend for example.

---
 drivers/dma/omap-dma.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/omap-dma.c +2 -0
index 4cf7d9a950d7..c01ea505ee7c 100644
@@ -1017,6 +1017,8 @@ static int omap_dma_resume(struct omap_chan *c)
 		return -EINVAL;
 
 	if (c->paused) {
+		mb();
+
 		omap_dma_start(c, c->desc);
 		c->paused = false;
 	}
Signature · 1 line
2.1.0
#3 lore raw
In reply to Peter Ujfalusi

Vinod,

Quoted 6 lines · Peter Ujfalusi

Hi,

Changes since v2:
- fix typo in patch two
- Acked-by added from Russell

Quoted 7 lines

When the audio is paused/resumed (application paused the sream or board suspend) the audio was only playing back one period worth of data and then stops because the omap_dam_stop() clears the link configuration and it is not restored in start.

Also add memory barrier call to resume path since this could happen right after coming out from suspend.

Would it be possible to queue this two patch for 3.17?
This stop/start issue affects not only board suspend/resume, but in all cases when application pauses the stream as well when we have underrun in ALSA which would not trigger a full stop and start of audio.

Thanks,
Péter

Quoted 10 lines

Regards,
Peter
---
Peter Ujfalusi (2):
dmaengine: omap-dma: Add memory barrier to dma_resume path
dmaengine: omap-dma: Restore the CLINK_CTRL in resume path

 drivers/dma/omap-dma.c | 5 +++++
 1 file changed, 5 insertions(+)
Applied
#4 lore raw
In reply to Peter Ujfalusi
Quoted 6 lines · Peter Ujfalusi

Hi,

Changes since v2:
- fix typo in patch two
- Acked-by added from Russell

Quoted 7 lines

When the audio is paused/resumed (application paused the sream or board suspend) the audio was only playing back one period worth of data and then stops because the omap_dam_stop() clears the link configuration and it is not restored in start.

Also add memory barrier call to resume path since this could happen right after coming out from suspend.

Applied, thanks

Signature · 1 line
~Vinod