[alsa-devel] [PATCH 0/2] 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(-)
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.
Signed-off-by: Ben Gardiner bengardiner@nanometrics.ca --- sound/soc/davinci/davinci-mcasp.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 4ddc6d3..8566238 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -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);
On Wed, May 18, 2011 at 09:27:45AM -0400, Ben Gardiner wrote:
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.
Signed-off-by: Ben Gardiner bengardiner@nanometrics.ca
Applied, thanks.
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.
Signed-off-by: Ben Gardiner bengardiner@nanometrics.ca --- arch/arm/mach-davinci/board-da850-evm.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index a7b41bf..2ee1a6f 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -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 = {
On Wed, May 18, 2011 at 09:27:46AM -0400, Ben Gardiner wrote:
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.
Signed-off-by: Ben Gardiner bengardiner@nanometrics.ca
Davinci folks, are you OK with this?
On 18/05/11 14:27, Ben Gardiner wrote:
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(-)
Both
Acked-by: Liam Girdwood lrg@ti.com
participants (3)
-
Ben Gardiner
-
Liam Girdwood
-
Mark Brown