Skip to contentSkip to conversation

ASoC: Flush Samsung DMA on free

PATCH In review Mark Brown 2 participants 3 messages Sep 20, 2011 – Sep 27, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Flush Samsung DMA on free

Ever since it was written the Samsung DMA driver has had a TODO in the hw_free() function wondering if we need to flush the DMA buffers. Up until now the answer has been no but with the recent improvements Boojin has done to the DMA infrastructure for the Samsung port the answer has changed to yes for at least S3C6410 systems.

If we don't then when we next prepare() the channel the API will get confused trying to run callbacks on the transfers hanging around from the previous time the stream was open and oops.

---

Kukjin, this should probably get added to your branch assuming it's OK for other CPUs.

 sound/soc/samsung/dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/samsung/dma.c +1 -1
index 851346f..2d622b6 100644
@@ -198,10 +198,10 @@ static int dma_hw_free(struct snd_pcm_substream *substream)
 
 	pr_debug("Entered %s\n", __func__);
 
-	/* TODO - do we need to ensure DMA flushed */
 	snd_pcm_set_runtime_buffer(substream, NULL);
 
 	if (prtd->params) {
+		prtd->params->ops->flush(prtd->params->ch);
 		prtd->params->ops->release(prtd->params->ch,
 					prtd->params->client);
 		prtd->params = NULL;
Signature · 1 line
1.7.6.3

A message that is not in the archive (sent off-list or not yet received): 005e01cc7853$7a3d5400$6eb7fc00$%[email protected]

#2 lore raw
Quoted 17 lines · Boojin Kim
Quoted 14 lines · Mark Brown

Ever since it was written the Samsung DMA driver has had a TODO in the hw_free() function wondering if we need to flush the DMA buffers. Up until
now the answer has been no but with the recent improvements Boojin has done to the DMA infrastructure for the Samsung port the answer has changed
to yes for at least S3C6410 systems.

If we don't then when we next prepare() the channel the API will get confused trying to run callbacks on the transfers hanging around from the
previous time the stream was open and oops.

Quoted 13 lines
Quoted 1 line

Your patch give good effect to all Samsung SoCs.
Thanks a lot.

Quoted 5 lines

---

Kukjin, this should probably get added to your branch assuming it's OK for other CPUs.

Looks ok to me, will apply.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

Quoted 22 lines
Quoted 22 lines
 sound/soc/samsung/dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/samsung/dma.c +1 -1
index 851346f..2d622b6 100644
@@ -198,10 +198,10 @@ static int dma_hw_free(struct snd_pcm_substream
 *substream)
 
 	pr_debug("Entered %s\n", __func__);
 
-	/* TODO - do we need to ensure DMA flushed */
 	snd_pcm_set_runtime_buffer(substream, NULL);
 
 	if (prtd->params) {
+		prtd->params->ops->flush(prtd->params->ch);
 		prtd->params->ops->release(prtd->params->ch,
 					prtd->params->client);

prtd->params = NULL;
--
1.7.6.3

#3 lore raw
In reply to Mark Brown
Quoted 11 lines · Mark Brown

Ever since it was written the Samsung DMA driver has had a TODO in the hw_free() function wondering if we need to flush the DMA buffers. Up until now the answer has been no but with the recent improvements Boojin has done to the DMA infrastructure for the Samsung port the answer has changed to yes for at least S3C6410 systems.

If we don't then when we next prepare() the channel the API will get confused trying to run callbacks on the transfers hanging around from the previous time the stream was open and oops.

Quoted 6 lines

---

Kukjin, this should probably get added to your branch assuming it's OK for other CPUs.

Looks ok to me, applied.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

Quoted 22 lines
 sound/soc/samsung/dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/samsung/dma.c +1 -1
index 851346f..2d622b6 100644
@@ -198,10 +198,10 @@ static int dma_hw_free(struct snd_pcm_substream
 *substream)
 
 	pr_debug("Entered %s\n", __func__);
 
-	/* TODO - do we need to ensure DMA flushed */
 	snd_pcm_set_runtime_buffer(substream, NULL);
 
 	if (prtd->params) {
+		prtd->params->ops->flush(prtd->params->ch);
 		prtd->params->ops->release(prtd->params->ch,
 					prtd->params->client);

prtd->params = NULL;
--
1.7.6.3