[Sound-open-firmware] [PATCH 2/2] buffer: add handle to different buffer type requirement from IPC

Keyon Jie yang.jie at linux.intel.com
Tue Jan 30 08:29:30 CET 2018


It may require to allocate component buffer on specific region,
e.g. DMA region, here add handle to dirrerent requirement form
topology/IPC.

Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
 src/audio/buffer.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/audio/buffer.c b/src/audio/buffer.c
index 0acf660..e41f14f 100644
--- a/src/audio/buffer.c
+++ b/src/audio/buffer.c
@@ -49,6 +49,7 @@
 struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc)
 {
 	struct comp_buffer *buffer;
+	int bflags = RFLAGS_NONE;
 
 	trace_buffer("new");
 
@@ -66,7 +67,16 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc)
 		return NULL;
 	}
 
-	buffer->addr = rballoc(RZONE_RUNTIME, RFLAGS_NONE, desc->size);
+	switch (desc->type) {
+	case SOF_BUFF_DMA:
+		bflags = RFLAGS_DMA;
+		break;
+	case SOF_BUFF_GENERAL:
+	default:
+		bflags = RFLAGS_NONE;
+	}
+
+	buffer->addr = rballoc(RZONE_RUNTIME, bflags, desc->size);
 	if (buffer->addr == NULL) {
 		rfree(buffer);
 		trace_buffer_error("ebm");
-- 
2.11.0



More information about the Sound-open-firmware mailing list