This patch adds a m4 wrpper for Graph sections in pipeline definition
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- topology/m4/local.m4 | 16 ++++++++++++++++ topology/sof/pipe-dai-capture.m4 | 9 ++------- topology/sof/pipe-dai-playback.m4 | 9 ++------- topology/sof/pipe-low-latency-capture.m4 | 15 +++++---------- topology/sof/pipe-low-latency-playback.m4 | 23 +++++++++-------------- topology/sof/pipe-passthrough-capture.m4 | 11 +++-------- topology/sof/pipe-passthrough-playback.m4 | 11 +++-------- topology/sof/pipe-pcm-media.m4 | 19 +++++++------------ topology/sof/pipe-src-capture.m4 | 15 +++++---------- topology/sof/pipe-src-playback.m4 | 15 +++++---------- topology/sof/pipe-tone.m4 | 13 ++++--------- topology/sof/pipe-volume-capture.m4 | 15 +++++---------- topology/sof/pipe-volume-playback.m4 | 15 +++++---------- 13 files changed, 71 insertions(+), 115 deletions(-)
diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 index 4521314..b7bc78f 100644 --- a/topology/m4/local.m4 +++ b/topology/m4/local.m4 @@ -15,6 +15,11 @@ define(`MIXERCONTROLS', `pushdef(`i', $#)pushdef(`j', `1')MIXERCONTROL_LOOP($@)p define(`MIXERCONTROL_LOOP',`argn(j,$@) ifelse(i,`1', `',`define(`i', decr(i))define(`j', incr(j))$0($@)')')
+define(`PIPELINEGRAPH', `pushdef(`i', $#)pushdef(`j', `1')PIPELINEGRAPH_LOOP($@)popdef(i)popdef(j)') +define(`PIPELINEGRAPH_LOOP',`argn(j,$@) + ifelse(i,`1', `',`define(`i', decr(i))define(`j', incr(j))$0($@)')') + + dnl create direct DAPM/pipeline link between 2 widgets) define(`dapm', `"$1, , $2"')
@@ -596,6 +601,17 @@ define(`C_CONTROLMIXER', ` $6' `}')
+dnl P_GRAPH(name, CONNECTIONS) +define(`P_GRAPH', +`SectionGraph.STR($1) {' +` index STR($2)' +`' +` lines [' +` $3' +` ]' +`}') + + divert(0) dnl
diff --git a/topology/sof/pipe-dai-capture.m4 b/topology/sof/pipe-dai-capture.m4 index e69991e..7b5cd56 100644 --- a/topology/sof/pipe-dai-capture.m4 +++ b/topology/sof/pipe-dai-capture.m4 @@ -16,10 +16,5 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHE # # Graph connections to pipelines
-SectionGraph.STR(DAI_NAME) { - index STR(PIPELINE_ID) - - lines [ - dapm(DAI_BUF, N_DAI_IN) - ] -} +P_GRAPH(DAI_NAME, PIPELINE_ID, + PIPELINEGRAPH(`dapm(DAI_BUF, N_DAI_IN)')) diff --git a/topology/sof/pipe-dai-playback.m4 b/topology/sof/pipe-dai-playback.m4 index 3a7a158..fa87957 100644 --- a/topology/sof/pipe-dai-playback.m4 +++ b/topology/sof/pipe-dai-playback.m4 @@ -16,10 +16,5 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCH # # Graph connections to pipelines
-SectionGraph.STR(DAI_NAME) { - index STR(PIPELINE_ID) - - lines [ - dapm(N_DAI_OUT, DAI_BUF) - ] -} +P_GRAPH(DAI_NAME, PIPELINE_ID, + PIPELINEGRAPH(`dapm(N_DAI_OUT, DAI_BUF)')) diff --git a/topology/sof/pipe-low-latency-capture.m4 b/topology/sof/pipe-low-latency-capture.m4 index a82dee1..9728032 100644 --- a/topology/sof/pipe-low-latency-capture.m4 +++ b/topology/sof/pipe-low-latency-capture.m4 @@ -41,16 +41,11 @@ W_BUFFER(1, COMP_BUFFER_SIZE(2, # # host PCM <--B1-- volume <--B0-- source DAI0
-SectionGraph."pipe-ll-capture-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(Low Latency Capture PCM_ID, N_PCMC) - dapm(N_PCMC, N_BUFFER(1)) - dapm(N_BUFFER(1), N_PGA(0)) - dapm(N_PGA(0), N_BUFFER(0)) - ] -} +P_GRAPH(pipe-ll-capture-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(Low Latency Capture PCM_ID, N_PCMC)', + `dapm(N_PCMC, N_BUFFER(1))', + `dapm(N_BUFFER(1), N_PGA(0))', + `dapm(N_PGA(0), N_BUFFER(0))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-low-latency-playback.m4 b/topology/sof/pipe-low-latency-playback.m4 index 3b8d6aa..a278a2a 100644 --- a/topology/sof/pipe-low-latency-playback.m4 +++ b/topology/sof/pipe-low-latency-playback.m4 @@ -82,20 +82,15 @@ W_BUFFER(3, COMP_BUFFER_SIZE(2, # pipeline n+3 >---+ .....etc....more pipes can be mixed here #
-SectionGraph."pipe-ll-playback-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(N_PCMP, Low Latency Playback PCM_ID) - dapm(N_BUFFER(0), N_PCMP) - dapm(N_PGA(0), N_BUFFER(0)) - dapm(N_BUFFER(1), N_PGA(0)) - dapm(N_MIXER(0), N_BUFFER(1)) - dapm(N_BUFFER(2), N_MIXER(0)) - dapm(N_PGA(1), N_BUFFER(2)) - dapm(N_BUFFER(3), N_PGA(1)) - ] -} +P_GRAPH(pipe-ll-playback-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(N_PCMP, Low Latency Playback PCM_ID)', + `dapm(N_BUFFER(0), N_PCMP)', + `dapm(N_PGA(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_PGA(0))', + `dapm(N_MIXER(0), N_BUFFER(1))', + `dapm(N_BUFFER(2), N_MIXER(0))', + `dapm(N_PGA(1), N_BUFFER(2))', + `dapm(N_BUFFER(3), N_PGA(1))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-passthrough-capture.m4 b/topology/sof/pipe-passthrough-capture.m4 index 2c2a495..aae92b9 100644 --- a/topology/sof/pipe-passthrough-capture.m4 +++ b/topology/sof/pipe-passthrough-capture.m4 @@ -35,14 +35,9 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHE # # host PCM_C <-- B0 <-- sink DAI0
-SectionGraph."pipe-pass-capture-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(Passthrough Capture PCM_ID, N_PCMC) - dapm(N_PCMC, N_BUFFER(0)) - ] -} +P_GRAPH(pipe-pass-capture-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(Passthrough Capture PCM_ID, N_PCMC)', + `dapm(N_PCMC, N_BUFFER(0))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-passthrough-playback.m4 b/topology/sof/pipe-passthrough-playback.m4 index 1722256..71be139 100644 --- a/topology/sof/pipe-passthrough-playback.m4 +++ b/topology/sof/pipe-passthrough-playback.m4 @@ -35,14 +35,9 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCH # # host PCM_P --> B0 --> sink DAI0
-SectionGraph."pipe-pass-playback-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(N_PCMP, Passthrough Playback PCM_ID) - dapm(N_BUFFER(0), N_PCMP) - ] -} +P_GRAPH(pipe-pass-playback-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(N_PCMP, Passthrough Playback PCM_ID)', + `dapm(N_BUFFER(0), N_PCMP)'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-pcm-media.m4 b/topology/sof/pipe-pcm-media.m4 index 65dc62d..b3a306c 100644 --- a/topology/sof/pipe-pcm-media.m4 +++ b/topology/sof/pipe-pcm-media.m4 @@ -68,18 +68,13 @@ W_BUFFER(2, COMP_BUFFER_SIZE(3, # PCM --B0--> volume --B1--> SRC --> B2 --> Endpoint Pipeline #
-SectionGraph."pipe-media-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(N_PCMP, Media Playback PCM_ID) - dapm(N_BUFFER(0), N_PCMP) - dapm(N_PGA(0), N_BUFFER(0)) - dapm(N_BUFFER(1), N_PGA(0)) - dapm(N_SRC(0), N_BUFFER(1)) - dapm(N_BUFFER(2), N_SRC(0)) - ] -} +P_GRAPH(pipe-media-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(N_PCMP, Media Playback PCM_ID)', + `dapm(N_BUFFER(0), N_PCMP)', + `dapm(N_PGA(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_PGA(0))', + `dapm(N_SRC(0), N_BUFFER(1))' + `dapm(N_BUFFER(2), N_SRC(0))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-src-capture.m4 b/topology/sof/pipe-src-capture.m4 index dc55dd2..1af9826 100644 --- a/topology/sof/pipe-src-capture.m4 +++ b/topology/sof/pipe-src-capture.m4 @@ -58,16 +58,11 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, # # host PCM_P --> B0 --> SRC 0 --> B1 --> sink DAI0
-SectionGraph."pipe-pass-src-capture-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(Passthrough Capture PCM_ID, N_PCMC) - dapm(N_PCMC, N_BUFFER(0)) - dapm(N_BUFFER(0), N_SRC(0)) - dapm(N_SRC(0), N_BUFFER(1)) - ] -} +P_GRAPH(pipe-pass-src-capture-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(Passthrough Capture PCM_ID, N_PCMC)', + `dapm(N_PCMC, N_BUFFER(0))', + `dapm(N_BUFFER(0), N_SRC(0))', + `dapm(N_SRC(0), N_BUFFER(1))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-src-playback.m4 b/topology/sof/pipe-src-playback.m4 index d037543..608ce0f 100644 --- a/topology/sof/pipe-src-playback.m4 +++ b/topology/sof/pipe-src-playback.m4 @@ -58,16 +58,11 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, # # host PCM_P --> B0 --> SRC 0 --> B1 --> sink DAI0
-SectionGraph."pipe-pass-src-playback-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(N_PCMP, Passthrough Playback PCM_ID) - dapm(N_BUFFER(0), N_PCMP) - dapm(N_SRC(0), N_BUFFER(0)) - dapm(N_BUFFER(1), N_SRC(0)) - ] -} +P_GRAPH(pipe-pass-src-playback-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(N_PCMP, Passthrough Playback PCM_ID)', + `dapm(N_BUFFER(0), N_PCMP)', + `dapm(N_SRC(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_SRC(0))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 index b735146..6e33eec 100644 --- a/topology/sof/pipe-tone.m4 +++ b/topology/sof/pipe-tone.m4 @@ -55,15 +55,10 @@ W_BUFFER(1, COMP_BUFFER_SIZE(2, # Tone --B0--> volume --B1--> Endpoint Pipeline #
-SectionGraph."pipe-tone-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(N_BUFFER(0), N_TONE(0)) - dapm(N_PGA(0), N_BUFFER(0)) - dapm(N_BUFFER(1), N_PGA(0)) - ] -} +P_GRAPH(pipe-tone-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(N_BUFFER(0), N_TONE(0))', + `dapm(N_PGA(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_PGA(0))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-volume-capture.m4 b/topology/sof/pipe-volume-capture.m4 index 1cde24e..21335f1 100644 --- a/topology/sof/pipe-volume-capture.m4 +++ b/topology/sof/pipe-volume-capture.m4 @@ -53,16 +53,11 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, # # host PCM_P <-- B0 <-- Volume 0 <-- B1 <-- sink DAI0
-SectionGraph."pipe-pass-vol-capture-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(Passthrough Capture PCM_ID, N_PCMC) - dapm(N_PCMC, N_BUFFER(0)) - dapm(N_BUFFER(0), N_PGA(0)) - dapm(N_PGA(0), N_BUFFER(1)) - ] -} +P_GRAPH(pipe-pass-vol-capture-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(Passthrough Capture PCM_ID, N_PCMC)', + `dapm(N_PCMC, N_BUFFER(0))', + `dapm(N_BUFFER(0), N_PGA(0))', + `dapm(N_PGA(0), N_BUFFER(1))'))
# # Pipeline Source and Sinks diff --git a/topology/sof/pipe-volume-playback.m4 b/topology/sof/pipe-volume-playback.m4 index a6b5a1d..7ea823a 100644 --- a/topology/sof/pipe-volume-playback.m4 +++ b/topology/sof/pipe-volume-playback.m4 @@ -62,16 +62,11 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, # # host PCM_P --> B0 --> Volume 0 --> B1 --> sink DAI0
-SectionGraph."pipe-pass-vol-playback-PIPELINE_ID" { - index STR(PIPELINE_ID) - - lines [ - dapm(N_PCMP, Passthrough Playback PCM_ID) - dapm(N_BUFFER(0), N_PCMP) - dapm(N_PGA(0), N_BUFFER(0)) - dapm(N_BUFFER(1), N_PGA(0)) - ] -} +P_GRAPH(pipe-pass-vol-playback-PIPELINE_ID, PIPELINE_ID, + PIPELINEGRAPH(`dapm(N_PCMP, Passthrough Playback PCM_ID)', + `dapm(N_BUFFER(0), N_PCMP)', + `dapm(N_PGA(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_PGA(0))'))
# # Pipeline Source and Sinks