[Sound-open-firmware] [PATCH] topology: pcm: Fix PCM ID for topologies > 1 PCM

Liam Girdwood liam.r.girdwood at linux.intel.com
Fri Mar 16 18:18:33 CET 2018


PCM number was not being preserved and was always zero. This would
overwrite previous PCMs and cause the FW to return invalid PCM error
messages.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 topology/m4/pcm.m4                        | 36 +++++++++++++++----------------
 topology/sof/pipe-low-latency-capture.m4  |  6 +++---
 topology/sof/pipe-low-latency-playback.m4 |  6 +++---
 topology/sof/pipe-passthrough-capture.m4  |  6 +++---
 topology/sof/pipe-passthrough-playback.m4 |  6 +++---
 topology/sof/pipe-pcm-media.m4            |  6 +++---
 topology/sof/pipe-src-capture.m4          |  6 +++---
 topology/sof/pipe-src-playback.m4         |  6 +++---
 topology/sof/pipe-volume-capture.m4       |  6 +++---
 topology/sof/pipe-volume-playback.m4      |  6 +++---
 10 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/topology/m4/pcm.m4 b/topology/m4/pcm.m4
index 596f2fe..f77cb01 100644
--- a/topology/m4/pcm.m4
+++ b/topology/m4/pcm.m4
@@ -3,18 +3,18 @@ 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')
+define(`N_PCMP', `PCM'$1`P')
+define(`N_PCMC', `PCM'$1`C')
 
-dnl W_PCM_PLAYBACK(stream, dmac, dmac_chan, periods_sink, periods_source, preload)
+dnl W_PCM_PLAYBACK(pcm, 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)
+`		SOF_TKN_COMP_PERIOD_SINK_COUNT'		STR($5)
+`		SOF_TKN_COMP_PERIOD_SOURCE_COUNT'	STR($6)
+`		SOF_TKN_COMP_PRELOAD_COUNT'		STR($7)
 `	}'
 `}'
 `SectionData."'N_PCMP($1)`_data_w_comp" {'
@@ -23,18 +23,18 @@ define(`W_PCM_PLAYBACK',
 `SectionVendorTuples."'N_PCMP($1)`_tuples" {'
 `	tokens "sof_pcm_tokens"'
 `	tuples."word" {'
-`		SOF_TKN_PCM_DMAC'	STR($2)
-`		SOF_TKN_PCM_DMAC_CHAN'	STR($3)
+`		SOF_TKN_PCM_DMAC'	STR($3)
+`		SOF_TKN_PCM_DMAC_CHAN'	STR($4)
 `	}'
 `}'
 `SectionData."'N_PCMP($1)`_data" {'
 `	tuples "'N_PCMP($1)`_tuples"'
 `}'
-`SectionWidget."'N_PCMP`" {'
+`SectionWidget."'N_PCMP($1)`" {'
 `	index "'PIPELINE_ID`"'
 `	type "aif_in"'
 `	no_pm "true"'
-`	stream_name "'$1`"'
+`	stream_name "'$2`"'
 `	data ['
 `		"'N_PCMP($1)`_data"'
 `		"'N_PCMP($1)`_data_w_comp"'
@@ -42,14 +42,14 @@ define(`W_PCM_PLAYBACK',
 `}')
 
 
-dnl W_PCM_CAPTURE(stream, dmac, dmac_chan, periods_sink, periods_source, preload)
+dnl W_PCM_CAPTURE(pcm, 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)
+`		SOF_TKN_COMP_PERIOD_SINK_COUNT'		STR($5)
+`		SOF_TKN_COMP_PERIOD_SOURCE_COUNT'	STR($6)
+`		SOF_TKN_COMP_PRELOAD_COUNT'		STR($7)
 `	}'
 `}'
 `SectionData."'N_PCMC($1)`_data_w_comp" {'
@@ -58,18 +58,18 @@ define(`W_PCM_CAPTURE',
 `SectionVendorTuples."'N_PCMC($1)`_tuples" {'
 `	tokens "sof_pcm_tokens"'
 `	tuples."word" {'
-`		SOF_TKN_PCM_DMAC'	STR($2)
-`		SOF_TKN_PCM_DMAC_CHAN'	STR($3)
+`		SOF_TKN_PCM_DMAC'	STR($3)
+`		SOF_TKN_PCM_DMAC_CHAN'	STR($4)
 `	}'
 `}'
 `SectionData."'N_PCMC($1)`_data" {'
 `	tuples "'N_PCMC($1)`_tuples"'
 `}'
-`SectionWidget."'N_PCMC`" {'
+`SectionWidget."'N_PCMC($1)`" {'
 `	index "'PIPELINE_ID`"'
 `	type "aif_out"'
 `	no_pm "true"'
-`	stream_name "'$1`"'
+`	stream_name "'$2`"'
 `	data ['
 `		"'N_PCMC($1)`_data"'
 `		"'N_PCMC($1)`_data_w_comp"'
diff --git a/topology/sof/pipe-low-latency-capture.m4 b/topology/sof/pipe-low-latency-capture.m4
index 5619999..96fa3cc 100644
--- a/topology/sof/pipe-low-latency-capture.m4
+++ b/topology/sof/pipe-low-latency-capture.m4
@@ -29,7 +29,7 @@ C_CONTROLMIXER(PCM PCM_ID Capture Volume, PIPELINE_ID,
 
 # Host "Low Latency Capture" PCM uses pipeline DMAC and channel
 # with 0 sink and 2 source periods
-W_PCM_CAPTURE(Low Latency Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 0)
+W_PCM_CAPTURE(PCM_ID, Low Latency Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 0)
 
 # "Capture Volume" has 2 sink and source periods for host and DAI ping-pong
 W_PGA(0, PIPELINE_FORMAT, 2, 2, 0, LIST(`		', "PCM PCM_ID Capture Volume"))
@@ -49,8 +49,8 @@ W_BUFFER(1, COMP_BUFFER_SIZE(2,
 
 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(Low Latency Capture PCM_ID, N_PCMC(PCM_ID))',
+	`dapm(N_PCMC(PCM_ID), N_BUFFER(1))',
 	`dapm(N_BUFFER(1), N_PGA(0))',
 	`dapm(N_PGA(0), N_BUFFER(0))'))
 
diff --git a/topology/sof/pipe-low-latency-playback.m4 b/topology/sof/pipe-low-latency-playback.m4
index 4a4fca9..b7f2d11 100644
--- a/topology/sof/pipe-low-latency-playback.m4
+++ b/topology/sof/pipe-low-latency-playback.m4
@@ -54,7 +54,7 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID,
 
 # Host "Low latency Playback" PCM uses pipeline DMAC and channel
 # with 2 sink and 0 source periods
-W_PCM_PLAYBACK(Low Latency Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
+W_PCM_PLAYBACK(PCM_ID, Low Latency Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
 
 # "Playback Volume" has 1 sink period and 2 source periods for host ping-pong
 W_PGA(0, PIPELINE_FORMAT, 1, 2, 1, LIST(`		', "PCM PCM_ID Playback Volume"))
@@ -93,8 +93,8 @@ W_BUFFER(3, COMP_BUFFER_SIZE(2,
 
 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_PCMP(PCM_ID), Low Latency Playback PCM_ID)',
+	`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
 	`dapm(N_PGA(0), N_BUFFER(0))',
 	`dapm(N_BUFFER(1), N_PGA(0))',
 	`dapm(N_MIXER(0), N_BUFFER(1))',
diff --git a/topology/sof/pipe-passthrough-capture.m4 b/topology/sof/pipe-passthrough-capture.m4
index 07961b3..ff7c842 100644
--- a/topology/sof/pipe-passthrough-capture.m4
+++ b/topology/sof/pipe-passthrough-capture.m4
@@ -17,7 +17,7 @@ include(`pipeline.m4')
 
 # Host "Passthrough Capture" PCM uses pipeline DMAC and channel
 # with 0 sink and 2 source periods
-W_PCM_CAPTURE(Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 2)
+W_PCM_CAPTURE(PCM_ID, Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 2)
 
 # Capture Buffers
 W_BUFFER(0, COMP_BUFFER_SIZE(2,
@@ -41,8 +41,8 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCHE
 
 P_GRAPH(pipe-pass-capture-PIPELINE_ID, PIPELINE_ID,
 	LIST(`		',
-	`dapm(Passthrough Capture PCM_ID, N_PCMC)',
-	`dapm(N_PCMC, N_BUFFER(0))'))
+	`dapm(Passthrough Capture PCM_ID, N_PCMC(PCM_ID))',
+	`dapm(N_PCMC(PCM_ID), N_BUFFER(0))'))
 
 #
 # Pipeline Source and Sinks
diff --git a/topology/sof/pipe-passthrough-playback.m4 b/topology/sof/pipe-passthrough-playback.m4
index 715fcee..84aa126 100644
--- a/topology/sof/pipe-passthrough-playback.m4
+++ b/topology/sof/pipe-passthrough-playback.m4
@@ -17,7 +17,7 @@ include(`pipeline.m4')
 
 # Host "Passthrough Playback" PCM uses pipeline DMAC and channel
 # with 2 sink and 0 source periods
-W_PCM_PLAYBACK(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
+W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
 
 # Playback Buffers
 W_BUFFER(0, COMP_BUFFER_SIZE(2,
@@ -41,8 +41,8 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES, SCH
 
 P_GRAPH(pipe-pass-playback-PIPELINE_ID, PIPELINE_ID,
 	LIST(`		',
-	`dapm(N_PCMP, Passthrough Playback PCM_ID)',
-	`dapm(N_BUFFER(0), N_PCMP)'))
+	`dapm(N_PCMP(PCM_ID), Passthrough Playback PCM_ID)',
+	`dapm(N_BUFFER(0), N_PCMP(PCM_ID))'))
 
 #
 # Pipeline Source and Sinks
diff --git a/topology/sof/pipe-pcm-media.m4 b/topology/sof/pipe-pcm-media.m4
index f2053b7..1ca829f 100644
--- a/topology/sof/pipe-pcm-media.m4
+++ b/topology/sof/pipe-pcm-media.m4
@@ -41,7 +41,7 @@ W_DATA(media_src_conf, media_src_tokens)
 
 # Host "Low latency Playback" PCM uses pipeline DMAC and channel
 # with 2 sink and 0 source periods
-W_PCM_PLAYBACK(Media Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
+W_PCM_PLAYBACK(PCM_ID, Media Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
 
 # "Playback Volume" has 2 sink period and 2 source periods for host ping-pong
 W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(`		', "PCM PCM_ID Playback Volume"))
@@ -70,8 +70,8 @@ W_BUFFER(2, COMP_BUFFER_SIZE(3,
 
 P_GRAPH(pipe-media-PIPELINE_ID, PIPELINE_ID,
 	LIST(`		',
-	`dapm(N_PCMP, Media Playback PCM_ID)',
-	`dapm(N_BUFFER(0), N_PCMP)',
+	`dapm(N_PCMP(PCM_ID), Media Playback PCM_ID)',
+	`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
 	`dapm(N_PGA(0), N_BUFFER(0))',
 	`dapm(N_BUFFER(1), N_PGA(0))',
 	`dapm(N_SRC(0), N_BUFFER(1))'
diff --git a/topology/sof/pipe-src-capture.m4 b/topology/sof/pipe-src-capture.m4
index 1b1a58d..54eeea3 100644
--- a/topology/sof/pipe-src-capture.m4
+++ b/topology/sof/pipe-src-capture.m4
@@ -18,7 +18,7 @@ include(`pipeline.m4')
 
 # Host "Passthrough Capture" PCM uses pipeline DMAC and channel
 # with 4 sink and 0 source periods
-W_PCM_CAPTURE(Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 4, 0, 2)
+W_PCM_CAPTURE(PCM_ID, Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 4, 0, 2)
 
 #
 # SRC Configuration
@@ -58,8 +58,8 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES,
 
 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(Passthrough Capture PCM_ID, N_PCMC(PCM_ID))',
+	`dapm(N_PCMC(PCM_ID), N_BUFFER(0))',
 	`dapm(N_BUFFER(0), N_SRC(0))',
 	`dapm(N_SRC(0), N_BUFFER(1))'))
 
diff --git a/topology/sof/pipe-src-playback.m4 b/topology/sof/pipe-src-playback.m4
index 9dfdcd8..51237ac 100644
--- a/topology/sof/pipe-src-playback.m4
+++ b/topology/sof/pipe-src-playback.m4
@@ -18,7 +18,7 @@ include(`pipeline.m4')
 
 # Host "Passthrough Playback" PCM uses pipeline DMAC and channel
 # with 4 sink and 0 source periods
-W_PCM_PLAYBACK(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 4, 0, 2)
+W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 4, 0, 2)
 
 #
 # SRC Configuration
@@ -58,8 +58,8 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES,
 
 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_PCMP(PCM_ID), Passthrough Playback PCM_ID)',
+	`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
 	`dapm(N_SRC(0), N_BUFFER(0))',
 	`dapm(N_BUFFER(1), N_SRC(0))'))
 
diff --git a/topology/sof/pipe-volume-capture.m4 b/topology/sof/pipe-volume-capture.m4
index 61b70a9..c3917ca 100644
--- a/topology/sof/pipe-volume-capture.m4
+++ b/topology/sof/pipe-volume-capture.m4
@@ -31,7 +31,7 @@ C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID,
 
 # Host "Passthrough Capture" PCM uses pipeline DMAC and channel
 # with 0 sink and 2 source periods
-W_PCM_CAPTURE(Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 2)
+W_PCM_CAPTURE(PCM_ID, Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 2)
 
 # "Volume" has 2 source and 2 sink periods
 W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(`		', "Master Capture Volume"))
@@ -63,8 +63,8 @@ W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES,
 
 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(Passthrough Capture PCM_ID, N_PCMC(PCM_ID))',
+	`dapm(N_PCMC(PCM_ID), N_BUFFER(0))',
 	`dapm(N_BUFFER(0), N_PGA(0))',
 	`dapm(N_PGA(0), N_BUFFER(1))'))
 
diff --git a/topology/sof/pipe-volume-playback.m4 b/topology/sof/pipe-volume-playback.m4
index 5fea0c7..194aad9 100644
--- a/topology/sof/pipe-volume-playback.m4
+++ b/topology/sof/pipe-volume-playback.m4
@@ -31,7 +31,7 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID,
 
 # Host "Passthrough Playback" PCM uses pipeline DMAC and channel
 # with 2 sink and 0 source periods
-W_PCM_PLAYBACK(Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
+W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2)
 
 # "Volume" has 2 source and 2 sink periods
 W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(`		', "Master Playback Volume"))
@@ -63,8 +63,8 @@ W_PIPELINE(N_DAI_OUT, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES,
 
 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_PCMP(PCM_ID), Passthrough Playback PCM_ID)',
+	`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
 	`dapm(N_PGA(0), N_BUFFER(0))',
 	`dapm(N_BUFFER(1), N_PGA(0))'))
 
-- 
2.14.1



More information about the Sound-open-firmware mailing list