[Sound-open-firmware] [RFC PATCH 0/4] Tone topology related changes
This patchset adds some changes to the tone pipeline generation. Main changes are to add a couple of test tone pipelines for APL and set the tone sample rate in topology.
Ranjani Sridharan (4): topology: use switch IO handler for tone switch topology: add test tone pipelines for APL topology: add SAMPLE_RATE token for tone comp and include it in the tone comp definition topology: modify test pipeline to include tone sample_rate token argument
topology/m4/pipeline.m4 | 4 +++- topology/m4/tone.m4 | 11 +++++++++-- topology/sof/pipe-tone.m4 | 4 ++-- topology/sof/tokens.m4 | 5 +++++ topology/test/test-tone-playback.m4 | 2 +- topology/test/tplg-build.sh | 3 +++ 6 files changed, 23 insertions(+), 6 deletions(-)
Use the bespoke switch IO handler in the driver for the tone switch kcontrol.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- topology/sof/pipe-tone.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 index 53cef5a..fc5eb00 100644 --- a/topology/sof/pipe-tone.m4 +++ b/topology/sof/pipe-tone.m4 @@ -30,7 +30,7 @@ C_CONTROLMIXER(Tone Volume, PIPELINE_ID,
# Switch type Mixer Control with max value of 1 C_CONTROLMIXER(Tone Switch, PIPELINE_ID, - CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256), + CONTROLMIXER_OPS(volsw, 259 binds the mixer control to switch get/put handlers, 259, 259), CONTROLMIXER_MAX(max 1 indicates switch type control, 1), false, ,
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- topology/test/tplg-build.sh | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/topology/test/tplg-build.sh b/topology/test/tplg-build.sh index ad4d1da..9d3649e 100755 --- a/topology/test/tplg-build.sh +++ b/topology/test/tplg-build.sh @@ -204,6 +204,9 @@ simple_test nocodec src "NoCodec" s24le SSP 4 s24le 25 24 2400000 24000000 I2S S
# Tone test: Tone component only supports s32le currently simple_test codec tone "SSP2-Codec" s32le SSP 2 s16le 20 16 1920000 19200000 I2S TONE_TEST[@] +#Tone Test for APL +simple_test codec tone "SSP5-Codec" s32le SSP 5 s24le 32 24 3072000 24576000 I2S TONE_TEST[@] +simple_test codec tone "SSP5-Codec" s32le SSP 5 s32le 32 32 3072000 24576000 I2S TONE_TEST[@]
#DMIC Test simple_test nocodec passthrough "DMIC0" s32le DMIC 0 s32le 1 500000 4800000\
Add sample_rate token for tone and modify the tone widget definition to include the sample_rate tuple.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- topology/m4/pipeline.m4 | 4 +++- topology/m4/tone.m4 | 11 +++++++++-- topology/sof/pipe-tone.m4 | 2 +- topology/sof/tokens.m4 | 5 +++++ 4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/topology/m4/pipeline.m4 b/topology/m4/pipeline.m4 index 0cfe486..8002d06 100644 --- a/topology/m4/pipeline.m4 +++ b/topology/m4/pipeline.m4 @@ -89,7 +89,7 @@ define(`PIPELINE_PCM_DAI_ADD',
dnl PIPELINE_ADD(pipeline, dnl pipe id, max channels, format, -dnl frames, deadline, priority, core) +dnl frames, deadline, priority, core, sample_rate) define(`PIPELINE_ADD', `undefine(`PIPELINE_ID')' `undefine(`PIPELINE_CHANNELS')' @@ -98,6 +98,7 @@ define(`PIPELINE_ADD', `undefine(`SCHEDULE_DEADLINE')' `undefine(`SCHEDULE_PRIORITY')' `undefine(`SCHEDULE_CORE')' +`undefine(`SAMPLE_RATE')' `define(`PIPELINE_ID', $2)' `define(`PIPELINE_CHANNELS', $3)' `define(`PIPELINE_FORMAT', $4)' @@ -105,6 +106,7 @@ define(`PIPELINE_ADD', `define(`SCHEDULE_DEADLINE', $6)' `define(`SCHEDULE_PRIORITY', $7)' `define(`SCHEDULE_CORE', $8)' +`define(`SAMPLE_RATE', $9)' `include($1)' )
diff --git a/topology/m4/tone.m4 b/topology/m4/tone.m4 index 6a88b37..ee0dc09 100644 --- a/topology/m4/tone.m4 +++ b/topology/m4/tone.m4 @@ -5,7 +5,7 @@ dnl Define macro for siggen widget dnl Tone name) define(`N_TONE', `TONE'PIPELINE_ID`.'$1)
-dnl W_TONE(name, format, periods_sink, periods_source, preload, kcontrols_list) +dnl W_TONE(name, format, periods_sink, periods_source, preload, sample_rate, kcontrols_list) define(`W_TONE', `SectionVendorTuples."'N_TONE($1)`_tuples_w" {' ` tokens "sof_comp_tokens"' @@ -15,8 +15,15 @@ define(`W_TONE', ` SOF_TKN_COMP_PRELOAD_COUNT' STR($5) ` }' `}' +`SectionVendorTuples."'N_TONE($1)`_tone_tuples_w" {' +` tokens "sof_tone_tokens"' +` tuples."word" {' +` SOF_TKN_TONE_SAMPLE_RATE' STR($6) +` }' +`}' `SectionData."'N_TONE($1)`_data_w" {' ` tuples "'N_TONE($1)`_tuples_w"' +` tuples "'N_TONE($1)`_tone_tuples_w"' `}' `SectionVendorTuples."'N_TONE($1)`_tuples_str" {' ` tokens "sof_comp_tokens"' @@ -36,7 +43,7 @@ define(`W_TONE', ` "'N_TONE($1)`_data_str"' ` ]' ` mixer [' - $6 + $7 ` ]' `}')
diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 index fc5eb00..b946d72 100644 --- a/topology/sof/pipe-tone.m4 +++ b/topology/sof/pipe-tone.m4 @@ -42,7 +42,7 @@ C_CONTROLMIXER(Tone Switch, PIPELINE_ID, #
# "Tone 0" has 2 sink period and 0 source periods -W_TONE(0, PIPELINE_FORMAT, 2, 0, 0, LIST(` ', "Tone Switch PIPELINE_ID")) +W_TONE(0, PIPELINE_FORMAT, 2, 0, 0, SAMPLE_RATE, LIST(` ', "Tone Switch PIPELINE_ID"))
# "Tone Volume" has 2 sink period and 2 source periods W_PGA(0, PIPELINE_FORMAT, 2, 2, 0, LIST(` ', "Tone Volume PIPELINE_ID")) diff --git a/topology/sof/tokens.m4 b/topology/sof/tokens.m4 index f0b3428..89f0101 100644 --- a/topology/sof/tokens.m4 +++ b/topology/sof/tokens.m4 @@ -77,3 +77,8 @@ SectionVendorTokens."sof_dmic_pdm_tokens" { SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE "705" SOF_TKN_INTEL_DMIC_PDM_SKEW "706" } + +SectionVendorTokens."sof_tone_tokens" { + SOF_TKN_TONE_SAMPLE_RATE "800" +} +
On Wed, 2018-06-13 at 20:46 -0700, Ranjani Sridharan wrote:
Add sample_rate token for tone and modify the tone widget definition to include the sample_rate tuple.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
This should be an argument for the tone component and not the pipeline should be set in pipe_tone.m4
You could define a TONE_SAMPLE_RATE macro in the test pipeline that pipe_tone.m4 could detect and use otherwise pipe_tone would use 48000
Liam
topology/m4/pipeline.m4 | 4 +++- topology/m4/tone.m4 | 11 +++++++++-- topology/sof/pipe-tone.m4 | 2 +- topology/sof/tokens.m4 | 5 +++++ 4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/topology/m4/pipeline.m4 b/topology/m4/pipeline.m4 index 0cfe486..8002d06 100644 --- a/topology/m4/pipeline.m4 +++ b/topology/m4/pipeline.m4 @@ -89,7 +89,7 @@ define(`PIPELINE_PCM_DAI_ADD',
dnl PIPELINE_ADD(pipeline, dnl pipe id, max channels, format, -dnl frames, deadline, priority, core) +dnl frames, deadline, priority, core, sample_rate) define(`PIPELINE_ADD', `undefine(`PIPELINE_ID')' `undefine(`PIPELINE_CHANNELS')' @@ -98,6 +98,7 @@ define(`PIPELINE_ADD', `undefine(`SCHEDULE_DEADLINE')' `undefine(`SCHEDULE_PRIORITY')' `undefine(`SCHEDULE_CORE')' +`undefine(`SAMPLE_RATE')' `define(`PIPELINE_ID', $2)' `define(`PIPELINE_CHANNELS', $3)' `define(`PIPELINE_FORMAT', $4)' @@ -105,6 +106,7 @@ define(`PIPELINE_ADD', `define(`SCHEDULE_DEADLINE', $6)' `define(`SCHEDULE_PRIORITY', $7)' `define(`SCHEDULE_CORE', $8)' +`define(`SAMPLE_RATE', $9)' `include($1)' )
diff --git a/topology/m4/tone.m4 b/topology/m4/tone.m4 index 6a88b37..ee0dc09 100644 --- a/topology/m4/tone.m4 +++ b/topology/m4/tone.m4 @@ -5,7 +5,7 @@ dnl Define macro for siggen widget dnl Tone name) define(`N_TONE', `TONE'PIPELINE_ID`.'$1)
-dnl W_TONE(name, format, periods_sink, periods_source, preload, kcontrols_list) +dnl W_TONE(name, format, periods_sink, periods_source, preload, sample_rate, kcontrols_list) define(`W_TONE', `SectionVendorTuples."'N_TONE($1)`_tuples_w" {' ` tokens "sof_comp_tokens"' @@ -15,8 +15,15 @@ define(`W_TONE', ` SOF_TKN_COMP_PRELOAD_COUNT' STR($5) ` }' `}' +`SectionVendorTuples."'N_TONE($1)`_tone_tuples_w" {' +` tokens "sof_tone_tokens"' +` tuples."word" {' +` SOF_TKN_TONE_SAMPLE_RATE' STR($6) +` }' +`}' `SectionData."'N_TONE($1)`_data_w" {' ` tuples "'N_TONE($1)`_tuples_w"' +` tuples "'N_TONE($1)`_tone_tuples_w"' `}' `SectionVendorTuples."'N_TONE($1)`_tuples_str" {' ` tokens "sof_comp_tokens"' @@ -36,7 +43,7 @@ define(`W_TONE', ` "'N_TONE($1)`_data_str"' ` ]' ` mixer ['
$6
$7
` ]' `}')
diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 index fc5eb00..b946d72 100644 --- a/topology/sof/pipe-tone.m4 +++ b/topology/sof/pipe-tone.m4 @@ -42,7 +42,7 @@ C_CONTROLMIXER(Tone Switch, PIPELINE_ID, #
# "Tone 0" has 2 sink period and 0 source periods -W_TONE(0, PIPELINE_FORMAT, 2, 0, 0, LIST(` ', "Tone Switch PIPELINE_ID")) +W_TONE(0, PIPELINE_FORMAT, 2, 0, 0, SAMPLE_RATE, LIST(` ', "Tone Switch PIPELINE_ID"))
# "Tone Volume" has 2 sink period and 2 source periods W_PGA(0, PIPELINE_FORMAT, 2, 2, 0, LIST(` ', "Tone Volume PIPELINE_ID")) diff --git a/topology/sof/tokens.m4 b/topology/sof/tokens.m4 index f0b3428..89f0101 100644 --- a/topology/sof/tokens.m4 +++ b/topology/sof/tokens.m4 @@ -77,3 +77,8 @@ SectionVendorTokens."sof_dmic_pdm_tokens" { SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE "705" SOF_TKN_INTEL_DMIC_PDM_SKEW "706" }
+SectionVendorTokens."sof_tone_tokens" {
- SOF_TKN_TONE_SAMPLE_RATE "800"
+}
Pass the sample rate argument when setting up tone pipeline.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- topology/test/test-tone-playback.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/topology/test/test-tone-playback.m4 b/topology/test/test-tone-playback.m4 index 1c38c09..971a41c 100644 --- a/topology/test/test-tone-playback.m4 +++ b/topology/test/test-tone-playback.m4 @@ -40,7 +40,7 @@ include(`dsps/byt.m4') # 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) + 48, 1000, 0, 0, 48000)
# playback DAI is SSP2 using 2 periods # Buffers use TEST_DAI_FORMAT format, with 48 frame per 1000us on core 0 with priority 0
participants (2)
-
Liam Girdwood
-
Ranjani Sridharan