topology: test: Add simple component test generator.

Move testing pipelines into a test directory and reuse test scaffolding
so that they can be used to test multiple components on multiple target
with multiples configs.

Test topology scafolding are now pre-processed using a script to generate
the ALSA conf format with the various changes for each test case.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2017-12-13 15:50:41 +00:00
parent 8b254b5f3d
commit c20762ecac
19 changed files with 371 additions and 499 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@ rmbox/rmbox
rwav/rwav
*.tplg
topology/*.conf
topology/test/*.conf

View File

@ -17,6 +17,7 @@ AC_OUTPUT([
rimage/Makefile
rmbox/Makefile
topology/Makefile
topology/test/Makefile
])
echo "

View File

@ -3,6 +3,8 @@
# Dependencies
#
SUBDIRS = test
DEPS = \
dsps/*.m4 \
common/*.m4 \
@ -25,14 +27,7 @@ MACHINES = \
reef-byt-rt5645.tplg \
reef-byt-rt5651.tplg \
reef-byt-da7212.tplg \
reef-hsw-rt5640.tplg \
test-passthrough-16bit-48k-ssp2-nocodec.tplg \
test-passthrough-24bit-48k-ssp2-nocodec.tplg \
test-passthrough-24bit-48k-ssp2.tplg \
test-passthrough-24bit-48k-ssp2-SSP2-Codec.tplg \
test-passthrough-16bit-48k-ssp2-SSP2-Codec.tplg \
test-passthrough-24bit-48k-vol-ssp2.tplg \
test-passthrough-24bit-48k-src-ssp2.tplg
reef-hsw-rt5640.tplg
# Uncomment the following line if you want to debug conf files
.PRECIOUS: %.conf

View File

@ -0,0 +1,95 @@
# Low Latency Passthrough with volume Pipeline and PCM
#
# Pipeline Endpoints for connection are :-
#
# host PCM_P --> SRC --> sink DAI0
# Include topology builder
include(`local.m4')
#
# Components and Buffers
#
# Host "Passthrough Playback" PCM uses pipeline DMAC and channel
# with 4 sink and 0 source periods
W_PCM_PLAYBACK(Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 4, 0, 2)
#
# SRC Configuration
#
SectionVendorTuples."media_src_tokens" {
tokens "sof_src_tokens"
tuples."word" {
SOF_TKN_SRC_RATE_OUT "48000"
}
}
SectionData."media_src_conf" {
tuples "media_src_tokens"
}
# "SRC" has 4 source and 4 sink periods
W_SRC(0, PIPELINE_FORMAT, 4, 4, media_src_conf, 2)
# Playback Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(4,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES))
W_BUFFER(1, COMP_BUFFER_SIZE(4,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES))
#
# DAI definitions
#
W_DAI_IN(DAI_TYPE, DAI_INDEX, DAI_FORMAT, 0, DAI_PERIODS,
DAI_PERIODS, dai0c_plat_conf)
#
# DAI pipeline
#
W_PIPELINE(N_DAI_IN, SCHEDULE_DEADLINE, SCHEDULE_PRIORITY, SCHEDULE_FRAMES,
SCHEDULE_CORE, 0, pipe_dai_schedule_plat)
#
# Pipeline Graph
#
# 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))
]
}
#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(1))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Capture PCM_ID)
#
# PCM Configuration
#
SectionPCMCapabilities.STR(Passthrough Capture PCM_ID) {
formats "S32_LE,S24_LE,S16_LE"
rate_min "8000"
rate_max "96000"
channels_min "2"
channels_max "4"
periods_min "2"
periods_max "16"
period_size_min "192"
period_size_max "16384"
buffer_size_min "65536"
buffer_size_max "65536"
}

View File

@ -66,10 +66,14 @@ SectionGraph."pipe-pass-src-playback-PIPELINE_ID" {
dapm(N_BUFFER(0), N_PCMP)
dapm(N_SRC(0), N_BUFFER(0))
dapm(N_BUFFER(1), N_SRC(0))
dapm(N_DAI_OUT, N_BUFFER(1))
]
}
#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(1))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Playback PCM_ID)
#
# PCM Configuration
@ -90,20 +94,3 @@ SectionPCMCapabilities.STR(Passthrough Playback PCM_ID) {
buffer_size_max "65536"
}
# PCM Passthrough Playback
SectionPCM.STR(PCM PCM_ID) {
index STR(PIPELINE_ID)
# used for binding to the PCM
id STR(PCM_ID)
dai.STR(Passthrough Playback PCM_ID) {
id STR(PCM_ID)
}
pcm."playback" {
capabilities STR(Passthrough Playback PCM_ID)
}
}

View File

@ -1,51 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `SSP2-Codec')
#
# Define the pipeline
#
# PCM0 ----> SSP2
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-playback.m4,
1, 0, 2, s16le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s16le, 2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 24bit I2S using 25bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 16,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 1920000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 20, 3, 3))

View File

@ -1,84 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `NoCodec')
#
# Define the pipeline
#
# PCM0 <---> SSP2
#
# Passthrough playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-playback.m4,
1, 0, 2, s16le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s16le, 2)
# Passthrough playback pipeline 2 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-capture.m4,
2, 0, 2, s16le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s16le, 2)
#
# DAI configuration
#
# SSP port 2 is our only pipeline DAI
#
# playback DAI is SSP2 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2,
PIPELINE_SOURCE_1, 2, s16le,
48, 1000, 0, 0)
# capture DAI is SSP2 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
2, SSP, 2,
PIPELINE_SINK_2, 2, s16le,
48, 1000, 0, 0)
# PCM Passthrough
PCM_DUPLEX_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 16bit I2S using 20bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 16,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 1920000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 20, 3, 3))

View File

@ -1,51 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `Baytrail Audio')
#
# Define the pipeline
#
# PCM0 ----> SSP2
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s16le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-playback.m4,
1, 0, 2, s16le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s16le, 2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 16bit I2S using 20bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 16,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 1920000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 20, 3, 3))

View File

@ -1,51 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `Baytrail Audio')
#
# Define the pipeline
#
# PCM0 ---> volume ---> SSP2
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-src-playback.m4,
1, 0, 2, s24le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s24le, 2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 24bit I2S using 25bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 24,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 2400000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 25, 3, 3))

View File

@ -1,51 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `SSP2-Codec')
#
# Define the pipeline
#
# PCM0 ----> SSP2
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-playback.m4,
1, 0, 2, s24le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s24le, 2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 24bit I2S using 25bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 24,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 2400000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 25, 3, 3))

View File

@ -1,51 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `NoCodec')
#
# Define the pipeline
#
# PCM0 ----> SSP2
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-playback.m4,
1, 0, 2, s24le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s24le, 2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 24bit I2S using 25bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 24,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 2400000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 25, 3, 3))

View File

@ -1,51 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `Baytrail Audio')
#
# Define the pipeline
#
# PCM0 ----> SSP2
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-playback.m4,
1, 0, 2, s24le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s24le, 2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 24bit I2S using 25bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 24,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 2400000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 25, 3, 3))

View File

@ -1,83 +0,0 @@
#
# Topology for pass through pipeline
#
# 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 !!
#
# DAI Link Name
define(`TEST_DAI_LINK_NAME', `Baytrail Audio')
#
# Define the pipeline
#
# PCM0 <---> volume <---> SSP2
#
# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-vol-playback.m4,
1, 0, 2, s24le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s24le, 2)
# Low Latency capture pipeline 2 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-passthrough-vol-capture.m4,
2, 0, 2, s24le,
48, 1000, 0, 0, 0, 1,
SSP, 2, s24le, 2)
#
# DAI configuration
#
# SSP port 2 is our only pipeline DAI
#
# playback DAI is SSP2 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, 2,
PIPELINE_SOURCE_1, 2, s24le,
48, 1000, 0, 0)
# capture DAI is SSP2 using 2 periods
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
2, SSP, 2,
PIPELINE_SINK_2, 2, s24le,
48, 1000, 0, 0)
# PCM Passthrough
PCM_DUPLEX_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
#
# BE configurations - overrides config in ACPI if present
#
# Clocks masters wrt codec
#
# 24bit I2S using 25bit sample conatiner on SSP2
#
DAI_CONFIG(SSP, 2, TEST_DAI_LINK_NAME, I2S, 24,
DAI_CLOCK(mclk, 19200000, slave),
DAI_CLOCK(bclk, 2400000, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, 25, 3, 3))

20
topology/test/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
#
# Dependencies
#
DEPS = \
../dsps/*.m4 \
../common/*.m4 \
../m4/*.m4 \
../sof/*.m4
# Uncomment the following line if you want to debug conf files
.PRECIOUS: %.conf
all : *.m4 ${DEPS}
./tplg-build.sh
clean:
rm -f *.conf
rm -f *.tplg

View File

@ -0,0 +1,90 @@
#
# Topology for pass through pipeline
#
# 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_BCLK - SSP BCLK in Hz
# TEST_SSP_PHY_BITS - SSP physical slot size
# TEST_SSP_DATA_BITS - SSP data slot size
#
#
# Define the pipeline
#
# PCM0 <--> SRC <--> SSP TEST_SSP_PORT
#
# Passthrough playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
1, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0, 0, 1,
SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2)
# Passthrough playback pipeline 2 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4,
2, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0, 0, 1,
SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2)
#
# DAI configuration
#
# SSP port TEST_SSP_PORT is our only pipeline DAI
#
# playback DAI is SSP TEST_SSP_PORT using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, TEST_SSP_PORT,
PIPELINE_SOURCE_1, 2, TEST_SSP_FORMAT,
48, 1000, 0, 0)
# capture DAI is SSP TEST_SSP_PORT using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
2, SSP, TEST_SSP_PORT,
PIPELINE_SINK_2, 2, TEST_SSP_FORMAT,
48, 1000, 0, 0)
# PCM Passthrough
PCM_DUPLEX_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
#
# 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, 19200000, slave),
DAI_CLOCK(bclk, TEST_SSP_BCLK, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, TEST_SSP_PHY_BITS, 3, 3))

90
topology/test/test-ssp.m4 Normal file
View File

@ -0,0 +1,90 @@
#
# Topology for pass through pipeline
#
# 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_BCLK - SSP BCLK in Hz
# TEST_SSP_PHY_BITS - SSP physical slot size
# TEST_SSP_DATA_BITS - SSP data slot size
#
#
# Define the pipeline
#
# PCM0 <---> SSP TEST_SSP_PORT
#
# Passthrough playback pipeline 1 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
1, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0, 0, 1,
SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2)
# Passthrough playback pipeline 2 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
# Use DMAC 0 channel 1 for PCM audio playback data
PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4,
2, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0, 0, 1,
SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2)
#
# DAI configuration
#
# SSP port TEST_SSP_PORT is our only pipeline DAI
#
# playback DAI is SSP TEST_SSP_PORT using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, TEST_SSP_PORT,
PIPELINE_SOURCE_1, 2, TEST_SSP_FORMAT,
48, 1000, 0, 0)
# capture DAI is SSP TEST_SSP_PORT using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
2, SSP, TEST_SSP_PORT,
PIPELINE_SINK_2, 2, TEST_SSP_FORMAT,
48, 1000, 0, 0)
# PCM Passthrough
PCM_DUPLEX_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
#
# 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, 19200000, slave),
DAI_CLOCK(bclk, TEST_SSP_BCLK, slave),
DAI_CLOCK(fsync, 48000, slave),
DAI_TDM(2, TEST_SSP_PHY_BITS, 3, 3))

66
topology/test/tplg-build.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
# Utility script to pre-process and compile topology sources into topology test
# binaries. Currently supports simple PCM <-> component <-> SSP style tests
# using simple_test()
# fail immediately on any errors
set -e
# M4 preprocessor flags
M4_FLAGS="-I ../ -I ../m4"
# Simple component test cases
# can be used on components with 1 sink and 1 source.
SIMPLE_TESTS=(test-ssp test-src-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)
# 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 daat bits per slot/channel
# 9) dai_bclk - SSP BCLK in HZ
#
function simple_test {
for i in ${SIMPLE_TESTS[@]}
do
TFILE="$i$5-$4-48k-$1"
echo "M4 pre-processing test $i -> ${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_PHY_BITS=$7 \
-DTEST_SSP_DATA_BITS=$8 \
$i.m4 > ${TFILE}.conf
echo "Compiling test $i -> ${TFILE}.tplg"
alsatplg -v 1 -c ${TFILE}.conf -o ${TFILE}.tplg
done
}
# Pre-process the simple tests
simple_test nocodec passthrough "NoCodec" s16le 2 s16le 20 16 1920000
simple_test nocodec passthrough "NoCodec" s24le 2 s24le 25 24 2400000
simple_test nocodec volume "NoCodec" s16le 2 s16le 20 16 1920000
simple_test nocodec volume "NoCodec" s24le 2 s24le 25 24 2400000
simple_test nocodec volume "NoCodec" s16le 2 s24le 25 24 2400000
simple_test codec passthrough "SSP2-Codec" s16le 2 s16le 20 16 1920000
simple_test codec passthrough "SSP2-Codec" s24le 2 s24le 25 24 2400000
simple_test codec volume "SSP2-Codec" s16le 2 s16le 20 16 1920000
simple_test codec volume "SSP2-Codec" s24le 2 s24le 25 24 2400000
simple_test codec volume "SSP2-Codec" s16le 2 s24le 25 24 2400000
simple_test baytrail passthrough "Baytrail Audio" s16le 2 s16le 20 16 1920000
simple_test baytrail passthrough "Baytrail Audio" s24le 2 s24le 25 24 2400000
simple_test baytrail volume "Baytrail Audio" s16le 2 s16le 20 16 1920000
simple_test baytrail volume "Baytrail Audio" s24le 2 s24le 25 24 2400000
simple_test baytrail volume "Baytrail Audio" s16le 2 s24le 25 24 2400000