[Sound-open-firmware] [PATCH] topology: break up topology builder m4 files into per component macros
This patch break up the local.m4 and build.m4 topology builder includes into per component m4 files
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- topology/m4/buffer.m4 | 29 ++ topology/m4/dai.m4 | 214 ++++++++++ topology/m4/local.m4 | 654 ------------------------------ topology/m4/mixer.m4 | 43 ++ topology/m4/mixercontrol.m4 | 49 +++ topology/m4/pcm.m4 | 161 ++++++++ topology/m4/pga.m4 | 44 ++ topology/m4/{build.m4 => pipeline.m4} | 60 +-- topology/m4/src.m4 | 41 ++ topology/m4/tone.m4 | 43 ++ topology/m4/utils.m4 | 65 +++ topology/reef-apl-nocodec.m4 | 5 +- topology/reef-bdw-rt286.m4 | 5 +- topology/reef-bdw-rt5640.m4 | 5 +- topology/reef-bxt-nocodec.m4 | 5 +- topology/reef-byt-da7212.m4 | 5 +- topology/reef-byt-nocodec.m4 | 5 +- topology/reef-byt-rt5640.m4 | 5 +- topology/reef-byt-rt5645.m4 | 5 +- topology/reef-byt-rt5651.m4 | 5 +- topology/reef-cht-max98090.m4 | 5 +- topology/reef-cht-nocodec.m4 | 5 +- topology/reef-cnl-rt274.m4 | 5 +- topology/reef-hsw-rt5640.m4 | 5 +- topology/sof/pipe-dai-capture.m4 | 4 +- topology/sof/pipe-dai-playback.m4 | 4 +- topology/sof/pipe-low-latency-capture.m4 | 6 +- topology/sof/pipe-low-latency-playback.m4 | 7 +- topology/sof/pipe-passthrough-capture.m4 | 7 +- topology/sof/pipe-passthrough-playback.m4 | 7 +- topology/sof/pipe-pcm-media.m4 | 7 +- topology/sof/pipe-src-capture.m4 | 8 +- topology/sof/pipe-src-playback.m4 | 8 +- topology/sof/pipe-tone.m4 | 7 +- topology/sof/pipe-volume-capture.m4 | 8 +- topology/sof/pipe-volume-playback.m4 | 8 +- topology/test/test-capture-ssp.m4 | 5 +- topology/test/test-playback-ssp.m4 | 5 +- topology/test/test-ssp.m4 | 5 +- topology/test/test-tone-playback-ssp.m4 | 5 +- 40 files changed, 836 insertions(+), 733 deletions(-) create mode 100644 topology/m4/buffer.m4 create mode 100644 topology/m4/dai.m4 delete mode 100644 topology/m4/local.m4 create mode 100644 topology/m4/mixer.m4 create mode 100644 topology/m4/mixercontrol.m4 create mode 100644 topology/m4/pcm.m4 create mode 100644 topology/m4/pga.m4 rename topology/m4/{build.m4 => pipeline.m4} (76%) create mode 100644 topology/m4/src.m4 create mode 100644 topology/m4/tone.m4 create mode 100644 topology/m4/utils.m4
diff --git a/topology/m4/buffer.m4 b/topology/m4/buffer.m4 new file mode 100644 index 0000000..fc06ba0 --- /dev/null +++ b/topology/m4/buffer.m4 @@ -0,0 +1,29 @@ +divert(-1) + +dnl Define the macro for buffer widget + +dnl Buffer name) +define(`N_BUFFER', `BUF'PIPELINE_ID`.'$1) + +dnl W_BUFFER(name, size, capabilities) +define(`W_BUFFER', +`SectionVendorTuples."'N_BUFFER($1)`_tuples" {' +` tokens "sof_buffer_tokens"' +` tuples."word" {' +` SOF_TKN_BUF_SIZE' STR($2) +` SOF_TKN_BUF_CAPS' STR($3) +` }' +`}' +`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"' +` ]' +`}') + +divert(0)dnl diff --git a/topology/m4/dai.m4 b/topology/m4/dai.m4 new file mode 100644 index 0000000..163dfab --- /dev/null +++ b/topology/m4/dai.m4 @@ -0,0 +1,214 @@ +divert(-1) + +dnl Define macros for DAI IN/OUT widgets and DAI config + +dnl DAI name) +define(`N_DAI', DAI_NAME) +define(`N_DAI_OUT', DAI_NAME`.OUT') +define(`N_DAI_IN', DAI_NAME`.IN') + +dnl W_DAI_OUT(type, index, format, periods_sink, periods_source, preload, data) +define(`W_DAI_OUT', +`SectionVendorTuples."'N_DAI_OUT($2)`_tuples_w_comp" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($4) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($5) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($6) +` }' +`}' +`SectionData."'N_DAI_OUT($2)`_data_w_comp" {' +` tuples "'N_DAI_OUT($2)`_tuples_w_comp"' +`}' +`SectionVendorTuples."'N_DAI_OUT($2)`_tuples_w" {' +` tokens "sof_dai_tokens"' +` tuples."word" {' +` SOF_TKN_DAI_INDEX' $2 +` }' +`}' +`SectionData."'N_DAI_OUT($2)`_data_w" {' +` tuples "'N_DAI_OUT($2)`_tuples_w"' +`}' +`SectionVendorTuples."'N_DAI_OUT($2)`_tuples_str" {' +` tokens "sof_dai_tokens"' +` tuples."string" {' +` SOF_TKN_DAI_TYPE' $1 +` }' +`}' +`SectionData."'N_DAI_OUT($2)`_data_str" {' +` tuples "'N_DAI_OUT($2)`_tuples_str"' +`}' +`SectionVendorTuples."'N_DAI_OUT($2)`_tuples_comp_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($3) +` }' +`}' +`SectionData."'N_DAI_OUT($2)`_data_comp_str" {' +` tuples "'N_DAI_OUT($2)`_tuples_comp_str"' +`}' +`SectionWidget."'N_DAI_OUT`" {' +` index "'PIPELINE_ID`"' +` type "dai_in"' +` no_pm "true"' +` data [' +` "'N_DAI_OUT($2)`_data_w"' +` "'N_DAI_OUT($2)`_data_w_comp"' +` "'N_DAI_OUT($2)`_data_str"' +` "'N_DAI_OUT($2)`_data_comp_str"' +` "'$7`"' +` ]' +`}') + +dnl W_DAI_IN(type, index, format, periods_sink, periods_source, preload, data) +define(`W_DAI_IN', +`SectionVendorTuples."'N_DAI_IN($2)`_tuples_w_comp" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($4) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($5) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($6) +` }' +`}' +`SectionData."'N_DAI_IN($2)`_data_w_comp" {' +` tuples "'N_DAI_IN($2)`_tuples_w_comp"' +`}' +`SectionVendorTuples."'N_DAI_IN($2)`_tuples_w" {' +` tokens "sof_dai_tokens"' +` tuples."word" {' +` SOF_TKN_DAI_INDEX' $2 +` }' +`}' +`SectionData."'N_DAI_IN($2)`_data_w" {' +` tuples "'N_DAI_IN($2)`_tuples_w"' +`}' +`SectionVendorTuples."'N_DAI_IN($2)`_tuples_str" {' +` tokens "sof_dai_tokens"' +` tuples."string" {' +` SOF_TKN_DAI_TYPE' $1 +` }' +`}' +`SectionData."'N_DAI_IN($2)`_data_str" {' +` tuples "'N_DAI_IN($2)`_tuples_str"' +`}' +`SectionVendorTuples."'N_DAI_IN($2)`_tuples_comp_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($3) +` }' +`}' +`SectionData."'N_DAI_IN($2)`_data_comp_str" {' +` tuples "'N_DAI_IN($2)`_tuples_comp_str"' +`}' +`SectionWidget."'N_DAI_IN`" {' +` index "'PIPELINE_ID`"' +` type "dai_out"' +` no_pm "true"' +` data [' +` "'N_DAI_IN($2)`_data_w"' +` "'N_DAI_IN($2)`_data_w_comp"' +` "'N_DAI_IN($2)`_data_str"' +` "'N_DAI_IN($2)`_data_comp_str"' +` "'$7`"' +` ]' +`}') + +dnl D_DAI(id, playback, capture, data)) +define(`D_DAI', `SectionDAI."'N_DAI`" {' +` index "'PIPELINE_ID`"' +` id "'$1`"' +` playback "'$2`"' +` capture "'$3`"' +`}') + +dnl DAI_CLOCK(clock, freq, codec_master) +define(`DAI_CLOCK', + $1 STR($3) + $1_freq STR($2)) + + +dnl DAI_TDM(slots, width, tx_mask, rx_mask) +define(`DAI_TDM', +` tdm_slots 'STR($1) +` tdm_slot_width 'STR($2) +` tx_slots 'STR($3) +` rx_slots 'STR($4) +) + +dnl DAI Config) +define(`N_DAI_CONFIG', `DAICONFIG.'$1) + +dnl DAI_CONFIG(type, idx, name, format, valid bits, mclk, bclk, fsync, tdm) +define(`DAI_CONFIG', +`SectionHWConfig."'$1$2`" {' +`' +` id "'$2`"' +` format "'$4`"' +`' +` '$6 +` '$7 +` '$8 +` '$9 +`}' +`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples_str" {' +` tokens "sof_dai_tokens"' +` tuples."string" {' +` SOF_TKN_DAI_TYPE' STR($1) +` }' +`}' +`SectionData."'N_DAI_CONFIG($1$2)`_data_str" {' +` tuples "'N_DAI_CONFIG($1$2)`_tuples_str"' +`}' +`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples" {' +` tokens "sof_dai_tokens"' +` tuples."word" {' +` SOF_TKN_DAI_SAMPLE_BITS' STR($5) +` }' +`}' +`SectionData."'N_DAI_CONFIG($1$2)`_data" {' +` tuples "'N_DAI_CONFIG($1$2)`_tuples"' +`}' +`' +`SectionBE."'$3`" {' +` index "0"' +` default_hw_conf_id "'$2`"' +`' +` hw_configs [' +` "'$1$2`"' +` ]' +` data [' +` "'N_DAI_CONFIG($1$2)`_data"' +` "'N_DAI_CONFIG($1$2)`_data_str"' +` ]' +`}') + +dnl DAI_ADD(pipeline, +dnl pipe id, dai type, dai_index, +dnl buffer, periods, format, +dnl frames, deadline, priority, core) +define(`DAI_ADD', +`undefine(`PIPELINE_ID')' +`undefine(`DAI_TYPE')' +`undefine(`DAI_INDEX')' +`undefine(`DAI_BUF')' +`undefine(`DAI_PERIODS')' +`undefine(`DAI_FORMAT')' +`undefine(`SCHEDULE_FRAMES')' +`undefine(`SCHEDULE_DEADLINE')' +`undefine(`SCHEDULE_PRIORITY')' +`undefine(`SCHEDULE_CORE')' +`define(`PIPELINE_ID', $2)' +`define(`DAI_TYPE', STR($3))' +`define(`DAI_INDEX', STR($4))' +`define(`DAI_BUF', $5)' +`define(`DAI_NAME', $3$4)' +`define(`DAI_PERIODS', $6)' +`define(`DAI_FORMAT', $7)' +`define(`SCHEDULE_FRAMES', $8)' +`define(`SCHEDULE_DEADLINE', $9)' +`define(`SCHEDULE_PRIORITY', $10)' +`define(`SCHEDULE_CORE', $11)' +`include($1)' +) + +divert(0)dnl diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 deleted file mode 100644 index df6ea14..0000000 diff --git a/topology/m4/mixer.m4 b/topology/m4/mixer.m4 new file mode 100644 index 0000000..1f2376e --- /dev/null +++ b/topology/m4/mixer.m4 @@ -0,0 +1,43 @@ +divert(-1) + +dnl Define macro for Mixer widget + +dnl Mixer Name) +define(`N_MIXER', `MIXER'PIPELINE_ID`.'$1) + +dnl Pipe Buffer name in pipeline (pipeline, buffer) +define(`NPIPELINE_MIXER', `MIXER'$1`.'$2) + +dnl W_MIXER(name, format, periods_sink, periods_source, preload) +define(`W_MIXER', +`SectionVendorTuples."'N_MIXER($1)`_tuples_w" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($5) +` }' +`}' +`SectionData."'N_MIXER($1)`_data_w" {' +` tuples "'N_MIXER($1)`_tuples_w"' +`}' +`SectionVendorTuples."'N_MIXER($1)`_tuples_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($2) +` }' +`}' +`SectionData."'N_MIXER($1)`_data_str" {' +` tuples "'N_MIXER($1)`_tuples_str"' +`}' +`SectionWidget."'N_MIXER($1)`" {' +` index "'PIPELINE_ID`"' +` type "mixer"' +` no_pm "true"' +` data [' +` "'N_MIXER($1)`_data_w"' +` "'N_MIXER($1)`_data_str"' +` ]' +`}') + +divert(0)dnl diff --git a/topology/m4/mixercontrol.m4 b/topology/m4/mixercontrol.m4 new file mode 100644 index 0000000..77a3784 --- /dev/null +++ b/topology/m4/mixercontrol.m4 @@ -0,0 +1,49 @@ +divert(-1) + +dnl Define macro for mixer control + +dnl KCONTROL_CHANNEL(name, reg, shift) +define(`KCONTROL_CHANNEL', +`channel.STR($1) {' +` reg STR($2)' +` shift STR($3)' +` }') + +dnl CONTROLMIXER_MAX(comment, value) +define(`CONTROLMIXER_MAX', +`#$1' +` max STR($2)') + +dnl CONTROLMIXER_TLV(comment, value) +define(`CONTROLMIXER_TLV', +`#$1' +` tlv STR($2)') + +dnl CONTROLMIXER_OPS(info, comment, get, put) +define(`CONTROLMIXER_OPS', +`ops."ctl" {' +` info STR($1)' +` #$2' +` get STR($3)' +` put STR($4)' +` }') + +dnl C_CONTROLMIXER(name, index, ops, max, invert, tlv, KCONTROL_CHANNELS) +define(`C_CONTROLMIXER', +`SectionControlMixer.STR($1) {' +`' +` # control belongs to this index group' +` index STR($2)' +`' +` #$7' +` $8' +` # control uses bespoke driver get/put/info ID' +` $3' +`' +` $4' +` invert STR($5)' +` $6' + +`}') + +divert(0)dnl diff --git a/topology/m4/pcm.m4 b/topology/m4/pcm.m4 new file mode 100644 index 0000000..d767350 --- /dev/null +++ b/topology/m4/pcm.m4 @@ -0,0 +1,161 @@ +divert(-1) + +dnl Define the macro for PCM playback/capture/capabilities + +dnl PCM name) +define(`N_PCMP', `PCM'PCM_ID`P') +define(`N_PCMC', `PCM'PCM_ID`C') + +dnl W_PCM_PLAYBACK(stream, dmac, dmac_chan, periods_sink, periods_source, preload) +dnl PCM platform configuration +define(`W_PCM_PLAYBACK', +`SectionVendorTuples."'N_PCMP($1)`_tuples_w_comp" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($4) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($5) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($6) +` }' +`}' +`SectionData."'N_PCMP($1)`_data_w_comp" {' +` tuples "'N_PCMP($1)`_tuples_w_comp"' +`}' +`SectionVendorTuples."'N_PCMP($1)`_tuples" {' +` tokens "sof_pcm_tokens"' +` tuples."word" {' +` SOF_TKN_PCM_DMAC' STR($2) +` SOF_TKN_PCM_DMAC_CHAN' STR($3) +` }' +`}' +`SectionData."'N_PCMP($1)`_data" {' +` tuples "'N_PCMP($1)`_tuples"' +`}' +`SectionWidget."'N_PCMP`" {' +` index "'PIPELINE_ID`"' +` type "aif_in"' +` no_pm "true"' +` stream_name "'$1`"' +` data [' +` "'N_PCMP($1)`_data"' +` "'N_PCMP($1)`_data_w_comp"' +` ]' +`}') + + +dnl W_PCM_CAPTURE(stream, dmac, dmac_chan, periods_sink, periods_source, preload) +define(`W_PCM_CAPTURE', +`SectionVendorTuples."'N_PCMC($1)`_tuples_w_comp" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($4) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($5) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($6) +` }' +`}' +`SectionData."'N_PCMC($1)`_data_w_comp" {' +` tuples "'N_PCMC($1)`_tuples_w_comp"' +`}' +`SectionVendorTuples."'N_PCMC($1)`_tuples" {' +` tokens "sof_pcm_tokens"' +` tuples."word" {' +` SOF_TKN_PCM_DMAC' STR($2) +` SOF_TKN_PCM_DMAC_CHAN' STR($3) +` }' +`}' +`SectionData."'N_PCMC($1)`_data" {' +` tuples "'N_PCMC($1)`_tuples"' +`}' +`SectionWidget."'N_PCMC`" {' +` index "'PIPELINE_ID`"' +` type "aif_out"' +` no_pm "true"' +` stream_name "'$1`"' +` data [' +` "'N_PCMC($1)`_data"' +` "'N_PCMC($1)`_data_w_comp"' +` ]' +`}') + +dnl PCM_CAPABILITIES(name, formats, rate_min, rate_max, channels_min, channels_max, periods_min, periods_max, period_size_min, period_size_max, buffer_size_min, buffer_size_max) +define(`PCM_CAPABILITIES', +`SectionPCMCapabilities.STR($1) {' +`' +` formats "$2"' +` rate_min STR($3)' +` rate_max STR($4)' +` channels_min STR($5)' +` channels_max STR($6)' +` periods_min STR($7)' +` periods_max STR($8)' +` period_size_min STR($9)' +` period_size_max STR($10)' +` buffer_size_min STR($11)' +` buffer_size_max STR($12)' +`}') + +dnl COMP_BUFFER_SIZE( num_periods, sample_size, channels, fmames) +define(`COMP_BUFFER_SIZE', `eval(`$1 * $2 * $3 * $4')') + +dnl PCM_PLAYBACK_ADD(name, pipeline, pcm_id, dai_id, playback) +define(`PCM_PLAYBACK_ADD', +`SectionPCM.STR($1) {' +`' +` index STR($2)' +`' +` # used for binding to the PCM' +` id STR($3)' +`' +` dai.STR($1 $3) {' +` id STR($4)' +` }' +`' +` pcm."playback" {' +`' +` capabilities STR($5)' +` }' +`}') + +dnl PCM_CAPTURE_ADD(name, pipeline, pcm_id, dai_id, capture) +define(`PCM_CAPTURE_ADD', +`SectionPCM.STR($1) {' +`' +` index STR($2)' +`' +` # used for binding to the PCM' +` id STR($3)' +`' +` dai.STR($1 $3) {' +` id STR($4)' +` }' +`' +` pcm."capture" {' +`' +` capabilities STR($5)' +` }' +`}') + +dnl PCM_DUPLEX_ADD(name, pipeline, pcm_id, dai_id, playback, capture) +define(`PCM_DUPLEX_ADD', +`SectionPCM.STR($1) {' +`' +` index STR($2)' +`' +` # used for binding to the PCM' +` id STR($3)' +`' +` dai.STR($1 $3) {' +` id STR($4)' +` }' +`' +` pcm."capture" {' +`' +` capabilities STR($6)' +` }' +`' +` pcm."playback" {' +`' +` capabilities STR($5)' +` }' +`}') + +divert(0)dnl diff --git a/topology/m4/pga.m4 b/topology/m4/pga.m4 new file mode 100644 index 0000000..f38f820 --- /dev/null +++ b/topology/m4/pga.m4 @@ -0,0 +1,44 @@ +divert(-1) + +dnl Define macro for PGA widget + +dnl PGA name) +define(`N_PGA', `PGA'PIPELINE_ID`.'$1) + +dnl W_PGA(name, format, periods_sink, periods_source, preload, kcontrol0. kcontrol1...etc) +define(`W_PGA', +`SectionVendorTuples."'N_PGA($1)`_tuples_w" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($5) +` }' +`}' +`SectionData."'N_PGA($1)`_data_w" {' +` tuples "'N_PGA($1)`_tuples_w"' +`}' +`SectionVendorTuples."'N_PGA($1)`_tuples_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($2) +` }' +`}' +`SectionData."'N_PGA($1)`_data_str" {' +` tuples "'N_PGA($1)`_tuples_str"' +`}' +`SectionWidget."'N_PGA($1)`" {' +` index "'PIPELINE_ID`"' +` type "pga"' +` no_pm "true"' +` data [' +` "'N_PGA($1)`_data_w"' +` "'N_PGA($1)`_data_str"' +` ]' +` mixer [' + $6 +` ]' + +`}') + +divert(0)dnl diff --git a/topology/m4/build.m4 b/topology/m4/pipeline.m4 similarity index 76% rename from topology/m4/build.m4 rename to topology/m4/pipeline.m4 index 9361219..7a91439 100644 --- a/topology/m4/build.m4 +++ b/topology/m4/pipeline.m4 @@ -1,5 +1,36 @@ divert(-1)
+dnl Define macro for pipeline widget + +dnl Pipeline name) +define(`N_PIPELINE', `PIPELINE.'PIPELINE_ID`.'$1) + +dnl W_PIPELINE(stream, deadline, priority, frames, core, timer, platform) +define(`W_PIPELINE', +`SectionVendorTuples."'N_PIPELINE($1)`_tuples" {' +` tokens "sof_sched_tokens"' +` tuples."word" {' +` SOF_TKN_SCHED_DEADLINE' STR($2) +` SOF_TKN_SCHED_PRIORITY' STR($3) +` SOF_TKN_SCHED_CORE' STR($5) +` SOF_TKN_SCHED_FRAMES' STR($4) +` SOF_TKN_SCHED_TIMER' STR($6) +` }' +`}' +`SectionData."'N_PIPELINE($1)`_data" {' +` tuples "'N_PIPELINE($1)`_tuples"' +`}' +`SectionWidget."'N_PIPELINE($1)`" {' +` index "'PIPELINE_ID`"' +` type "scheduler"' +` no_pm "true"' +` stream_name "'$1`"' +` data [' +` "'N_PIPELINE($1)`_data"' +` "'$7`"' +` ]' +`}') + dnl PIPELINE_PCM_ADD(pipeline, dnl pipe id, pcm, max channels, format, dnl frames, deadline, priority, core, dmac, dmac_chan) @@ -85,33 +116,4 @@ define(`PIPELINE_ADD', `include($1)' )
-dnl DAI_ADD(pipeline, -dnl pipe id, dai type, dai_index, -dnl buffer, periods, format, -dnl frames, deadline, priority, core) -define(`DAI_ADD', -`undefine(`PIPELINE_ID')' -`undefine(`DAI_TYPE')' -`undefine(`DAI_INDEX')' -`undefine(`DAI_BUF')' -`undefine(`DAI_PERIODS')' -`undefine(`DAI_FORMAT')' -`undefine(`SCHEDULE_FRAMES')' -`undefine(`SCHEDULE_DEADLINE')' -`undefine(`SCHEDULE_PRIORITY')' -`undefine(`SCHEDULE_CORE')' -`define(`PIPELINE_ID', $2)' -`define(`DAI_TYPE', STR($3))' -`define(`DAI_INDEX', STR($4))' -`define(`DAI_BUF', $5)' -`define(`DAI_NAME', $3$4)' -`define(`DAI_PERIODS', $6)' -`define(`DAI_FORMAT', $7)' -`define(`SCHEDULE_FRAMES', $8)' -`define(`SCHEDULE_DEADLINE', $9)' -`define(`SCHEDULE_PRIORITY', $10)' -`define(`SCHEDULE_CORE', $11)' -`include($1)' -) - divert(0)dnl diff --git a/topology/m4/src.m4 b/topology/m4/src.m4 new file mode 100644 index 0000000..aca18e3 --- /dev/null +++ b/topology/m4/src.m4 @@ -0,0 +1,41 @@ +divert(-1) + +dnl Defines the macro for SRC widget + +dnl SRC name) +define(`N_SRC', `SRC'PIPELINE_ID`.'$1) + +dnl W_SRC(name, format, periods_sink, periods_source, data, preload) +define(`W_SRC', +`SectionVendorTuples."'N_SRC($1)`_tuples_w" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($6) +` }' +`}' +`SectionData."'N_SRC($1)`_data_w" {' +` tuples "'N_SRC($1)`_tuples_w"' +`}' +`SectionVendorTuples."'N_SRC($1)`_tuples_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($2) +` }' +`}' +`SectionData."'N_SRC($1)`_data_str" {' +` tuples "'N_SRC($1)`_tuples_str"' +`}' +`SectionWidget."'N_SRC($1)`" {' +` index "'PIPELINE_ID`"' +` type "src"' +` no_pm "true"' +` data [' +` "'N_SRC($1)`_data_w"' +` "'N_SRC($1)`_data_str"' +` "'$5`"' +` ]' +`}') + +divert(0)dnl diff --git a/topology/m4/tone.m4 b/topology/m4/tone.m4 new file mode 100644 index 0000000..6a88b37 --- /dev/null +++ b/topology/m4/tone.m4 @@ -0,0 +1,43 @@ +divert(-1) + +dnl Define macro for siggen widget + +dnl Tone name) +define(`N_TONE', `TONE'PIPELINE_ID`.'$1) + +dnl W_TONE(name, format, periods_sink, periods_source, preload, kcontrols_list) +define(`W_TONE', +`SectionVendorTuples."'N_TONE($1)`_tuples_w" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4) +` SOF_TKN_COMP_PRELOAD_COUNT' STR($5) +` }' +`}' +`SectionData."'N_TONE($1)`_data_w" {' +` tuples "'N_TONE($1)`_tuples_w"' +`}' +`SectionVendorTuples."'N_TONE($1)`_tuples_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($2) +` }' +`}' +`SectionData."'N_TONE($1)`_data_str" {' +` tuples "'N_TONE($1)`_tuples_str"' +`}' +`SectionWidget."'N_TONE($1)`" {' +` index "'PIPELINE_ID`"' +` type "siggen"' +` no_pm "true"' +` data [' +` "'N_TONE($1)`_data_w"' +` "'N_TONE($1)`_data_str"' +` ]' +` mixer [' + $6 +` ]' +`}') + +divert(0)dnl diff --git a/topology/m4/utils.m4 b/topology/m4/utils.m4 new file mode 100644 index 0000000..e929244 --- /dev/null +++ b/topology/m4/utils.m4 @@ -0,0 +1,65 @@ +divert(-1) + +define(`concat',`$1$2') + +define(`STR', `"'$1`"') + +dnl Argument iterator. +define(`argn', `ifelse(`$1', 1, ``$2'', + `argn(decr(`$1'), shift(shift($@)))')') + +dnl Defines a list of items from a variable number of params. +dnl Use as last argument in a macro. +dnl The first argument specifies the number of tabs to be added for formatting +define(`LIST_LOOP', `argn(j,$@) +$1ifelse(i,`2', `', `define(`i', decr(i))define(`j', incr(j))$0($@)')') + +define(`LIST', `pushdef(`i', $#)pushdef(`j', `2')LIST_LOOP($@)popdef(i)popdef(j)') + +dnl Sums a list of variable arguments. Use as last argument in macro. +define(`SUM_LOOP', `eval(argn(j,$@) + ifelse(i,`1', `', `define(`i', decr(i)) define(`j', incr(j)) + $0($@)'))') + +dnl Memory capabilities +define(`MEMCAPS', `pushdef(`i', $#) pushdef(`j', `1') SUM_LOOP($@)') + +dnl create direct DAPM/pipeline link between 2 widgets) +define(`dapm', `"$1, , $2"') + +dnl COMP_SAMPLE_SIZE(FMT) +define(`COMP_SAMPLE_SIZE', +`ifelse( + $1, `s16le', `2', + $1, `s24_4le', `4', + $1, `s32le', `4', + $1, `float', `4', + `4')') + +dnl P_GRAPH(name, CONNECTIONS) +define(`P_GRAPH', +`SectionGraph.STR($1) {' +` index STR($2)' +`' +` lines [' +` $3' +` ]' +`}') + +dnl W_VENDORTUPLES(name, tokens, RATE_OUT) +define(`W_VENDORTUPLES', +`SectionVendorTuples.STR($1) {' +` tokens STR($2)' +`' +` tuples."word" {' +` $3' +` }' +`}') + +dnl W_DATA(name, tuples) +define(`W_DATA', +`SectionData.STR($1) {' +` tuples STR($2)' +`}') + +divert(0) dnl + diff --git a/topology/reef-apl-nocodec.m4 b/topology/reef-apl-nocodec.m4 index d4ac613..cf0a20e 100644 --- a/topology/reef-apl-nocodec.m4 +++ b/topology/reef-apl-nocodec.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`pipeline.m4') +include(`utils.m4') +include(`dai.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-bdw-rt286.m4 b/topology/reef-bdw-rt286.m4 index eaba2d9..fa894f6 100644 --- a/topology/reef-bdw-rt286.m4 +++ b/topology/reef-bdw-rt286.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`pipeline.m4') +include(`utils.m4') +include(`dai.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-bdw-rt5640.m4 b/topology/reef-bdw-rt5640.m4 index 5d4485b..ec920a5 100644 --- a/topology/reef-bdw-rt5640.m4 +++ b/topology/reef-bdw-rt5640.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-bxt-nocodec.m4 b/topology/reef-bxt-nocodec.m4 index dbac98a..b7717d0 100644 --- a/topology/reef-bxt-nocodec.m4 +++ b/topology/reef-bxt-nocodec.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-byt-da7212.m4 b/topology/reef-byt-da7212.m4 index 840ea69..7515c63 100644 --- a/topology/reef-byt-da7212.m4 +++ b/topology/reef-byt-da7212.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-byt-nocodec.m4 b/topology/reef-byt-nocodec.m4 index 56aee22..b3ca196 100644 --- a/topology/reef-byt-nocodec.m4 +++ b/topology/reef-byt-nocodec.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`pipeline.m4') +include(`utils.m4') +include(`dai.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-byt-rt5640.m4 b/topology/reef-byt-rt5640.m4 index f8d0e40..9fa15a2 100644 --- a/topology/reef-byt-rt5640.m4 +++ b/topology/reef-byt-rt5640.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-byt-rt5645.m4 b/topology/reef-byt-rt5645.m4 index 023d92d..c81a4db 100644 --- a/topology/reef-byt-rt5645.m4 +++ b/topology/reef-byt-rt5645.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-byt-rt5651.m4 b/topology/reef-byt-rt5651.m4 index ccac260..96147d3 100644 --- a/topology/reef-byt-rt5651.m4 +++ b/topology/reef-byt-rt5651.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-cht-max98090.m4 b/topology/reef-cht-max98090.m4 index 3218402..5690df4 100644 --- a/topology/reef-cht-max98090.m4 +++ b/topology/reef-cht-max98090.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-cht-nocodec.m4 b/topology/reef-cht-nocodec.m4 index 24560ee..32acb62 100644 --- a/topology/reef-cht-nocodec.m4 +++ b/topology/reef-cht-nocodec.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`pipeline.m4') +include(`utils.m4') +include(`dai.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-cnl-rt274.m4 b/topology/reef-cnl-rt274.m4 index f91a74f..e95363b 100644 --- a/topology/reef-cnl-rt274.m4 +++ b/topology/reef-cnl-rt274.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/reef-hsw-rt5640.m4 b/topology/reef-hsw-rt5640.m4 index 663686b..1f63820 100644 --- a/topology/reef-hsw-rt5640.m4 +++ b/topology/reef-hsw-rt5640.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/sof/pipe-dai-capture.m4 b/topology/sof/pipe-dai-capture.m4 index 3699138..a5a72d0 100644 --- a/topology/sof/pipe-dai-capture.m4 +++ b/topology/sof/pipe-dai-capture.m4 @@ -1,7 +1,9 @@ # DAI Capture connector
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# # DAI definitions diff --git a/topology/sof/pipe-dai-playback.m4 b/topology/sof/pipe-dai-playback.m4 index d35d3b1..e70998b 100644 --- a/topology/sof/pipe-dai-playback.m4 +++ b/topology/sof/pipe-dai-playback.m4 @@ -1,7 +1,9 @@ # DAI Playback connector
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`dai.m4') +include(`pipeline.m4')
# # DAI definitions diff --git a/topology/sof/pipe-low-latency-capture.m4 b/topology/sof/pipe-low-latency-capture.m4 index 7adfd14..5619999 100644 --- a/topology/sof/pipe-low-latency-capture.m4 +++ b/topology/sof/pipe-low-latency-capture.m4 @@ -5,7 +5,11 @@ # host PCM_C <--B5-- volume(0C) <--B4-- source DAI0
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`pga.m4') +include(`mixercontrol.m4')
# # Controls diff --git a/topology/sof/pipe-low-latency-playback.m4 b/topology/sof/pipe-low-latency-playback.m4 index 11cf07d..4a4fca9 100644 --- a/topology/sof/pipe-low-latency-playback.m4 +++ b/topology/sof/pipe-low-latency-playback.m4 @@ -20,7 +20,12 @@ #
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`pga.m4') +include(`mixer.m4') +include(`mixercontrol.m4')
# # Controls diff --git a/topology/sof/pipe-passthrough-capture.m4 b/topology/sof/pipe-passthrough-capture.m4 index cfa357a..a13887a 100644 --- a/topology/sof/pipe-passthrough-capture.m4 +++ b/topology/sof/pipe-passthrough-capture.m4 @@ -5,8 +5,11 @@ # host PCM_C <-- B0 <-- sink DAI0
# Include topology builder -include(`local.m4') - +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`pipeline.m4')
# # Components and Buffers diff --git a/topology/sof/pipe-passthrough-playback.m4 b/topology/sof/pipe-passthrough-playback.m4 index 3218431..8a9e8ff 100644 --- a/topology/sof/pipe-passthrough-playback.m4 +++ b/topology/sof/pipe-passthrough-playback.m4 @@ -5,8 +5,11 @@ # host PCM_P --> B0 --> sink DAI0
# Include topology builder -include(`local.m4') - +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`pipeline.m4')
# # Components and Buffers diff --git a/topology/sof/pipe-pcm-media.m4 b/topology/sof/pipe-pcm-media.m4 index 0196f98..f2053b7 100644 --- a/topology/sof/pipe-pcm-media.m4 +++ b/topology/sof/pipe-pcm-media.m4 @@ -8,7 +8,12 @@ #
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`src.m4') +include(`buffer.m4') +include(`pga.m4') +include(`mixercontrol.m4') +include(`pipeline.m4')
# # Controls diff --git a/topology/sof/pipe-src-capture.m4 b/topology/sof/pipe-src-capture.m4 index 824dcdb..a58eb68 100644 --- a/topology/sof/pipe-src-capture.m4 +++ b/topology/sof/pipe-src-capture.m4 @@ -5,8 +5,12 @@ # host PCM_P --> SRC --> sink DAI0
# Include topology builder -include(`local.m4') - +include(`utils.m4') +include(`src.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`pipeline.m4')
# # Components and Buffers diff --git a/topology/sof/pipe-src-playback.m4 b/topology/sof/pipe-src-playback.m4 index 3009ff7..7bf8f47 100644 --- a/topology/sof/pipe-src-playback.m4 +++ b/topology/sof/pipe-src-playback.m4 @@ -5,8 +5,12 @@ # host PCM_P --> SRC --> sink DAI0
# Include topology builder -include(`local.m4') - +include(`utils.m4') +include(`src.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`pipeline.m4')
# # Components and Buffers diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 index 899c426..09ed32c 100644 --- a/topology/sof/pipe-tone.m4 +++ b/topology/sof/pipe-tone.m4 @@ -8,7 +8,12 @@ #
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`buffer.m4') +include(`pga.m4') +include(`tone.m4') +include(`mixercontrol.m4') +include(`pipeline.m4')
# # Controls diff --git a/topology/sof/pipe-volume-capture.m4 b/topology/sof/pipe-volume-capture.m4 index 299a0f8..5aa0d12 100644 --- a/topology/sof/pipe-volume-capture.m4 +++ b/topology/sof/pipe-volume-capture.m4 @@ -5,7 +5,13 @@ # host PCM_C <-- B0 <-- Volume 0 <-- B1 <-- source DAI0
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`pga.m4') +include(`dai.m4') +include(`mixercontrol.m4') +include(`pipeline.m4')
# # Controls diff --git a/topology/sof/pipe-volume-playback.m4 b/topology/sof/pipe-volume-playback.m4 index 3e3f98e..90fe303 100644 --- a/topology/sof/pipe-volume-playback.m4 +++ b/topology/sof/pipe-volume-playback.m4 @@ -5,7 +5,13 @@ # host PCM_P --> B0 --> Volume 0 --> B1 --> sink DAI0
# Include topology builder -include(`local.m4') +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`pga.m4') +include(`dai.m4') +include(`mixercontrol.m4') +include(`pipeline.m4')
# # Controls diff --git a/topology/test/test-capture-ssp.m4 b/topology/test/test-capture-ssp.m4 index 2c808ba..8950222 100644 --- a/topology/test/test-capture-ssp.m4 +++ b/topology/test/test-capture-ssp.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`dai.m4') +include(`utils.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/test/test-playback-ssp.m4 b/topology/test/test-playback-ssp.m4 index 093ad17..db6cb6c 100644 --- a/topology/test/test-playback-ssp.m4 +++ b/topology/test/test-playback-ssp.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`pipeline.m4') +include(`dai.m4') +include(`utils.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/test/test-ssp.m4 b/topology/test/test-ssp.m4 index 304aab9..01e3a02 100644 --- a/topology/test/test-ssp.m4 +++ b/topology/test/test-ssp.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`dai.m4') +include(`utils.m4') +include(`pipeline.m4')
# Include TLV library include(`common/tlv.m4') diff --git a/topology/test/test-tone-playback-ssp.m4 b/topology/test/test-tone-playback-ssp.m4 index 2fe6693..9231316 100644 --- a/topology/test/test-tone-playback-ssp.m4 +++ b/topology/test/test-tone-playback-ssp.m4 @@ -3,8 +3,9 @@ #
# Include topology builder -include(`local.m4') -include(`build.m4') +include(`pipeline.m4') +include(`dai.m4') +include(`utils.m4')
# Include TLV library include(`common/tlv.m4')
On Mon, 2018-03-05 at 14:17 -0800, Ranjani Sridharan wrote:
This patch break up the local.m4 and build.m4 topology builder includes into per component m4 files
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
All applied. Btw, we still need to add more documentation to the macros.
Thanks
Liam
participants (2)
-
Liam Girdwood
-
Ranjani Sridharan