[Sound-open-firmware] [PATCH v3 3/8] topology: add a test hostless tone pipeline
Ranjani Sridharan
ranjani.sridharan at linux.intel.com
Mon Mar 5 21:40:19 CET 2018
This patch adds changes to create a test hostless tone pipeline.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
topology/test/test-tone-playback-ssp.m4 | 62 +++++++++++++++++++++++++++++++++
topology/test/tplg-build.sh | 38 +++++++++++++++++++-
2 files changed, 99 insertions(+), 1 deletion(-)
create mode 100644 topology/test/test-tone-playback-ssp.m4
diff --git a/topology/test/test-tone-playback-ssp.m4 b/topology/test/test-tone-playback-ssp.m4
new file mode 100644
index 0000000..2fe6693
--- /dev/null
+++ b/topology/test/test-tone-playback-ssp.m4
@@ -0,0 +1,62 @@
+#
+# Topology for Tone Generator Playback
+#
+
+# Include topology builder
+include(`local.m4')
+include(`build.m4')
+
+# Include TLV library
+include(`common/tlv.m4')
+
+# Include Token library
+include(`sof/tokens.m4')
+
+# Include Baytrail DSP configuration
+include(`dsps/byt.m4')
+
+#
+# Machine Specific Config - !! MUST BE SET TO MATCH TEST MACHINE DRIVER !!
+#
+# TEST_PIPE_NAME - Pipe name
+# TEST_DAI_LINK_NAME - BE DAI link name e.g. "NoCodec"
+# TEST_SSP_PORT - SSP port number e.g. 2
+# TEST_SSP_FORMAT - SSP data format e.g s16le
+# TEST_PIPE_FORMAT - Pipeline format e.g. s16le
+# TEST_SSP_MCLK - SSP MCLK in Hz
+# TEST_SSP_BCLK - SSP BCLK in Hz
+# TEST_SSP_PHY_BITS - SSP physical slot size
+# TEST_SSP_DATA_BITS - SSP data slot size
+#
+
+#
+# Define the pipeline
+#
+# Tone --B0--> volume --B1--> SSP2
+#
+
+# Tone Playback pipeline 5 using max 2 channels of TEST_PIPE_FORMAT.
+# Schedule with 48 frame per 1000us deadline on core 0 with priority 0
+PIPELINE_ADD(sof/pipe-tone.m4,
+ 5, 2, TEST_PIPE_FORMAT,
+ 48, 1000, 0, 0)
+
+# playback DAI is SSP2 using 2 periods
+# Buffers use TEST_SSP_FORMAT format, with 48 frame per 1000us on core 0 with priority 0
+DAI_ADD(sof/pipe-dai-playback.m4,
+ 5, SSP, TEST_SSP_PORT,
+ PIPELINE_SOURCE_5, 2, TEST_SSP_FORMAT,
+ 48, 1000, 2, 0)
+
+#
+# BE configurations - overrides config in ACPI if present
+#
+# Clocks masters wrt codec
+#
+# TEST_SSP_DATA_BITS bit I2S using TEST_SSP_PHY_BITS bit sample conatiner on SSP TEST_SSP_PORT
+#
+DAI_CONFIG(SSP, TEST_SSP_PORT, TEST_DAI_LINK_NAME, I2S, TEST_SSP_DATA_BITS,
+ DAI_CLOCK(mclk, TEST_SSP_MCLK, slave),
+ DAI_CLOCK(bclk, TEST_SSP_BCLK, slave),
+ DAI_CLOCK(fsync, 48000, slave),
+ DAI_TDM(2, TEST_SSP_PHY_BITS, 3, 3))
diff --git a/topology/test/tplg-build.sh b/topology/test/tplg-build.sh
index 9022d1c..eaa6f8b 100755
--- a/topology/test/tplg-build.sh
+++ b/topology/test/tplg-build.sh
@@ -13,6 +13,8 @@ M4_FLAGS="-I ../ -I ../m4 -I ../common"
# Simple component test cases
# can be used on components with 1 sink and 1 source.
SIMPLE_TESTS=(test-ssp test-capture-ssp test-playback-ssp)
+TONE_TEST=test-tone-playback-ssp
+
# process m4 simple tests -
# simple_test(name, pipe_name, be_name, format, dai_id, dai_format, dai_phy_bits, dai_data_bits dai_bclk)
@@ -23,7 +25,7 @@ SIMPLE_TESTS=(test-ssp test-capture-ssp test-playback-ssp)
# 5) dai_id - SSP port number
# 6) dai_format - SSP sample format
# 7) dai_phy_bits - SSP physical number of BLKCs per slot/channel
-# 8) dai_data_bits - SSP number of valid daat bits per slot/channel
+# 8) dai_data_bits - SSP number of valid data bits per slot/channel
# 9) dai_bclk - SSP BCLK in HZ
# 10) dai_mclk - SSP MCLK in HZ
#
@@ -48,6 +50,37 @@ function simple_test {
done
}
+# process m4 tone test -
+# tone_test(name, pipe_name, be_name, format, dai_id, dai_format, dai_phy_bits, dai_data_bits dai_bclk)
+# 1) name - test filename suffix
+# 2) pipe_name - test component pipeline filename in sof/
+# 3) be_name - BE DAI link name in machine driver, used for matching
+# 4) format - PCM sample format
+# 5) dai_id - SSP port number
+# 6) dai_format - SSP sample format
+# 7) dai_phy_bits - SSP physical number of BLKCs per slot/channel
+# 8) dai_data_bits - SSP number of valid data bits per slot/channel
+# 9) dai_bclk - SSP BCLK in HZ
+# 10) dai_mclk - SSP MCLK in HZ
+#
+function tone_test {
+ TFILE="$TONE_TEST$5-$2-$4-$6-48k-$1"
+ echo "M4 pre-processing test $TONE_TEST -> ${TFILE}"
+ m4 ${M4_FLAGS} \
+ -DTEST_PIPE_NAME="$2" \
+ -DTEST_DAI_LINK_NAME="$3" \
+ -DTEST_SSP_PORT=$5 \
+ -DTEST_SSP_FORMAT=$6 \
+ -DTEST_PIPE_FORMAT=$4 \
+ -DTEST_SSP_BCLK=$9 \
+ -DTEST_SSP_MCLK=${10} \
+ -DTEST_SSP_PHY_BITS=$7 \
+ -DTEST_SSP_DATA_BITS=$8 \
+ $TONE_TEST.m4 > ${TFILE}.conf
+ echo "Compiling test $TONE_TEST -> ${TFILE}.tplg"
+ alsatplg -v 1 -c ${TFILE}.conf -o ${TFILE}.tplg
+}
+
# Pre-process the simple tests
simple_test nocodec passthrough "NoCodec" s16le 2 s16le 20 16 1920000 19200000
simple_test nocodec passthrough "NoCodec" s24le 2 s24le 25 24 2400000 19200000
@@ -74,4 +107,7 @@ simple_test baytrail src "Baytrail Audio" s24le 2 s24le 25 24 2400000 19200000
simple_test nocodec volume "NoCodec" s16le 4 s16le 16 16 1536000 24576000
simple_test codec volume "SSP4-Codec" s16le 4 s16le 16 16 1536000 24576000
+# Tone test: Tone component only supports s32le currently
+tone_test codec tone "SSP2-Codec" s32le 2 s16le 20 16 1920000 19200000
+
--
2.14.1
More information about the Sound-open-firmware
mailing list