Skip to contentSkip to conversation

ASoC: davinci: ping-pong buffers for mcasp on da850evm

PATCH Applied Ben Gardiner 4 participants 8 messages May 18, 2011 – May 20, 2011 1 message not in the archive

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

cover ASoC: davinci: ping-pong buffers for mcasp on da850evm

davinci-i2s enables the use of ping-pong buffers by copying the sram sizes specified by platform data into the dma params used by davinci-pcm.

This patch series first implements that same behaviour in davinic-mcasp and then specified sram sizes and eventq's for da850evm.

To achieve the use of ping-pong buffers at runtime this patch depends also on the conversion of da850's SRAM allocator to the "Share RAM" region from the "ARM Local RAM" region -- originally proposed by Subhasish Ghosh[1] and recently reposted by myself [2].

This is because the "ARM Local RAM" region currently used by the da850 SRAM allocator is not addressable by the EDMA. The resulting behaviour, when ping-pong buffers are used by davinci-pcm, is that playback produces silence and capture acquires silence.

However, there is no change in behaviour for da850evm build with the in-tree defconfig since suspend allocates SRAM which prevents a successful allocation of 8K by davinci-pcm and thus the behaviour falls back to the usual scheme.

In the case of da850evm builds where CONFIG_SUSPEND is not set, playback will produce silence and capture will acquire silence until such time as the patches to change the da850 SRAM allocator to the "Shared RAM" region are merged.

[1] http://article.gmane.org/gmane.linux.kernel/1098928
[2] http://article.gmane.org/gmane.linux.ports.arm.kernel/117261

Ben Gardiner (2):
ASoC: davinci-mcasp: enable ping-pong SRAM buffers
davinci: da850evm: enable mcasp ping-pong buffers and eventq's

 arch/arm/mach-davinci/board-da850-evm.c |    5 ++++-
 sound/soc/davinci/davinci-mcasp.c       |    2 ++
 2 files changed, 6 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/2 ASoC: davinci-mcasp: enable ping-pong SRAM buffers

The davinci-i2s driver copies the platform data for playback and capture sram sizes which is in turn used by davinci-pcm to allocate ping-pong buffers.

Copy also the platform data in davinci-mcasp probe.

---
 sound/soc/davinci/davinci-mcasp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sound/soc/davinci/davinci-mcasp.c +2 -0
index 4ddc6d3..8566238 100644
@@ -909,6 +909,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_size = pdata->sram_size_playback;
 	dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
 							mem->start);
 
@@ -925,6 +926,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_size = pdata->sram_size_capture;
 	dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
 							mem->start);
 
Signature · 1 line
1.7.4.1
Applied
#2 lore raw

Re: [PATCH 1/2] ASoC: davinci-mcasp: enable ping-pong SRAM buffers

Quoted 7 lines · Ben Gardiner

The davinci-i2s driver copies the platform data for playback and capture sram sizes which is in turn used by davinci-pcm to allocate ping-pong buffers.

Copy also the platform data in davinci-mcasp probe.

Applied, thanks.

#3 lore raw

PATCH 2/2 davinci: da850evm: enable mcasp ping-pong bufs and evq's

In reply to Ben Gardiner

The davinci-mcasp driver will copy the platform data specified sram sizes and eventq's.

Set the event queues and sram sizes for da850. 8K SRAM buffers are selected because it is the minimum that resulted in the same period size when testing 48KHz S16_LE stereo. Event queues 0 and 1 are assigned to match those specified by Troy Kisky in his introduction of ping-pong buffers for dm644x.

---
 arch/arm/mach-davinci/board-da850-evm.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +4 -1
index a7b41bf..2ee1a6f 100644
@@ -722,10 +722,13 @@ static struct snd_platform_data da850_evm_snd_data = {
 	.num_serializer	= ARRAY_SIZE(da850_iis_serializer_direction),
 	.tdm_slots	= 2,
 	.serial_dir	= da850_iis_serializer_direction,
-	.asp_chan_q	= EVENTQ_1,
+	.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 = {
Signature · 1 line
1.7.4.1
#4 lore raw

Re: [PATCH 2/2] davinci: da850evm: enable mcasp ping-pong bufs and evq's

Quoted 9 lines · Ben Gardiner

The davinci-mcasp driver will copy the platform data specified sram sizes and eventq's.

Set the event queues and sram sizes for da850. 8K SRAM buffers are selected because it is the minimum that resulted in the same period size when testing 48KHz S16_LE stereo. Event queues 0 and 1 are assigned to match those specified by Troy Kisky in his introduction of ping-pong buffers for dm644x.

Davinci folks, are you OK with this?

A message that is not in the archive (sent off-list or not yet received): 20110519211406.GE18849-yzvPICuk2AATkU/[email protected]

#6 lore raw

RE: [PATCH 2/2] davinci: da850evm: enable mcasp ping-pong bufs and evq's

Hi Mark,

Quoted 4 lines · Mark Brown
Quoted 3 lines · Ben Gardiner

The davinci-mcasp driver will copy the platform data specified sram sizes and eventq's.

Quoted 8 lines
Quoted 6 lines

Set the event queues and sram sizes for da850. 8K SRAM buffers are selected because it is the minimum that resulted in the same period size when testing 48KHz S16_LE stereo. Event queues 0 and 1 are assigned to match those specified by Troy Kisky in his introduction of ping-pong buffers for dm644x.

Davinci folks, are you OK with this?

No, please don't merge this just yet. As Ben mentioned in his cover letter, the default SRAM pool on DA850 is not suitable for Audio transfers. This patch depends on SRAM not being available for audio usage in spite of the platform asking for it. This is liable to break.

The SRAM allocation on DaVinci and OMAP is under a bit of flux and once that is sorted out, this patch should be safe to merge. So, this probably needs to wait for 2.6.41.

Thanks,
Sekhar

#7 lore raw

Re: [PATCH 2/2] davinci: da850evm: enable mcasp ping-pong bufs and evq's

Quoted 16 lines · Sekhar

Hi Mark,

Quoted 4 lines · Mark Brown
Quoted 3 lines · Ben Gardiner

The davinci-mcasp driver will copy the platform data specified sram sizes and eventq's.

Quoted 8 lines
Quoted 6 lines

Set the event queues and sram sizes for da850. 8K SRAM buffers are selected because it is the minimum that resulted in the same period size when testing 48KHz S16_LE stereo. Event queues 0 and 1 are assigned to match those specified by Troy Kisky in his introduction of ping-pong buffers for dm644x.

Davinci folks, are you OK with this?

Quoted 9 lines

No, please don't merge this just yet. As Ben mentioned in his cover letter, the default SRAM pool on DA850 is not suitable for Audio transfers. This patch depends on SRAM not being available for audio usage in spite of the platform asking for it. This is liable to break.

The SRAM allocation on DaVinci and OMAP is under a bit of flux and once that is sorted out, this patch should be safe to merge. So, this probably needs to wait for 2.6.41.

Ok.

Sekhar, Ben, please resend with Acks when the DaVinci depedencies have been merged.

Thanks

Liam

Acked-by on the v1 series
#8 lore raw
In reply to Ben Gardiner
Quoted 28 lines · Ben Gardiner

davinci-i2s enables the use of ping-pong buffers by copying the sram sizes specified by platform data into the dma params used by davinci-pcm.

This patch series first implements that same behaviour in davinic-mcasp and then specified sram sizes and eventq's for da850evm.

To achieve the use of ping-pong buffers at runtime this patch depends also on the conversion of da850's SRAM allocator to the "Share RAM" region from the "ARM Local RAM" region -- originally proposed by Subhasish Ghosh[1] and recently reposted by myself [2].

This is because the "ARM Local RAM" region currently used by the da850 SRAM allocator is not addressable by the EDMA. The resulting behaviour, when ping-pong buffers are used by davinci-pcm, is that playback produces silence and capture acquires silence.

However, there is no change in behaviour for da850evm build with the in-tree defconfig since suspend allocates SRAM which prevents a successful allocation of 8K by davinci-pcm and thus the behaviour falls back to the usual scheme.

In the case of da850evm builds where CONFIG_SUSPEND is not set, playback will produce silence and capture will acquire silence until such time as the patches to change the da850 SRAM allocator to the "Shared RAM" region are merged.

[1] http://article.gmane.org/gmane.linux.kernel/1098928
[2] http://article.gmane.org/gmane.linux.ports.arm.kernel/117261

Quoted 8 lines

Ben Gardiner (2):
ASoC: davinci-mcasp: enable ping-pong SRAM buffers
davinci: da850evm: enable mcasp ping-pong buffers and eventq's

 arch/arm/mach-davinci/board-da850-evm.c |    5 ++++-
 sound/soc/davinci/davinci-mcasp.c       |    2 ++
 2 files changed, 6 insertions(+), 1 deletions(-)

Both