[Sound-open-firmware] [PATCH 1/2] topology: add kcontrol for tone
This patch adds the changes required to support kcontrols for tone components in topology
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
--- Tested with: Minnowboard Turbot rt5651 SOF master: 28cb21b578759cdaa884d440d7d79b2c44e716a4 SOF-Tool master: a02abb799405d0e4ad0d6bb46eacf6fbe958c06e https://github.com/plbossart/sound/tree/topic/sof-v4.14: 9513a73b981bc1917705671ec54402a7e21672eb --- --- topology/m4/local.m4 | 5 ++++- topology/sof/pipe-tone.m4 | 31 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/topology/m4/local.m4 b/topology/m4/local.m4 index 29b8b29..a340ec3 100644 --- a/topology/m4/local.m4 +++ b/topology/m4/local.m4 @@ -227,7 +227,7 @@ define(`W_MIXER', dnl Tone name) define(`N_TONE', `TONE'PIPELINE_ID`.'$1)
-dnl W_TONE(name, format, periods_sink, periods_source, preload) +dnl W_TONE(name, format, periods_sink, periods_source, preload, kcontrols) define(`W_TONE', `SectionVendorTuples."'N_TONE($1)`_tuples_w" {' ` tokens "sof_comp_tokens"' @@ -257,6 +257,9 @@ define(`W_TONE', ` "'N_TONE($1)`_data_w"' ` "'N_TONE($1)`_data_str"' ` ]' +` mixer [' + $6 +` ]' `}')
dnl DAI name) diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 index e04a1b9..8f92680 100644 --- a/topology/sof/pipe-tone.m4 +++ b/topology/sof/pipe-tone.m4 @@ -32,6 +32,7 @@ SectionControlMixer.STR(Tone Volume PIPELINE_ID) { # control uses bespoke driver get/put/info ID 0 ops."ctl" { info "volsw" + # 256 binds the mixer control to volume get/put handlers get "256" put "256" } @@ -42,12 +43,40 @@ SectionControlMixer.STR(Tone Volume PIPELINE_ID) { tlv "vtlv_m90s3" }
+SectionControlMixer.STR(Tone Switch PIPELINE_ID) { + + # control belongs to this index group + index STR(PIPELINE_ID) + + # Channel register and shift for Front Left/Right + channel."FL" { + reg "2" + shift "0" + } + channel."FR" { + reg "2" + shift "1" + } + + # control uses bespoke driver get/put/info ID 0 + ops."ctl" { + info "volsw" + # 256 binds the mixer control to volume get/put handlers + get "256" + put "256" + } + + # max 1 indicates switch type mixer control + max "1" + invert "false" +} + # # Components and Buffers #
# "Tone 0" has 2 sink period and 0 source periods -W_TONE(0, PIPELINE_FORMAT, 2, 0, 0) +W_TONE(0, PIPELINE_FORMAT, 2, 0, 0, KCONTROLS("Tone Switch PIPELINE_ID"))
# "Tone Volume" has 2 sink period and 2 source periods W_PGA(0, PIPELINE_FORMAT, 2, 2, 0, KCONTROLS("Tone Volume PIPELINE_ID"))
This patch adds changes to create a test hostless tone pipeline.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@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 047ef6b..e96f312 100755 --- a/topology/test/tplg-build.sh +++ b/topology/test/tplg-build.sh @@ -13,6 +13,8 @@ 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-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 +
participants (1)
-
Ranjani Sridharan