[Sound-open-firmware] [PATCH] ASoC: SOF: topology: add handle to buffer type
Align with SOFT topology and SOF, add handle to buffer type.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- include/uapi/sound/sof-ipc.h | 7 +++++++ include/uapi/sound/sof-topology.h | 1 + sound/soc/sof/topology.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/uapi/sound/sof-ipc.h b/include/uapi/sound/sof-ipc.h index 741b412545b7..9a81896780ba 100644 --- a/include/uapi/sound/sof-ipc.h +++ b/include/uapi/sound/sof-ipc.h @@ -521,10 +521,17 @@ struct sof_ipc_comp { * Component Buffers */
+/* types of buffer */ +enum sof_buffer_type { + SOF_BUFF_GENERAL = 0, + SOF_BUFF_DMA = 1, /* dma buffer */ +}; + /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */ struct sof_ipc_buffer { struct sof_ipc_comp comp; uint32_t size; /* buffer size in bytes */ + enum sof_buffer_type type; /* buffer type */ } __attribute__((packed));
diff --git a/include/uapi/sound/sof-topology.h b/include/uapi/sound/sof-topology.h index 6fe695c46386..e855ef48fd1a 100644 --- a/include/uapi/sound/sof-topology.h +++ b/include/uapi/sound/sof-topology.h @@ -33,6 +33,7 @@
/* buffers */ #define SOF_TKN_BUF_SIZE 100 +#define SOF_TKN_BUF_TYPE 101
/* DAI */ #define SOF_TKN_DAI_DMAC 151 diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 2d813335f3d2..3f2e9d72fba5 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -150,6 +150,8 @@ static int get_token_dai_type(void *elem ,void *object, u32 offset, u32 size) static const struct sof_topology_token buffer_tokens[] = { {SOF_TKN_BUF_SIZE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, offsetof(struct sof_ipc_buffer, size), 0}, + {SOF_TKN_BUF_TYPE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_buffer, type), 0}, };
/* DAI */ @@ -554,8 +556,8 @@ static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index, sof_parse_tokens(scomp, &buffer, buffer_tokens, ARRAY_SIZE(buffer_tokens), private->array, private->size);
- dev_dbg(sdev->dev, "buffer %s: size %d\n", - swidget->widget->name, buffer.size); + dev_dbg(sdev->dev, "buffer %s: size %d, type %d\n", + swidget->widget->name, buffer.size, buffer.type);
return sof_ipc_tx_message(sdev->ipc, buffer.comp.hdr.cmd, &buffer, sizeof(buffer), r, sizeof(*r));
Add enum sof_buffer_type which can be used to specify the expected allocated region of the buffer, e.g. general heap, DMA heap.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- src/include/uapi/ipc.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h index 7123c8e..467616e 100644 --- a/src/include/uapi/ipc.h +++ b/src/include/uapi/ipc.h @@ -540,10 +540,17 @@ struct sof_ipc_comp { * Component Buffers */
+/* types of buffer */ +enum sof_buffer_type { + SOF_BUFF_GENERAL = 0, + SOF_BUFF_DMA = 1, /* dma buffer */ +}; + /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */ struct sof_ipc_buffer { struct sof_ipc_comp comp; uint32_t size; /* buffer size in bytes */ + enum sof_buffer_type type; /* buffer type */ } __attribute__((packed));
Add buffer token SOF_TKN_BUF_TYPE, for different buffer type. Add a new W_BUFFER_DMA function which will allocate buffer with DMA type.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- topology/m4/local.m4 | 22 ++++++++++++++++++++++ topology/sof/tokens.m4 | 1 + 2 files changed, 23 insertions(+)
diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 index ad72a11..974ae6c 100644 --- a/topology/m4/local.m4 +++ b/topology/m4/local.m4 @@ -52,6 +52,28 @@ define(`W_BUFFER', ` tokens "sof_buffer_tokens"' ` tuples."word" {' ` SOF_TKN_BUF_SIZE' STR($2) +` SOF_TKN_BUF_TYPE' STR(0) +` }' +`}' +`SectionData."'N_BUFFER($1)`_data" {' +` tuples "'N_BUFFER($1)`_tuples"' +`}' +`SectionWidget."'N_BUFFER($1)`" {' +` index "'PIPELINE_ID`"' +` type "buffer"' +` no_pm "true"' +` data [' +` "'N_BUFFER($1)`_data"' +` ]' +`}') + +dnl W_BUFFER_DMA(name, size) +define(`W_BUFFER_DMA', +`SectionVendorTuples."'N_BUFFER($1)`_tuples" {' +` tokens "sof_buffer_tokens"' +` tuples."word" {' +` SOF_TKN_BUF_SIZE' STR($2) +` SOF_TKN_BUF_TYPE' STR(1) ` }' `}' `SectionData."'N_BUFFER($1)`_data" {' diff --git a/topology/sof/tokens.m4 b/topology/sof/tokens.m4 index 704effc..4e7d04f 100644 --- a/topology/sof/tokens.m4 +++ b/topology/sof/tokens.m4 @@ -11,6 +11,7 @@
SectionVendorTokens."sof_buffer_tokens" { SOF_TKN_BUF_SIZE "100" + SOF_TKN_BUF_TYPE "101" }
SectionVendorTokens."sof_dai_tokens" {
On Tue, 2018-01-30 at 15:29 +0800, Keyon Jie wrote:
Add buffer token SOF_TKN_BUF_TYPE, for different buffer type. Add a new W_BUFFER_DMA function which will allocate buffer with DMA type.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
topology/m4/local.m4 | 22 ++++++++++++++++++++++ topology/sof/tokens.m4 | 1 + 2 files changed, 23 insertions(+)
diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 index ad72a11..974ae6c 100644 --- a/topology/m4/local.m4 +++ b/topology/m4/local.m4 @@ -52,6 +52,28 @@ define(`W_BUFFER', ` tokens "sof_buffer_tokens"' ` tuples."word" {' ` SOF_TKN_BUF_SIZE' STR($2) +` SOF_TKN_BUF_TYPE' STR(0) +` }' +`}' +`SectionData."'N_BUFFER($1)`_data" {' +` tuples "'N_BUFFER($1)`_tuples"' +`}' +`SectionWidget."'N_BUFFER($1)`" {' +` index "'PIPELINE_ID`"' +` type "buffer"' +` no_pm "true"' +` data [' +` "'N_BUFFER($1)`_data"' +` ]' +`}')
+dnl W_BUFFER_DMA(name, size)
cant we just add an arg to W_BUFFER for memory type ?
+define(`W_BUFFER_DMA', +`SectionVendorTuples."'N_BUFFER($1)`_tuples" {' +` tokens "sof_buffer_tokens"' +` tuples."word" {' +` SOF_TKN_BUF_SIZE' STR($2) +` SOF_TKN_BUF_TYPE' STR(1) ` }' `}' `SectionData."'N_BUFFER($1)`_data" {' diff --git a/topology/sof/tokens.m4 b/topology/sof/tokens.m4 index 704effc..4e7d04f 100644 --- a/topology/sof/tokens.m4 +++ b/topology/sof/tokens.m4 @@ -11,6 +11,7 @@
SectionVendorTokens."sof_buffer_tokens" { SOF_TKN_BUF_SIZE "100"
- SOF_TKN_BUF_TYPE "101"
}
SectionVendorTokens."sof_dai_tokens" {
On Tue, 2018-01-30 at 20:46 +0000, Liam Girdwood wrote:
+`}')
+dnl W_BUFFER_DMA(name, size)
cant we just add an arg to W_BUFFER for memory type ?
In fact, keep this and pass the type into the pipeline constructor macro in 2/2 i.e. pipe-volume-playback.m4 should not hard code type, but top level topology type should pass it in.
Liam
On 2018年01月31日 04:46, Liam Girdwood wrote:
On Tue, 2018-01-30 at 15:29 +0800, Keyon Jie wrote:
Add buffer token SOF_TKN_BUF_TYPE, for different buffer type. Add a new W_BUFFER_DMA function which will allocate buffer with DMA type.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
topology/m4/local.m4 | 22 ++++++++++++++++++++++ topology/sof/tokens.m4 | 1 + 2 files changed, 23 insertions(+)
diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 index ad72a11..974ae6c 100644 --- a/topology/m4/local.m4 +++ b/topology/m4/local.m4 @@ -52,6 +52,28 @@ define(`W_BUFFER', ` tokens "sof_buffer_tokens"' ` tuples."word" {' ` SOF_TKN_BUF_SIZE' STR($2) +` SOF_TKN_BUF_TYPE' STR(0) +` }' +`}' +`SectionData."'N_BUFFER($1)`_data" {' +` tuples "'N_BUFFER($1)`_tuples"' +`}' +`SectionWidget."'N_BUFFER($1)`" {' +` index "'PIPELINE_ID`"' +` type "buffer"' +` no_pm "true"' +` data [' +` "'N_BUFFER($1)`_data"' +` ]' +`}')
+dnl W_BUFFER_DMA(name, size)
cant we just add an arg to W_BUFFER for memory type ?
I planed to use that, but it need change too much(in almost each platform .m4 files)
add one W_BUFFER_DMA here is friendly for BYT/CHT/BDW/HSW, and even for normal buffers(non-dma ones, buffers inside FW).
Thanks, ~Keyon
+define(`W_BUFFER_DMA', +`SectionVendorTuples."'N_BUFFER($1)`_tuples" {' +` tokens "sof_buffer_tokens"' +` tuples."word" {' +` SOF_TKN_BUF_SIZE' STR($2) +` SOF_TKN_BUF_TYPE' STR(1) ` }' `}' `SectionData."'N_BUFFER($1)`_data" {' diff --git a/topology/sof/tokens.m4 b/topology/sof/tokens.m4 index 704effc..4e7d04f 100644 --- a/topology/sof/tokens.m4 +++ b/topology/sof/tokens.m4 @@ -11,6 +11,7 @@
SectionVendorTokens."sof_buffer_tokens" { SOF_TKN_BUF_SIZE "100"
SOF_TKN_BUF_TYPE "101" }
SectionVendorTokens."sof_dai_tokens" {
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
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@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");
Change to use DMA buffer type for host buffer in all pipelines.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- topology/sof/pipe-low-latency-capture.m4 | 2 +- topology/sof/pipe-low-latency-playback.m4 | 2 +- topology/sof/pipe-passthrough-capture.m4 | 4 ++-- topology/sof/pipe-passthrough-playback.m4 | 4 ++-- topology/sof/pipe-pcm-media.m4 | 2 +- topology/sof/pipe-src-capture.m4 | 4 ++-- topology/sof/pipe-src-playback.m4 | 2 +- topology/sof/pipe-volume-capture.m4 | 4 ++-- topology/sof/pipe-volume-playback.m4 | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/topology/sof/pipe-low-latency-capture.m4 b/topology/sof/pipe-low-latency-capture.m4 index 0c989a7..e7abf44 100644 --- a/topology/sof/pipe-low-latency-capture.m4 +++ b/topology/sof/pipe-low-latency-capture.m4 @@ -53,7 +53,7 @@ W_PGA(0, PCM PCM_ID Capture Volume, PIPELINE_FORMAT, 2, 2, 0) # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) -W_BUFFER(1, COMP_BUFFER_SIZE(2, +W_BUFFER_DMA(1, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES))
# diff --git a/topology/sof/pipe-low-latency-playback.m4 b/topology/sof/pipe-low-latency-playback.m4 index cd04ccf..724d10e 100644 --- a/topology/sof/pipe-low-latency-playback.m4 +++ b/topology/sof/pipe-low-latency-playback.m4 @@ -100,7 +100,7 @@ W_PGA(1, Master Playback Volume, PIPELINE_FORMAT, 2, 1, 1) W_MIXER(0, PIPELINE_FORMAT, 1, 1, 1)
# Low Latency Buffers -W_BUFFER(0, COMP_BUFFER_SIZE(2, +W_BUFFER_DMA(0, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) W_BUFFER(1, COMP_BUFFER_SIZE(1, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS,SCHEDULE_FRAMES)) diff --git a/topology/sof/pipe-passthrough-capture.m4 b/topology/sof/pipe-passthrough-capture.m4 index 2c2a495..4c2e91a 100644 --- a/topology/sof/pipe-passthrough-capture.m4 +++ b/topology/sof/pipe-passthrough-capture.m4 @@ -16,8 +16,8 @@ include(`local.m4') # with 0 sink and 2 source periods W_PCM_CAPTURE(Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 2)
-# Capture Buffers -W_BUFFER(0, COMP_BUFFER_SIZE(2, +# Capture DMA Buffers +W_BUFFER_DMA(0, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES))
# diff --git a/topology/sof/pipe-passthrough-playback.m4 b/topology/sof/pipe-passthrough-playback.m4 index 1722256..4331c02 100644 --- a/topology/sof/pipe-passthrough-playback.m4 +++ b/topology/sof/pipe-passthrough-playback.m4 @@ -16,8 +16,8 @@ include(`local.m4') # with 2 sink and 0 source periods W_PCM_PLAYBACK(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
-# Playback Buffers -W_BUFFER(0, COMP_BUFFER_SIZE(2, +# Playback DMA Buffers +W_BUFFER_DMA(0, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES))
# diff --git a/topology/sof/pipe-pcm-media.m4 b/topology/sof/pipe-pcm-media.m4 index 7bfb35a..520665a 100644 --- a/topology/sof/pipe-pcm-media.m4 +++ b/topology/sof/pipe-pcm-media.m4 @@ -74,7 +74,7 @@ W_PGA(0, PCM PCM_ID Playback Volume, PIPELINE_FORMAT, 2, 2, 2) W_SRC(0, PIPELINE_FORMAT, 2, 2, media_src_conf, 2)
# Media Source Buffers to SRC, make them big enough to deal with 2 * rate. -W_BUFFER(0, COMP_BUFFER_SIZE(4, +W_BUFFER_DMA(0, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) W_BUFFER(1,COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) diff --git a/topology/sof/pipe-src-capture.m4 b/topology/sof/pipe-src-capture.m4 index c843a6c..73339ec 100644 --- a/topology/sof/pipe-src-capture.m4 +++ b/topology/sof/pipe-src-capture.m4 @@ -36,7 +36,7 @@ SectionData."media_src_conf" { W_SRC(0, PIPELINE_FORMAT, 4, 4, media_src_conf, 2)
# Playback Buffers -W_BUFFER(0, COMP_BUFFER_SIZE(4, +W_BUFFER_DMA(0, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) W_BUFFER(1, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) @@ -56,7 +56,7 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, # # Pipeline Graph # -# host PCM_P --> B0 --> SRC 0 --> B1 --> sink DAI0 +# host PCM_C <-- B0 <-- SRC 0 <-- B1 <-- sink DAI0
SectionGraph."pipe-pass-src-capture-PIPELINE_ID" { index STR(PIPELINE_ID) diff --git a/topology/sof/pipe-src-playback.m4 b/topology/sof/pipe-src-playback.m4 index d037543..ecbb491 100644 --- a/topology/sof/pipe-src-playback.m4 +++ b/topology/sof/pipe-src-playback.m4 @@ -36,7 +36,7 @@ SectionData."media_src_conf" { W_SRC(0, PIPELINE_FORMAT, 4, 4, media_src_conf, 2)
# Playback Buffers -W_BUFFER(0, COMP_BUFFER_SIZE(4, +W_BUFFER_DMA(0, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) W_BUFFER(1, COMP_BUFFER_SIZE(4, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) diff --git a/topology/sof/pipe-volume-capture.m4 b/topology/sof/pipe-volume-capture.m4 index 8532aa3..5e8cbd2 100644 --- a/topology/sof/pipe-volume-capture.m4 +++ b/topology/sof/pipe-volume-capture.m4 @@ -49,10 +49,10 @@ W_PCM_CAPTURE(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 2) # "Volume" has 2 source and 2 sink periods W_PGA(0, Master Capture Volume, PIPELINE_FORMAT, 2, 2, 2)
-# Playback Buffers +# Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) -W_BUFFER(1, COMP_BUFFER_SIZE(2, +W_BUFFER_DMA(1, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES))
# diff --git a/topology/sof/pipe-volume-playback.m4 b/topology/sof/pipe-volume-playback.m4 index 54bc13d..9244f70 100644 --- a/topology/sof/pipe-volume-playback.m4 +++ b/topology/sof/pipe-volume-playback.m4 @@ -50,7 +50,7 @@ W_PCM_PLAYBACK(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2) W_PGA(0, Master Playback Volume, PIPELINE_FORMAT, 2, 2, 2)
# Playback Buffers -W_BUFFER(0, COMP_BUFFER_SIZE(2, +W_BUFFER_DMA(0, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) W_BUFFER(1, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES))
On Tue, 2018-01-30 at 15:29 +0800, Keyon Jie wrote:
Align with SOFT topology and SOF, add handle to buffer type.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
include/uapi/sound/sof-ipc.h | 7 +++++++ include/uapi/sound/sof-topology.h | 1 + sound/soc/sof/topology.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/uapi/sound/sof-ipc.h b/include/uapi/sound/sof- ipc.h index 741b412545b7..9a81896780ba 100644 --- a/include/uapi/sound/sof-ipc.h +++ b/include/uapi/sound/sof-ipc.h @@ -521,10 +521,17 @@ struct sof_ipc_comp {
- Component Buffers
*/
+/* types of buffer */ +enum sof_buffer_type {
- SOF_BUFF_GENERAL = 0,
- SOF_BUFF_DMA = 1, /* dma buffer */
This type probably wont just be restricted to buffers so needs to describe different memories in more detail.
enum sof_ipc_memory_type {
SOF_MEM_RAM = 0, SOF_MEM_RAM_HP, SOF_MEM_RAM_LP, SOF_MEM_RAM_EXT
plus more in future
+};
/* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */ struct sof_ipc_buffer { struct sof_ipc_comp comp; uint32_t size; /* buffer size in bytes */
- enum sof_buffer_type type; /* buffer type */
} __attribute__((packed));
diff --git a/include/uapi/sound/sof-topology.h b/include/uapi/sound/sof-topology.h index 6fe695c46386..e855ef48fd1a 100644 --- a/include/uapi/sound/sof-topology.h +++ b/include/uapi/sound/sof-topology.h @@ -33,6 +33,7 @@
/* buffers */ #define SOF_TKN_BUF_SIZE 100 +#define SOF_TKN_BUF_TYPE 101
/* DAI */ #define SOF_TKN_DAI_DMAC 151 diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 2d813335f3d2..3f2e9d72fba5 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -150,6 +150,8 @@ static int get_token_dai_type(void *elem ,void *object, u32 offset, u32 size) static const struct sof_topology_token buffer_tokens[] = { {SOF_TKN_BUF_SIZE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, offsetof(struct sof_ipc_buffer, size), 0},
- {SOF_TKN_BUF_TYPE, SND_SOC_TPLG_TUPLE_TYPE_WORD,
get_token_u32,
offsetof(struct sof_ipc_buffer, type), 0},
};
/* DAI */ @@ -554,8 +556,8 @@ static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index, sof_parse_tokens(scomp, &buffer, buffer_tokens, ARRAY_SIZE(buffer_tokens), private->array, private-
size);
- dev_dbg(sdev->dev, "buffer %s: size %d\n",
swidget->widget->name, buffer.size);
dev_dbg(sdev->dev, "buffer %s: size %d, type %d\n",
swidget->widget->name, buffer.size, buffer.type);
return sof_ipc_tx_message(sdev->ipc, buffer.comp.hdr.cmd, &buffer, sizeof(buffer), r,
sizeof(*r));
On 2018年01月31日 04:24, Liam Girdwood wrote:
On Tue, 2018-01-30 at 15:29 +0800, Keyon Jie wrote:
Align with SOFT topology and SOF, add handle to buffer type.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
include/uapi/sound/sof-ipc.h | 7 +++++++ include/uapi/sound/sof-topology.h | 1 + sound/soc/sof/topology.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/uapi/sound/sof-ipc.h b/include/uapi/sound/sof- ipc.h index 741b412545b7..9a81896780ba 100644 --- a/include/uapi/sound/sof-ipc.h +++ b/include/uapi/sound/sof-ipc.h @@ -521,10 +521,17 @@ struct sof_ipc_comp {
- Component Buffers
*/
+/* types of buffer */ +enum sof_buffer_type {
- SOF_BUFF_GENERAL = 0,
- SOF_BUFF_DMA = 1, /* dma buffer */
This type probably wont just be restricted to buffers so needs to describe different memories in more detail.
enum sof_ipc_memory_type {
SOF_MEM_RAM = 0, SOF_MEM_RAM_HP, SOF_MEM_RAM_LP, SOF_MEM_RAM_EXT
plus more in future
we can select DMA and non-DMA in alloc.c at the moment, can we merge it and change/add types in future once supported?
Thanks, ~Keyon
+};
- /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */ struct sof_ipc_buffer { struct sof_ipc_comp comp; uint32_t size; /* buffer size in bytes */
- enum sof_buffer_type type; /* buffer type */ } __attribute__((packed));
diff --git a/include/uapi/sound/sof-topology.h b/include/uapi/sound/sof-topology.h index 6fe695c46386..e855ef48fd1a 100644 --- a/include/uapi/sound/sof-topology.h +++ b/include/uapi/sound/sof-topology.h @@ -33,6 +33,7 @@
/* buffers */ #define SOF_TKN_BUF_SIZE 100 +#define SOF_TKN_BUF_TYPE 101
/* DAI */ #define SOF_TKN_DAI_DMAC 151 diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 2d813335f3d2..3f2e9d72fba5 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -150,6 +150,8 @@ static int get_token_dai_type(void *elem ,void *object, u32 offset, u32 size) static const struct sof_topology_token buffer_tokens[] = { {SOF_TKN_BUF_SIZE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, offsetof(struct sof_ipc_buffer, size), 0},
- {SOF_TKN_BUF_TYPE, SND_SOC_TPLG_TUPLE_TYPE_WORD,
get_token_u32,
offsetof(struct sof_ipc_buffer, type), 0},
};
/* DAI */
@@ -554,8 +556,8 @@ static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index, sof_parse_tokens(scomp, &buffer, buffer_tokens, ARRAY_SIZE(buffer_tokens), private->array, private-
size);
- dev_dbg(sdev->dev, "buffer %s: size %d\n",
swidget->widget->name, buffer.size);
dev_dbg(sdev->dev, "buffer %s: size %d, type %d\n",
swidget->widget->name, buffer.size, buffer.type);
return sof_ipc_tx_message(sdev->ipc, buffer.comp.hdr.cmd, &buffer, sizeof(buffer), r,
sizeof(*r));
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
participants (2)
-
Keyon Jie
-
Liam Girdwood