From cb7541a7a27d862aba6d2798e709abaf2b4f862c Mon Sep 17 00:00:00 2001 From: Brent Lu Date: Wed, 22 Sep 2021 17:14:50 +0800 Subject: [PATCH 1/4] topology: pipe-demux-eq-iir-playback: remove macro 'matrix1 The demux routing matrix and config are removed for two reasons: 1. the config 'demux_priv_1' is hardcoded for pipeline 1 only. 2. other m4 file with demux compoenet like pipe-volume-demux-playback has the matrix and config defined in the topology file. The topology which implement this pipeline should define the routing matrx and config named as 'demux_priv_' before including this m4 file. Signed-off-by: Brent Lu (cherry picked from commit 771c2bb31828db8b277c960a9d58cc0abcde84fa) --- .../sof-apl-nocodec-demux-eq-2ch4ch.m4 | 21 +++++++++++++++++++ .../sof-apl-nocodec-demux-eq-4ch4ch.m4 | 21 +++++++++++++++++++ .../sof/pipe-demux-eq-iir-playback.m4 | 21 ------------------- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 index c15cc57476fe..0ce005818e15 100644 --- a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 +++ b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 @@ -11,6 +11,7 @@ include(`utils.m4') include(`dai.m4') include(`ssp.m4') include(`pipeline.m4') +include(`muxdemux.m4') # Include TLV library include(`common/tlv.m4') @@ -22,6 +23,26 @@ include(`sof/tokens.m4') include(`platform/intel/bxt.m4') include(`platform/intel/dmic.m4') +dnl Configure demux +dnl name, pipeline_id, routing_matrix_rows +dnl Diagonal 1's in routing matrix mean that every input channel is +dnl copied to corresponding output channels in all output streams. +dnl I.e. row index is the input channel, 1 means it is copied to +dnl corresponding output channel (column index), 0 means it is discarded. +dnl There's a separate matrix for all outputs. +define(matrix1, `ROUTE_MATRIX(1, + `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)')') + +dnl name, num_streams, route_matrix list +MUXDEMUX_CONFIG(demux_priv_1, 1, LIST(` ', `matrix1')) + # # Define the pipelines # diff --git a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 index 5e364457d849..9cd4fb81c91f 100644 --- a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 +++ b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 @@ -11,6 +11,7 @@ include(`utils.m4') include(`dai.m4') include(`ssp.m4') include(`pipeline.m4') +include(`muxdemux.m4') # Include TLV library include(`common/tlv.m4') @@ -22,6 +23,26 @@ include(`sof/tokens.m4') include(`platform/intel/bxt.m4') include(`platform/intel/dmic.m4') +dnl Configure demux +dnl name, pipeline_id, routing_matrix_rows +dnl Diagonal 1's in routing matrix mean that every input channel is +dnl copied to corresponding output channels in all output streams. +dnl I.e. row index is the input channel, 1 means it is copied to +dnl corresponding output channel (column index), 0 means it is discarded. +dnl There's a separate matrix for all outputs. +define(matrix1, `ROUTE_MATRIX(1, + `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', + `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)')') + +dnl name, num_streams, route_matrix list +MUXDEMUX_CONFIG(demux_priv_1, 1, LIST(` ', `matrix1')) + # # Define the pipelines # diff --git a/tools/topology/topology1/sof/pipe-demux-eq-iir-playback.m4 b/tools/topology/topology1/sof/pipe-demux-eq-iir-playback.m4 index 07d1a89ed7a0..a8679337019c 100644 --- a/tools/topology/topology1/sof/pipe-demux-eq-iir-playback.m4 +++ b/tools/topology/topology1/sof/pipe-demux-eq-iir-playback.m4 @@ -11,26 +11,6 @@ include(`muxdemux.m4') include(`bytecontrol.m4') include(`eq_iir.m4') -dnl Configure demux -dnl name, pipeline_id, routing_matrix_rows -dnl Diagonal 1's in routing matrix mean that every input channel is -dnl copied to corresponding output channels in all output streams. -dnl I.e. row index is the input channel, 1 means it is copied to -dnl corresponding output channel (column index), 0 means it is discarded. -dnl There's a separate matrix for all outputs. -define(matrix1, `ROUTE_MATRIX(1, - `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', - `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', - `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', - `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', - `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', - `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', - `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)', - `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)')') - -dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_1, 1, LIST(` ', `matrix1')) - # demux Bytes control with max value of 255 C_CONTROLBYTES(concat(`DEMUX', PIPELINE_ID), PIPELINE_ID, CONTROLBYTES_OPS(bytes, 258 binds the mixer control to bytes get/put handlers, 258, 258), @@ -135,6 +115,5 @@ indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Speaker Playback PCM_ID) # PCM capabilities supported by FW PCM_CAPABILITIES(Speaker Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), 48000, 48000, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536) -undefine(`matrix1') undefine(`DEF_EQIIR_COEF') undefine(`DEF_EQIIR_PRIV') From 54c2b09c2e30f0761d42faf22f062a0f541a963e Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Mon, 6 Dec 2021 14:07:24 -0800 Subject: [PATCH 2/4] topology1: sof-cml-src-rt5682: remove extra space after values The string parser in alsa-lib is sensitive to these now. So fix it. Signed-off-by: Ranjani Sridharan (cherry picked from commit db041556ce48b0535d5fa4d77d19d166e2938c05) --- tools/topology/topology1/development/sof-cml-src-rt5682.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/topology/topology1/development/sof-cml-src-rt5682.m4 b/tools/topology/topology1/development/sof-cml-src-rt5682.m4 index 7f0291237d0d..6358e7582bb3 100644 --- a/tools/topology/topology1/development/sof-cml-src-rt5682.m4 +++ b/tools/topology/topology1/development/sof-cml-src-rt5682.m4 @@ -70,7 +70,7 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4, 5, 3, 2, s32le, 1000, 0, 0, - 48000 ,48000 ,48000) + 48000, 48000, 48000) # Low Latency playback pipeline 6 on PCM 4 using max 2 channels of s32le. # Set 1000us deadline with priority 0 on core 0 From c42874ac8339cd09a41890148d87fc8bc6a1cf6b Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Sun, 5 Dec 2021 21:03:26 -0800 Subject: [PATCH 3/4] topology1: fix errors due to newline in list generator The recent changes to the string parser in alsa-lib cause the topology builds to break for some topologies. Avoid adding a newline for the bytes data for the MUXDEMUX config by introducing a new macro for creating lists without new lines between items. Signed-off-by: Ranjani Sridharan (cherry picked from commit 3e1c160e5053eae66769ad19955df83a08218270) --- .../topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 | 2 +- .../topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 | 2 +- tools/topology/topology1/development/sof-tgl-nocodec-ci.m4 | 2 +- tools/topology/topology1/m4/utils.m4 | 4 ++++ tools/topology/topology1/sof-adl-nau8825.m4 | 2 +- tools/topology/topology1/sof-apl-demux-pcm512x.m4 | 2 +- tools/topology/topology1/sof-cml-demux-rt5682.m4 | 2 +- tools/topology/topology1/sof-icl-rt711-rt1308-rt715-hdmi.m4 | 2 +- tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 index 0ce005818e15..f14d194d4112 100644 --- a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 +++ b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-2ch4ch.m4 @@ -41,7 +41,7 @@ define(matrix1, `ROUTE_MATRIX(1, `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)')') dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_1, 1, LIST(` ', `matrix1')) +MUXDEMUX_CONFIG(demux_priv_1, 1, LIST_NONEWLINE(`', `matrix1')) # # Define the pipelines diff --git a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 index 9cd4fb81c91f..4db9b067903d 100644 --- a/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 +++ b/tools/topology/topology1/development/sof-apl-nocodec-demux-eq-4ch4ch.m4 @@ -41,7 +41,7 @@ define(matrix1, `ROUTE_MATRIX(1, `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)')') dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_1, 1, LIST(` ', `matrix1')) +MUXDEMUX_CONFIG(demux_priv_1, 1, LIST_NONEWLINE(`', `matrix1')) # # Define the pipelines diff --git a/tools/topology/topology1/development/sof-tgl-nocodec-ci.m4 b/tools/topology/topology1/development/sof-tgl-nocodec-ci.m4 index 6e84027cf481..c53242f9a73d 100644 --- a/tools/topology/topology1/development/sof-tgl-nocodec-ci.m4 +++ b/tools/topology/topology1/development/sof-tgl-nocodec-ci.m4 @@ -56,7 +56,7 @@ define(matrix2, `ROUTE_MATRIX(7, `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')') dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_1, 2, LIST(` ', `matrix1,', `matrix2')) +MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2')) # # Define the pipelines diff --git a/tools/topology/topology1/m4/utils.m4 b/tools/topology/topology1/m4/utils.m4 index b491a7dd5c4d..7dd05ce659ec 100644 --- a/tools/topology/topology1/m4/utils.m4 +++ b/tools/topology/topology1/m4/utils.m4 @@ -19,8 +19,12 @@ 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_LOOP_NONEWLINE', `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)') +define(`LIST_NONEWLINE', `pushdef(`i', $#)pushdef(`j', `2')LIST_LOOP_NONEWLINE($@)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($@)'))') diff --git a/tools/topology/topology1/sof-adl-nau8825.m4 b/tools/topology/topology1/sof-adl-nau8825.m4 index 3442771401f9..14937c7fc408 100644 --- a/tools/topology/topology1/sof-adl-nau8825.m4 +++ b/tools/topology/topology1/sof-adl-nau8825.m4 @@ -74,7 +74,7 @@ dnl There's a separate matrix for all outputs. `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')')' dnl name, num_streams, route_matrix list -`MUXDEMUX_CONFIG(demux_priv_1, 2, LIST(` ', `matrix1,', `matrix2'))') +`MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2'))') ifdef(`NO_AMP',,` ifdef(`SMART_AMP',` diff --git a/tools/topology/topology1/sof-apl-demux-pcm512x.m4 b/tools/topology/topology1/sof-apl-demux-pcm512x.m4 index a623e936104a..406bec97c9da 100644 --- a/tools/topology/topology1/sof-apl-demux-pcm512x.m4 +++ b/tools/topology/topology1/sof-apl-demux-pcm512x.m4 @@ -49,7 +49,7 @@ define(matrix2, `ROUTE_MATRIX(5, `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')') dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_1, 2, LIST(` ', `matrix1,', `matrix2')) +MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2')) # # Define the pipelines diff --git a/tools/topology/topology1/sof-cml-demux-rt5682.m4 b/tools/topology/topology1/sof-cml-demux-rt5682.m4 index 05fed76c990c..ff131dfb75b5 100644 --- a/tools/topology/topology1/sof-cml-demux-rt5682.m4 +++ b/tools/topology/topology1/sof-cml-demux-rt5682.m4 @@ -49,7 +49,7 @@ define(matrix2, `ROUTE_MATRIX(5, `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')') dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_1, 2, LIST(` ', `matrix1,', `matrix2')) +MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2')) # # Define the pipelines diff --git a/tools/topology/topology1/sof-icl-rt711-rt1308-rt715-hdmi.m4 b/tools/topology/topology1/sof-icl-rt711-rt1308-rt715-hdmi.m4 index 5c1dff936517..5c5937fccb89 100644 --- a/tools/topology/topology1/sof-icl-rt711-rt1308-rt715-hdmi.m4 +++ b/tools/topology/topology1/sof-icl-rt711-rt1308-rt715-hdmi.m4 @@ -63,7 +63,7 @@ define(matrix2, `ROUTE_MATRIX(4, `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')') dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_3, 2, LIST(` ', `matrix1,', `matrix2')) +MUXDEMUX_CONFIG(demux_priv_3, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2')) ') # diff --git a/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 b/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 index 8797458daf7d..2a1538de4a37 100644 --- a/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 +++ b/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 @@ -52,7 +52,7 @@ define(matrix2, `ROUTE_MATRIX(9, `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')') dnl name, num_streams, route_matrix list -MUXDEMUX_CONFIG(demux_priv_1, 2, LIST(` ', `matrix1,', `matrix2')) +MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2')) # # Define the pipelines From 30ed91c19b1f9c3dc4c0130e64f90f22a3bd0f67 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 5 Jan 2022 16:15:08 -0800 Subject: [PATCH 4/4] test: topology: fix build with latest alsa-lib Remove the extra space to make the topology build with upstream alsa-lib. Signed-off-by: Ranjani Sridharan (cherry picked from commit fcfd5d65be08f01598174bc574834b29d733a347) --- tools/test/topology/test-all.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/topology/test-all.m4 b/tools/test/topology/test-all.m4 index 236b503dd666..fd0404c5fa6e 100644 --- a/tools/test/topology/test-all.m4 +++ b/tools/test/topology/test-all.m4 @@ -86,7 +86,7 @@ PCM_DUPLEX_ADD(Passthrough, 0, PIPELINE_PCM_1, PIPELINE_PCM_2) # using TEST_SSP_PHY_BITS bit sample container on SSP TEST_DAI_PORT # DAI_CONFIG(TEST_DAI_TYPE, TEST_DAI_PORT, - ifelse(index(TEST_DAI_LINK_NAME, NoCodec), -1, 0 ,TEST_DAI_PORT), + ifelse(index(TEST_DAI_LINK_NAME, NoCodec), -1, 0, TEST_DAI_PORT), TEST_DAI_LINK_NAME, SSP_CONFIG(TEST_SSP_MODE, SSP_CLOCK(mclk, TEST_SSP_MCLK, codec_mclk_in),