ASoC: rockchip: add support for sram audio buffer

This patch force the use of sram buffer for pcm buffer,
default is disabled.

Change-Id: I2e6936e1071347f767c67066126b22e39fb477c5
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
This commit is contained in:
Sugar Zhang
2018-04-23 16:45:54 +08:00
committed by Tao Huang
parent 57ef690be6
commit d45d93b7e1
3 changed files with 13 additions and 0 deletions

View File

@@ -192,6 +192,9 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
snd_malloc_dev_iram(dmab, size);
if (dmab->area)
break;
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
break;
#endif
/* Internal memory might have limited size and no enough space,
* so if we fail to malloc, try to fetch memory traditionally.
*/

View File

@@ -6,6 +6,13 @@ config SND_SOC_ROCKCHIP
the Rockchip SoCs' Audio interfaces. You will also need to
select the audio interfaces to support below.
config SND_SOC_ROCKCHIP_FORCE_SRAM
bool "Rockchip force using sram buffer"
def_bool n
help
Say Y if you want to force using sram buffer for pcm buffer,
but the sram size is limited.
config SND_SOC_ROCKCHIP_I2S
tristate "Rockchip I2S Device Driver"
depends on CLKDEV_LOOKUP && SND_SOC_ROCKCHIP

View File

@@ -267,6 +267,9 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
max_buffer_size = SIZE_MAX;
}
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
prealloc_buffer_size = 32 * 1024;
#endif
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
substream = rtd->pcm->streams[i].substream;