[Sound-open-firmware] [PATCH v4 5/8] topology: create m4 wrapper for Graph section

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Mon Mar 5 22:58:30 CET 2018


This patch adds a m4 wrpper for Graph sections in pipeline definition

Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
 topology/m4/local.m4                      | 11 +++++++++++
 topology/sof/pipe-dai-capture.m4          |  9 ++-------
 topology/sof/pipe-dai-playback.m4         |  9 ++-------
 topology/sof/pipe-low-latency-capture.m4  | 16 ++++++----------
 topology/sof/pipe-low-latency-playback.m4 | 24 ++++++++++--------------
 topology/sof/pipe-passthrough-capture.m4  | 12 ++++--------
 topology/sof/pipe-passthrough-playback.m4 | 12 ++++--------
 topology/sof/pipe-pcm-media.m4            | 20 ++++++++------------
 topology/sof/pipe-src-capture.m4          | 16 ++++++----------
 topology/sof/pipe-src-playback.m4         | 16 ++++++----------
 topology/sof/pipe-tone.m4                 | 14 +++++---------
 topology/sof/pipe-volume-capture.m4       | 16 ++++++----------
 topology/sof/pipe-volume-playback.m4      | 16 ++++++----------
 13 files changed, 76 insertions(+), 115 deletions(-)

diff --git a/topology/m4/local.m4 b/topology/m4/local.m4
index 535bb66..690f677 100644
--- a/topology/m4/local.m4
+++ b/topology/m4/local.m4
@@ -605,6 +605,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..3699138 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,
+	LIST(`		', `dapm(DAI_BUF, N_DAI_IN)'))
diff --git a/topology/sof/pipe-dai-playback.m4 b/topology/sof/pipe-dai-playback.m4
index 3a7a158..d35d3b1 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,
+	LIST(`		', `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 057312d..07b59ad 100644
--- a/topology/sof/pipe-low-latency-capture.m4
+++ b/topology/sof/pipe-low-latency-capture.m4
@@ -43,16 +43,12 @@ 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,
+	LIST(`		',
+	`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 f434ce1..7c39f16 100644
--- a/topology/sof/pipe-low-latency-playback.m4
+++ b/topology/sof/pipe-low-latency-playback.m4
@@ -86,20 +86,16 @@ 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,
+	LIST(`		',
+	`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 b0dfe48..8ef8a81 100644
--- a/topology/sof/pipe-passthrough-capture.m4
+++ b/topology/sof/pipe-passthrough-capture.m4
@@ -36,14 +36,10 @@ 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,
+	LIST(`		',
+	`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 b86f1b3..a26b5eb 100644
--- a/topology/sof/pipe-passthrough-playback.m4
+++ b/topology/sof/pipe-passthrough-playback.m4
@@ -36,14 +36,10 @@ 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,
+	LIST(`		',
+	`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 e8c8158..8cb8ed5 100644
--- a/topology/sof/pipe-pcm-media.m4
+++ b/topology/sof/pipe-pcm-media.m4
@@ -71,18 +71,14 @@ 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,
+	LIST(`		',
+	`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 96d7ee7..44bb030 100644
--- a/topology/sof/pipe-src-capture.m4
+++ b/topology/sof/pipe-src-capture.m4
@@ -60,16 +60,12 @@ 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,
+	LIST(`		',
+	`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 a6141c9..d34bc8a 100644
--- a/topology/sof/pipe-src-playback.m4
+++ b/topology/sof/pipe-src-playback.m4
@@ -60,16 +60,12 @@ 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,
+	LIST(`		',
+	`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 507aeac..899c426 100644
--- a/topology/sof/pipe-tone.m4
+++ b/topology/sof/pipe-tone.m4
@@ -57,15 +57,11 @@ 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,
+	LIST(`		',
+	`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 56aed26..0aa10bc 100644
--- a/topology/sof/pipe-volume-capture.m4
+++ b/topology/sof/pipe-volume-capture.m4
@@ -55,16 +55,12 @@ 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,
+	LIST(`		',
+	`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 22de572..4ca8ab7 100644
--- a/topology/sof/pipe-volume-playback.m4
+++ b/topology/sof/pipe-volume-playback.m4
@@ -64,16 +64,12 @@ 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,
+	LIST(`		',
+	`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
-- 
2.14.1



More information about the Sound-open-firmware mailing list