Skip to content

Commit d45d93b

Browse files
Sugar Zhangrkhuangtao
authored andcommitted
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>
1 parent 57ef690 commit d45d93b

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

sound/core/memalloc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
192192
snd_malloc_dev_iram(dmab, size);
193193
if (dmab->area)
194194
break;
195+
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
196+
break;
197+
#endif
195198
/* Internal memory might have limited size and no enough space,
196199
* so if we fail to malloc, try to fetch memory traditionally.
197200
*/

sound/soc/rockchip/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ config SND_SOC_ROCKCHIP
66
the Rockchip SoCs' Audio interfaces. You will also need to
77
select the audio interfaces to support below.
88

9+
config SND_SOC_ROCKCHIP_FORCE_SRAM
10+
bool "Rockchip force using sram buffer"
11+
def_bool n
12+
help
13+
Say Y if you want to force using sram buffer for pcm buffer,
14+
but the sram size is limited.
15+
916
config SND_SOC_ROCKCHIP_I2S
1017
tristate "Rockchip I2S Device Driver"
1118
depends on CLKDEV_LOOKUP && SND_SOC_ROCKCHIP

sound/soc/soc-generic-dmaengine-pcm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
267267
max_buffer_size = SIZE_MAX;
268268
}
269269

270+
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
271+
prealloc_buffer_size = 32 * 1024;
272+
#endif
270273

271274
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
272275
substream = rtd->pcm->streams[i].substream;

0 commit comments

Comments
 (0)