Skip to contentSkip to conversation

Convert davinci ASoC to genalloc SRAM

PATCH In review Matt Porter 4 participants 12 messages Oct 11, 2012 – Oct 18, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover Convert davinci ASoC to genalloc SRAM

Changes since v1:
- Rebased against uio_pruss/genalloc series v4 patches, requiring another header to be included.

This series converts davinci ASoC to use genalloc and enables that support on DA850. It applies to mainline on top of the uio_pruss/genalloc series [1] which allows DaVinci to provide a gen_pool via pdata for driver use.

I've tested this on the AM180x EVM. Note that prior to this, the SRAM paths in the driver were completely unused. I've only enabled ping-pong buffering on the platform I can test as it's best to allow those with DM644x and similar platforms to set the playback/capture sram size to something that's known to work for them.

[1] https://lkml.org/lkml/2012/10/5/425

Matt Porter (2):
ASoC: davinci: replace private sram api with genalloc
ARM: davinci: enable SRAM ping ping buffering on DA850

 arch/arm/mach-davinci/board-da850-evm.c   |   25 +++++++++++++++----------
 include/linux/platform_data/davinci_asp.h |    3 +++
 sound/soc/davinci/davinci-mcasp.c         |    2 ++
 sound/soc/davinci/davinci-pcm.c           |   18 ++++++++++++------
 sound/soc/davinci/davinci-pcm.h           |    2 ++
 5 files changed, 34 insertions(+), 16 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/2 ASoC: davinci: replace private sram api with genalloc

Removes the DaVinci private SRAM API and replaces it with the genalloc API. The SRAM gen_pool is passed in pdata since DaVinci is in the early stages of DT conversion.

---
 include/linux/platform_data/davinci_asp.h |    3 +++
 sound/soc/davinci/davinci-mcasp.c         |    2 ++
 sound/soc/davinci/davinci-pcm.c           |   18 ++++++++++++------
 sound/soc/davinci/davinci-pcm.h           |    2 ++
 4 files changed, 19 insertions(+), 6 deletions(-)
include/linux/platform_data/davinci_asp.h +3 -0
index d0c5825..f3d6e4f 100644
@@ -16,6 +16,8 @@
 #ifndef __DAVINCI_ASP_H
 #define __DAVINCI_ASP_H
 
+#include <linux/genalloc.h>
+
 struct snd_platform_data {
 	u32 tx_dma_offset;
 	u32 rx_dma_offset;
@@ -30,6 +32,7 @@ struct snd_platform_data {
 	unsigned enable_channel_combine:1;
 	unsigned sram_size_playback;
 	unsigned sram_size_capture;
+	struct gen_pool *sram_pool;
 
 	/*
 	 * If McBSP peripheral gets the clock from an external pin,
sound/soc/davinci/davinci-mcasp.c +2 -0
index 714e51e..52194bb 100644
@@ -1098,6 +1098,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_playback;
 	dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
 							mem->start);
@@ -1115,6 +1116,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_capture;
 	dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
 							mem->start);
sound/soc/davinci/davinci-pcm.c +12 -6
index 93ea3bf..d2cc169 100644
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
+#include <linux/genalloc.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -23,7 +24,6 @@
 #include <sound/soc.h>
 
 #include <asm/dma.h>
-#include <mach/sram.h>
 
 #include "davinci-pcm.h"
 
@@ -259,7 +259,8 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
 	}
 }
 
-static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
+static int allocate_sram(struct snd_pcm_substream *substream,
+		struct gen_pool *sram_pool, unsigned size,
 		struct snd_pcm_hardware *ppcm)
 {
 	struct snd_dma_buffer *buf = &substream->dma_buffer;
@@ -271,9 +272,10 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
 		return 0;
 
 	ppcm->period_bytes_max = size;
-	iram_virt = sram_alloc(size, &iram_phys);
+	iram_virt = (void *)gen_pool_alloc(sram_pool, size);
 	if (!iram_virt)
 		goto exit1;
+	iram_phys = gen_pool_virt_to_phys(sram_pool, (unsigned)iram_virt);
 	iram_dma = kzalloc(sizeof(*iram_dma), GFP_KERNEL);
 	if (!iram_dma)
 		goto exit2;
@@ -285,7 +287,7 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
 	return 0;
 exit2:
 	if (iram_virt)
-		sram_free(iram_virt, size);
+		gen_pool_free(sram_pool, (unsigned)iram_virt, size);
 exit1:
 	return -ENOMEM;
 }
@@ -676,7 +678,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream)
 
 	ppcm = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
 			&pcm_hardware_playback : &pcm_hardware_capture;
-	allocate_sram(substream, params->sram_size, ppcm);
+	allocate_sram(substream, params->sram_pool, params->sram_size, ppcm);
 	snd_soc_set_runtime_hwparams(substream, ppcm);
 	/* ensure that buffer size is a multiple of period size */
 	ret = snd_pcm_hw_constraint_integer(runtime,
@@ -819,7 +821,11 @@ static void davinci_pcm_free(struct snd_pcm *pcm)
 		buf->area = NULL;
 		iram_dma = buf->private_data;
 		if (iram_dma) {
-			sram_free(iram_dma->area, iram_dma->bytes);
+			struct davinci_runtime_data *prtd =
+				substream->runtime->private_data;
+			struct gen_pool *sram_pool = prtd->params->sram_pool;
+			gen_pool_free(sram_pool, (unsigned)iram_dma->area,
+				      iram_dma->bytes);
 			kfree(iram_dma);
 		}
 	}
sound/soc/davinci/davinci-pcm.h +2 -0
index fc4d01c..b6ef703 100644
@@ -12,6 +12,7 @@
 #ifndef _DAVINCI_PCM_H
 #define _DAVINCI_PCM_H
 
+#include <linux/genalloc.h>
 #include <linux/platform_data/davinci_asp.h>
 #include <mach/edma.h>
 
@@ -20,6 +21,7 @@ struct davinci_pcm_dma_params {
 	unsigned short acnt;
 	dma_addr_t dma_addr;		/* device physical address for DMA */
 	unsigned sram_size;
+	struct gen_pool *sram_pool;	/* SRAM gen_pool for ping pong */
 	enum dma_event_q asp_chan_q;	/* event queue number for ASP channel */
 	enum dma_event_q ram_chan_q;	/* event queue number for RAM channel */
 	unsigned char data_type;	/* xfer data type */
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v2 1/2] ASoC: davinci: replace private sram api with genalloc

Hi Matt,

Quoted 84 lines · Matt Porter

Removes the DaVinci private SRAM API and replaces it with the genalloc API. The SRAM gen_pool is passed in pdata since DaVinci is in the early stages of DT conversion.

---
 include/linux/platform_data/davinci_asp.h |    3 +++
 sound/soc/davinci/davinci-mcasp.c         |    2 ++
 sound/soc/davinci/davinci-pcm.c           |   18 ++++++++++++------
 sound/soc/davinci/davinci-pcm.h           |    2 ++
 4 files changed, 19 insertions(+), 6 deletions(-)
include/linux/platform_data/davinci_asp.h +3 -0
index d0c5825..f3d6e4f 100644
@@ -16,6 +16,8 @@
 #ifndef __DAVINCI_ASP_H
 #define __DAVINCI_ASP_H
 
+#include <linux/genalloc.h>
+
 struct snd_platform_data {
 	u32 tx_dma_offset;
 	u32 rx_dma_offset;
@@ -30,6 +32,7 @@ struct snd_platform_data {
 	unsigned enable_channel_combine:1;
 	unsigned sram_size_playback;
 	unsigned sram_size_capture;
+	struct gen_pool *sram_pool;
 
 	/*
 	 * If McBSP peripheral gets the clock from an external pin,
sound/soc/davinci/davinci-mcasp.c +2 -0
index 714e51e..52194bb 100644
@@ -1098,6 +1098,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_playback;
 	dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
 							mem->start);
@@ -1115,6 +1116,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_capture;
 	dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
 							mem->start);
sound/soc/davinci/davinci-pcm.c +3 -2
index 93ea3bf..d2cc169 100644
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
+#include <linux/genalloc.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -23,7 +24,6 @@
 #include <sound/soc.h>
 
 #include <asm/dma.h>
-#include <mach/sram.h>
 
 #include "davinci-pcm.h"
 
@@ -259,7 +259,8 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
 	}
 }
 
-static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
+static int allocate_sram(struct snd_pcm_substream *substream,
+		struct gen_pool *sram_pool, unsigned size,
 		struct snd_pcm_hardware *ppcm)
 {
 	struct snd_dma_buffer *buf = &substream->dma_buffer;

sound/soc/davinci/davinci-pcm.c static int allocate_sram(struct snd_pcm_substream *substream, unsigned size, · line 275

Quoted 5 lines
sound/soc/davinci/davinci-pcm.c +1 -1
@@ -271,9 +272,10 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
 		return 0;
 
 	ppcm->period_bytes_max = size;
-	iram_virt = sram_alloc(size, &iram_phys);
+	iram_virt = (void *)gen_pool_alloc(sram_pool, size);

Did you see my patch that stubs out all functions that use gen_pool_* functions for !CONFIG_GENERIC_ALLOCATOR configs? It should still apply nicely on top of this one, and is necessary for AM33xx-only builds.

Daniel

Quoted 58 lines
sound/soc/davinci/davinci-pcm.c +8 -3
 	if (!iram_virt)
 		goto exit1;
+	iram_phys = gen_pool_virt_to_phys(sram_pool, (unsigned)iram_virt);
 	iram_dma = kzalloc(sizeof(*iram_dma), GFP_KERNEL);
 	if (!iram_dma)
 		goto exit2;
@@ -285,7 +287,7 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
 	return 0;
 exit2:
 	if (iram_virt)
-		sram_free(iram_virt, size);
+		gen_pool_free(sram_pool, (unsigned)iram_virt, size);
 exit1:
 	return -ENOMEM;
 }
@@ -676,7 +678,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream)
 
 	ppcm = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
 			&pcm_hardware_playback : &pcm_hardware_capture;
-	allocate_sram(substream, params->sram_size, ppcm);
+	allocate_sram(substream, params->sram_pool, params->sram_size, ppcm);
 	snd_soc_set_runtime_hwparams(substream, ppcm);
 	/* ensure that buffer size is a multiple of period size */
 	ret = snd_pcm_hw_constraint_integer(runtime,
@@ -819,7 +821,11 @@ static void davinci_pcm_free(struct snd_pcm *pcm)
 		buf->area = NULL;
 		iram_dma = buf->private_data;
 		if (iram_dma) {
-			sram_free(iram_dma->area, iram_dma->bytes);
+			struct davinci_runtime_data *prtd =
+				substream->runtime->private_data;
+			struct gen_pool *sram_pool = prtd->params->sram_pool;
+			gen_pool_free(sram_pool, (unsigned)iram_dma->area,
+				      iram_dma->bytes);
 			kfree(iram_dma);
 		}
 	}
sound/soc/davinci/davinci-pcm.h +2 -0
index fc4d01c..b6ef703 100644
@@ -12,6 +12,7 @@
 #ifndef _DAVINCI_PCM_H
 #define _DAVINCI_PCM_H
 
+#include <linux/genalloc.h>
 #include <linux/platform_data/davinci_asp.h>
 #include <mach/edma.h>
 
@@ -20,6 +21,7 @@ struct davinci_pcm_dma_params {
 	unsigned short acnt;
 	dma_addr_t dma_addr;		/* device physical address for DMA */
 	unsigned sram_size;
+	struct gen_pool *sram_pool;	/* SRAM gen_pool for ping pong */
 	enum dma_event_q asp_chan_q;	/* event queue number for ASP channel */
 	enum dma_event_q ram_chan_q;	/* event queue number for RAM channel */
 	unsigned char data_type;	/* xfer data type */
#3 lore raw

Re: [PATCH v2 1/2] ASoC: davinci: replace private sram api with genalloc

Quoted 89 lines · Daniel Mack

Hi Matt,

Quoted 86 lines · Matt Porter

Removes the DaVinci private SRAM API and replaces it with the genalloc API. The SRAM gen_pool is passed in pdata since DaVinci is in the early stages of DT conversion.

---
 include/linux/platform_data/davinci_asp.h |    3 +++
 sound/soc/davinci/davinci-mcasp.c         |    2 ++
 sound/soc/davinci/davinci-pcm.c           |   18 ++++++++++++------
 sound/soc/davinci/davinci-pcm.h           |    2 ++
 4 files changed, 19 insertions(+), 6 deletions(-)
include/linux/platform_data/davinci_asp.h +3 -0
index d0c5825..f3d6e4f 100644
@@ -16,6 +16,8 @@
 #ifndef __DAVINCI_ASP_H
 #define __DAVINCI_ASP_H
 
+#include <linux/genalloc.h>
+
 struct snd_platform_data {
 	u32 tx_dma_offset;
 	u32 rx_dma_offset;
@@ -30,6 +32,7 @@ struct snd_platform_data {
 	unsigned enable_channel_combine:1;
 	unsigned sram_size_playback;
 	unsigned sram_size_capture;
+	struct gen_pool *sram_pool;
 
 	/*
 	 * If McBSP peripheral gets the clock from an external pin,
sound/soc/davinci/davinci-mcasp.c +2 -0
index 714e51e..52194bb 100644
@@ -1098,6 +1098,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_playback;
 	dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
 							mem->start);
@@ -1115,6 +1116,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_capture;
 	dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
 							mem->start);
sound/soc/davinci/davinci-pcm.c +3 -2
index 93ea3bf..d2cc169 100644
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
+#include <linux/genalloc.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -23,7 +24,6 @@
 #include <sound/soc.h>
 
 #include <asm/dma.h>
-#include <mach/sram.h>
 
 #include "davinci-pcm.h"
 
@@ -259,7 +259,8 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
 	}
 }
 
-static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
+static int allocate_sram(struct snd_pcm_substream *substream,
+		struct gen_pool *sram_pool, unsigned size,
 		struct snd_pcm_hardware *ppcm)
 {
 	struct snd_dma_buffer *buf = &substream->dma_buffer;
@@ -271,9 +272,10 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
 		return 0;
 
Quoted 7 lines

sound/soc/davinci/davinci-pcm.c static int allocate_sram(struct snd_pcm_substream *substream, unsigned size, · line 275

Quoted 3 lines
sound/soc/davinci/davinci-pcm.c +1 -1
 	ppcm->period_bytes_max = size;
-	iram_virt = sram_alloc(size, &iram_phys);
+	iram_virt = (void *)gen_pool_alloc(sram_pool, size);

Did you see my patch that stubs out all functions that use gen_pool_* functions for !CONFIG_GENERIC_ALLOCATOR configs? It should still apply nicely on top of this one, and is necessary for AM33xx-only builds.

Sorry, I've had the last week of list traffic go to /dev/null. Catching up now and I do see that. I'm assuming that will all be in your updated series with these patches squashed in?

-Matt

Quoted 63 lines
Quoted 51 lines
sound/soc/davinci/davinci-pcm.c +8 -3
 	if (!iram_virt)
 		goto exit1;
+	iram_phys = gen_pool_virt_to_phys(sram_pool, (unsigned)iram_virt);
 	iram_dma = kzalloc(sizeof(*iram_dma), GFP_KERNEL);
 	if (!iram_dma)
 		goto exit2;
@@ -285,7 +287,7 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
 	return 0;
 exit2:
 	if (iram_virt)
-		sram_free(iram_virt, size);
+		gen_pool_free(sram_pool, (unsigned)iram_virt, size);
 exit1:
 	return -ENOMEM;
 }
@@ -676,7 +678,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream)
 
 	ppcm = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
 			&pcm_hardware_playback : &pcm_hardware_capture;
-	allocate_sram(substream, params->sram_size, ppcm);
+	allocate_sram(substream, params->sram_pool, params->sram_size, ppcm);
 	snd_soc_set_runtime_hwparams(substream, ppcm);
 	/* ensure that buffer size is a multiple of period size */
 	ret = snd_pcm_hw_constraint_integer(runtime,
@@ -819,7 +821,11 @@ static void davinci_pcm_free(struct snd_pcm *pcm)
 		buf->area = NULL;
 		iram_dma = buf->private_data;
 		if (iram_dma) {
-			sram_free(iram_dma->area, iram_dma->bytes);
+			struct davinci_runtime_data *prtd =
+				substream->runtime->private_data;
+			struct gen_pool *sram_pool = prtd->params->sram_pool;
+			gen_pool_free(sram_pool, (unsigned)iram_dma->area,
+				      iram_dma->bytes);
 			kfree(iram_dma);
 		}
 	}
sound/soc/davinci/davinci-pcm.h +1 -0
index fc4d01c..b6ef703 100644
@@ -12,6 +12,7 @@
 #ifndef _DAVINCI_PCM_H
 #define _DAVINCI_PCM_H
 
+#include <linux/genalloc.h>
 #include <linux/platform_data/davinci_asp.h>
 #include <mach/edma.h>
 

sound/soc/davinci/davinci-pcm.h struct davinci_pcm_dma_params { · line 27

Quoted 7 lines
sound/soc/davinci/davinci-pcm.h +1 -0
@@ -20,6 +21,7 @@ struct davinci_pcm_dma_params {
 	unsigned short acnt;
 	dma_addr_t dma_addr;		/* device physical address for DMA */
 	unsigned sram_size;
+	struct gen_pool *sram_pool;	/* SRAM gen_pool for ping pong */
 	enum dma_event_q asp_chan_q;	/* event queue number for ASP channel */
 	enum dma_event_q ram_chan_q;	/* event queue number for RAM channel */
 	unsigned char data_type;	/* xfer data type */

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

#4 lore raw

Re: [PATCH v2 1/2] ASoC: davinci: replace private sram api with genalloc

Quoted 98 lines · Matt Porter
Quoted 89 lines · Daniel Mack

Hi Matt,

Quoted 86 lines · Matt Porter

Removes the DaVinci private SRAM API and replaces it with the genalloc API. The SRAM gen_pool is passed in pdata since DaVinci is in the early stages of DT conversion.

---
 include/linux/platform_data/davinci_asp.h |    3 +++
 sound/soc/davinci/davinci-mcasp.c         |    2 ++
 sound/soc/davinci/davinci-pcm.c           |   18 ++++++++++++------
 sound/soc/davinci/davinci-pcm.h           |    2 ++
 4 files changed, 19 insertions(+), 6 deletions(-)
include/linux/platform_data/davinci_asp.h +3 -0
index d0c5825..f3d6e4f 100644
@@ -16,6 +16,8 @@
 #ifndef __DAVINCI_ASP_H
 #define __DAVINCI_ASP_H
 
+#include <linux/genalloc.h>
+
 struct snd_platform_data {
 	u32 tx_dma_offset;
 	u32 rx_dma_offset;
@@ -30,6 +32,7 @@ struct snd_platform_data {
 	unsigned enable_channel_combine:1;
 	unsigned sram_size_playback;
 	unsigned sram_size_capture;
+	struct gen_pool *sram_pool;
 
 	/*
 	 * If McBSP peripheral gets the clock from an external pin,
sound/soc/davinci/davinci-mcasp.c +2 -0
index 714e51e..52194bb 100644
@@ -1098,6 +1098,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_playback;
 	dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
 							mem->start);
@@ -1115,6 +1116,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
 	dma_data->asp_chan_q = pdata->asp_chan_q;
 	dma_data->ram_chan_q = pdata->ram_chan_q;
+	dma_data->sram_pool = pdata->sram_pool;
 	dma_data->sram_size = pdata->sram_size_capture;
 	dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
 							mem->start);
sound/soc/davinci/davinci-pcm.c +3 -2
index 93ea3bf..d2cc169 100644
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
+#include <linux/genalloc.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -23,7 +24,6 @@
 #include <sound/soc.h>
 
 #include <asm/dma.h>
-#include <mach/sram.h>
 
 #include "davinci-pcm.h"
 
@@ -259,7 +259,8 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
 	}
 }
 
-static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
+static int allocate_sram(struct snd_pcm_substream *substream,
+		struct gen_pool *sram_pool, unsigned size,
 		struct snd_pcm_hardware *ppcm)
 {
 	struct snd_dma_buffer *buf = &substream->dma_buffer;
@@ -271,9 +272,10 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
 		return 0;
 
Quoted 7 lines

sound/soc/davinci/davinci-pcm.c static int allocate_sram(struct snd_pcm_substream *substream, unsigned size, · line 275

Quoted 3 lines
sound/soc/davinci/davinci-pcm.c +1 -1
 	ppcm->period_bytes_max = size;
-	iram_virt = sram_alloc(size, &iram_phys);
+	iram_virt = (void *)gen_pool_alloc(sram_pool, size);

Did you see my patch that stubs out all functions that use gen_pool_* functions for !CONFIG_GENERIC_ALLOCATOR configs? It should still apply nicely on top of this one, and is necessary for AM33xx-only builds.

Quoted 3 lines

Sorry, I've had the last week of list traffic go to /dev/null. Catching up now and I do see that. I'm assuming that will all be in your updated series with these patches squashed in?

Yes, exactly. I already sent them out yesterday.

Daniel

#5 lore raw

PATCH v2 2/2 ARM: davinci: enable SRAM ping ping buffering on DA850

In reply to Matt Porter

Passes the DA850 shared SRAM gen_pool to the McASP driver and enables the ping-pong buffer DMA support.

---
 arch/arm/mach-davinci/board-da850-evm.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +15 -10
index 9e7f954..df87866 100644
@@ -41,6 +41,7 @@
 #include <mach/cp_intc.h>
 #include <mach/da8xx.h>
 #include <mach/mux.h>
+#include <mach/sram.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -749,16 +750,19 @@ static u8 da850_iis_serializer_direction[] = {
 };
 
 static struct snd_platform_data da850_evm_snd_data = {
-	.tx_dma_offset	= 0x2000,
-	.rx_dma_offset	= 0x2000,
-	.op_mode	= DAVINCI_MCASP_IIS_MODE,
-	.num_serializer	= ARRAY_SIZE(da850_iis_serializer_direction),
-	.tdm_slots	= 2,
-	.serial_dir	= da850_iis_serializer_direction,
-	.asp_chan_q	= EVENTQ_0,
-	.version	= MCASP_VERSION_2,
-	.txnumevt	= 1,
-	.rxnumevt	= 1,
+	.tx_dma_offset		= 0x2000,
+	.rx_dma_offset		= 0x2000,
+	.op_mode		= DAVINCI_MCASP_IIS_MODE,
+	.num_serializer		= ARRAY_SIZE(da850_iis_serializer_direction),
+	.tdm_slots		= 2,
+	.serial_dir		= da850_iis_serializer_direction,
+	.asp_chan_q		= EVENTQ_0,
+	.ram_chan_q		= EVENTQ_1,
+	.version		= MCASP_VERSION_2,
+	.txnumevt		= 1,
+	.rxnumevt		= 1,
+	.sram_size_playback	= SZ_8K,
+	.sram_size_capture	= SZ_8K,
 };
 
 static const short da850_evm_mcasp_pins[] __initconst = {
@@ -1333,6 +1337,7 @@ static __init void da850_evm_init(void)
 		pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
 				ret);
 
+	da850_evm_snd_data.sram_pool = sram_get_gen_pool();
 	da8xx_register_mcasp(0, &da850_evm_snd_data);
 
 	ret = davinci_cfg_reg_list(da850_lcdcntl_pins);
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [PATCH v2 2/2] ARM: davinci: enable SRAM ping ping buffering on DA850

Hello.

Quoted 2 lines · Matt Porter

Passes the DA850 shared SRAM gen_pool to the McASP driver and enables the ping-pong buffer DMA support.

Here "ping-pong is correct but the subject have a typo.

Quoted 2 lines

WBR, Sergei

#7 lore raw

Re: [PATCH v2 2/2] ARM: davinci: enable SRAM ping ping buffering on DA850

Quoted 8 lines · Sergei Shtylyov

Hello.

Quoted 2 lines · Matt Porter

Passes the DA850 shared SRAM gen_pool to the McASP driver and enables the ping-pong buffer DMA support.

Here "ping-pong is correct but the subject have a typo.

Thanks.

Daniel: can you correct this when you squash these into your series?

-Matt

#8 lore raw
In reply to Matt Porter
Quoted 4 lines · Matt Porter

This series converts davinci ASoC to use genalloc and enables that support on DA850. It applies to mainline on top of the uio_pruss/genalloc series [1] which allows DaVinci to provide a gen_pool via pdata for driver use.

I tried to apply these patches but patch 2 doesn't apply against v3.7-rc1 I guess due to the series you mention. What's the plan for merging that series? It'd also be good to get Daniel's patch squashed in.

#9 lore raw
Quoted 11 lines · Mark Brown
Quoted 4 lines · Matt Porter

This series converts davinci ASoC to use genalloc and enables that support on DA850. It applies to mainline on top of the uio_pruss/genalloc series [1] which allows DaVinci to provide a gen_pool via pdata for driver use.

I tried to apply these patches but patch 2 doesn't apply against v3.7-rc1 I guess due to the series you mention. What's the plan for merging that series? It'd also be good to get Daniel's patch squashed in.

I'll resend the rebased patches from my 3.7-rc1 development branch with my patch squashed into 1/2. Matt, hope you're ok with that?

Thanks,
Daniel

#10 lore raw
Quoted 8 lines · Daniel Mack
Quoted 7 lines · Mark Brown
Quoted 4 lines · Matt Porter

This series converts davinci ASoC to use genalloc and enables that support on DA850. It applies to mainline on top of the uio_pruss/genalloc series [1] which allows DaVinci to provide a gen_pool via pdata for driver use.

Quoted 7 lines
Quoted 4 lines

I tried to apply these patches but patch 2 doesn't apply against v3.7-rc1 I guess due to the series you mention. What's the plan for merging that series? It'd also be good to get Daniel's patch squashed in.

I'll resend the rebased patches from my 3.7-rc1 development branch with my patch squashed into 1/2. Matt, hope you're ok with that?

Yes, thanks.

-Matt

#11 lore raw
In reply to Mark Brown
Quoted 11 lines · Mark Brown
Quoted 4 lines · Matt Porter

This series converts davinci ASoC to use genalloc and enables that support on DA850. It applies to mainline on top of the uio_pruss/genalloc series [1] which allows DaVinci to provide a gen_pool via pdata for driver use.

I tried to apply these patches but patch 2 doesn't apply against v3.7-rc1 I guess due to the series you mention. What's the plan for merging that series? It'd also be good to get Daniel's patch squashed in.

I will ping Hans about the uio_pruss driver portion. Sekhar was waiting on a ack for that before applying all of the supporting genalloc patches for mach-davinci/

-Matt