Skip to contentSkip to conversation

dmaengine: omap-dma: Fix cyclic suspend/resume

PATCH Superseded Peter Ujfalusi 3 participants 5 messages Sep 16, 2014 dmaengine

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

Hi,

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
#1 lore raw

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

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
#2 lore raw

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

In reply to Peter Ujfalusi

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..e0990c505889 100644
@@ -1019,6 +1019,9 @@ static int omap_dma_resume(struct omap_chan *c)
 	if (c->paused) {
 		mb();
 
+		/* Restore chanel 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
Acked-by Russell King on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] dmaengine: omap-dma: Restore the CLINK_CTRL in resume path

Quoted 8 lines · Peter Ujfalusi

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.

Both of these patches now look good, thanks. For both:

Quoted 21 lines
---
 drivers/dma/omap-dma.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/dma/omap-dma.c +3 -0
index c01ea505ee7c..e0990c505889 100644
@@ -1019,6 +1019,9 @@ static int omap_dma_resume(struct omap_chan *c)
 	if (c->paused) {
 		mb();
 
+		/* Restore chanel 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
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
#4 lore raw

Re: [PATCH v2 2/2] dmaengine: omap-dma: Restore the CLINK_CTRL in resume path

Quoted 26 lines · Russell King - ARM Linux
Quoted 8 lines · Peter Ujfalusi

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.

Both of these patches now look good, thanks. For both:

Quoted 12 lines
---
  drivers/dma/omap-dma.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/dma/omap-dma.c +0 -0
index c01ea505ee7c..e0990c505889 100644
@@ -1019,6 +1019,9 @@ static int omap_dma_resume(struct omap_chan *c)
  	if (c->paused) {
  		mb();
 
Quoted 1 line

drivers/dma/omap-dma.c static int omap_dma_resume(struct omap_chan *c) · line 1022

Quoted 1 line
drivers/dma/omap-dma.c +1 -0
+		/* Restore chanel link register */

Just too bad that the comment seems to have a typo.

Quoted 9 lines
Quoted 8 lines
drivers/dma/omap-dma.c +2 -1
+		omap_dma_chan_write(c, CLNK_CTRL, c->desc->clnk_ctrl);
+
  		omap_dma_start(c, c->desc);
  		c->paused = false;
  	}
--

2.1.0