From 08adb55f0b5589f55f1ab230fae060c3f4f70e25 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 21 Aug 2017 20:26:05 +0100 Subject: [PATCH] topology: Include DAI format in pipeline definitions Make sure we allow different DAI formats in pipelines. Signed-off-by: Liam Girdwood --- topology/m4/build.m4 | 6 +++-- topology/m4/local.m4 | 29 +++++++++++++++++++---- topology/sof/pipe-dai-capture.m4 | 2 +- topology/sof/pipe-dai-playback.m4 | 2 +- topology/sof/pipe-passthrough-playback.m4 | 8 +++---- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/topology/m4/build.m4 b/topology/m4/build.m4 index 66f6562..843dcbb 100644 --- a/topology/m4/build.m4 +++ b/topology/m4/build.m4 @@ -26,7 +26,7 @@ define(`PIPELINE_PCM_ADD', ) dnl PIPELINE_PCM_DAI_ADD(pipeline, id, pcm, max channels, format, frames, -dnl deadline, priority, core, dai type, dai_index, stream_name, periods) +dnl deadline, priority, core, dai type, dai_index, stream_name, dai format, periods) define(`PIPELINE_PCM_DAI_ADD', `undefine(`PCM_ID')' `undefine(`PIPELINE_ID')' @@ -41,6 +41,7 @@ define(`PIPELINE_PCM_DAI_ADD', `undefine(`DAI_TYPE')' `undefine(`DAI_INDEX')' `undefine(`DAI_SNAME')' +`undefine(`DAI_FORMAT')' `undefine(`DAI_PERIODS')' `define(`PIPELINE_ID', $2)' `define(`PCM_ID', $3)' @@ -55,7 +56,8 @@ define(`PIPELINE_PCM_DAI_ADD', `define(`DAI_TYPE', STR($12))' `define(`DAI_INDEX', STR($13))' `define(`DAI_SNAME', $14)' -`define(`DAI_PERIODS', $15)' +`define(`DAI_FORMAT', $15)' +`define(`DAI_PERIODS', $16)' `define(`DAI_NAME', $12$13)' `include($1)' ) diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 index a559670..7bcebee 100644 --- a/topology/m4/local.m4 +++ b/topology/m4/local.m4 @@ -253,7 +253,7 @@ define(`N_DAI', DAI_NAME) define(`N_DAI_OUT', DAI_NAME`.OUT') define(`N_DAI_IN', DAI_NAME`.IN') -dnl W_DAI_OUT(stream, type, index, data, periods_sink, periods_source, preload) +dnl W_DAI_OUT(stream, type, index, format, periods_sink, periods_source, preload, data) define(`W_DAI_OUT', `SectionVendorTuples."'N_DAI_OUT($1)`_tuples_w_comp" {' ` tokens "sof_comp_tokens"' @@ -284,6 +284,15 @@ define(`W_DAI_OUT', `SectionData."'N_DAI_OUT($1)`_data_str" {' ` tuples "'N_DAI_OUT($1)`_tuples_str"' `}' +`SectionVendorTuples."'N_DAI_OUT($1)`_tuples_comp_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($4) +` }' +`}' +`SectionData."'N_DAI_OUT($1)`_data_comp_str" {' +` tuples "'N_DAI_OUT($1)`_tuples_comp_str"' +`}' `SectionWidget."'N_DAI_OUT`" {' ` index "'PIPELINE_ID`"' ` type "dai_in"' @@ -293,11 +302,12 @@ define(`W_DAI_OUT', ` "'N_DAI_OUT($1)`_data_w"' ` "'N_DAI_OUT($1)`_data_w_comp"' ` "'N_DAI_OUT($1)`_data_str"' -` "'$4`"' +` "'N_DAI_OUT($1)`_data_comp_str"' +` "'$8`"' ` ]' `}') -dnl W_DAI_IN(stream, type, index, data, periods_sink, periods_source, preload) +dnl W_DAI_IN(stream, type, index, format, periods_sink, periods_source, preload, data) define(`W_DAI_IN', `SectionVendorTuples."'N_DAI_IN($1)`_tuples_w_comp" {' ` tokens "sof_comp_tokens"' @@ -328,6 +338,15 @@ define(`W_DAI_IN', `SectionData."'N_DAI_IN($1)`_data_str" {' ` tuples "'N_DAI_IN($1)`_tuples_str"' `}' +`SectionVendorTuples."'N_DAI_IN($1)`_tuples_comp_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($4) +` }' +`}' +`SectionData."'N_DAI_IN($1)`_data_comp_str" {' +` tuples "'N_DAI_IN($1)`_tuples_comp_str"' +`}' `SectionWidget."'N_DAI_IN`" {' ` index "'PIPELINE_ID`"' ` type "dai_out"' @@ -337,7 +356,8 @@ define(`W_DAI_IN', ` "'N_DAI_IN($1)`_data_w"' ` "'N_DAI_IN($1)`_data_w_comp"' ` "'N_DAI_IN($1)`_data_str"' -` "'$4`"' +` "'N_DAI_OUT($1)`_data_comp_str"' +` "'$8`"' ` ]' `}') @@ -447,6 +467,7 @@ define(`COMP_SAMPLE_SIZE', $1, `s16le', `2', $1, `s24_4le', `4', $1, `s32le', `4', + $1, `float', `4', `4')') diff --git a/topology/sof/pipe-dai-capture.m4 b/topology/sof/pipe-dai-capture.m4 index 887cd0c..cc44c0e 100644 --- a/topology/sof/pipe-dai-capture.m4 +++ b/topology/sof/pipe-dai-capture.m4 @@ -6,7 +6,7 @@ include(`local.m4') # # DAI definitions # -W_DAI_IN(DAI_SNAME, DAI_TYPE, DAI_INDEX, dai0c_plat_conf) +W_DAI_IN(DAI_SNAME, DAI_TYPE, DAI_INDEX, DAI_FORMAT, 2, 0, 0, dai0c_plat_conf) # # DAI pipeline - always use 0 for DAIs diff --git a/topology/sof/pipe-dai-playback.m4 b/topology/sof/pipe-dai-playback.m4 index f3d08c0..f0967c2 100644 --- a/topology/sof/pipe-dai-playback.m4 +++ b/topology/sof/pipe-dai-playback.m4 @@ -6,7 +6,7 @@ include(`local.m4') # # DAI definitions # -W_DAI_OUT(DAI_SNAME, DAI_TYPE, DAI_INDEX, dai0p_plat_conf) +W_DAI_OUT(DAI_SNAME, DAI_TYPE, DAI_INDEX, DAI_FORMAT, 0, 2, 2, dai0p_plat_conf) # # DAI pipeline - always use 0 for DAIs diff --git a/topology/sof/pipe-passthrough-playback.m4 b/topology/sof/pipe-passthrough-playback.m4 index 98b479f..a6ecb32 100644 --- a/topology/sof/pipe-passthrough-playback.m4 +++ b/topology/sof/pipe-passthrough-playback.m4 @@ -16,14 +16,14 @@ include(`local.m4') # with 2 sink and 0 source periods W_PCM_PLAYBACK(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2) -# Capture Buffers +# Playback Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES)) # # DAI definitions # -W_DAI_OUT(DAI_SNAME, DAI_TYPE, DAI_INDEX, dai0p_plat_conf) +W_DAI_OUT(DAI_SNAME, DAI_TYPE, DAI_INDEX, DAI_FORMAT, 0, 2, 2, dai0p_plat_conf) # # DAI pipeline - always use 0 for DAIs @@ -33,7 +33,7 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCH # # Pipeline Graph # -# host PCM <--B1-- volume <--B0-- source DAI0 +# host PCM_P --> B0 --> sink DAI0 SectionGraph."pipe-pass-playback-PIPELINE_ID" { index STR(PIPELINE_ID) @@ -65,7 +65,7 @@ SectionPCMCapabilities.STR(Passthrough Playback PCM_ID) { buffer_size_max "65536" } -# PCM Low Latency Capture +# PCM Low Latency Passthrough Playback SectionPCM.STR(PCM PCM_ID) { index STR(PIPELINE_ID)