[Sound-open-firmware] [PATCH v2 3/3] topology: add SAMPLE_RATE token for tone comp and define it in tone definition

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Sun Jun 24 10:01:07 CEST 2018


Add SAMPLE_RATE token for tone comp.
Include it in tone definition and set it from the test pipeline definition.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
 topology/m4/tone.m4                 | 7 +++++++
 topology/sof/tokens.m4              | 4 ++++
 topology/test/test-tone-playback.m4 | 4 ++++
 3 files changed, 15 insertions(+)

diff --git a/topology/m4/tone.m4 b/topology/m4/tone.m4
index 6a88b37..583134c 100644
--- a/topology/m4/tone.m4
+++ b/topology/m4/tone.m4
@@ -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'		ifdef(TONE_SAMPLE_RATE, STR(TONE_SAMPLE_RATE), "48000")
+`	}'
+`}'
 `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"'
diff --git a/topology/sof/tokens.m4 b/topology/sof/tokens.m4
index f0b3428..62c478b 100644
--- a/topology/sof/tokens.m4
+++ b/topology/sof/tokens.m4
@@ -77,3 +77,7 @@ 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"
+}
diff --git a/topology/test/test-tone-playback.m4 b/topology/test/test-tone-playback.m4
index 1c38c09..01d6045 100644
--- a/topology/test/test-tone-playback.m4
+++ b/topology/test/test-tone-playback.m4
@@ -6,6 +6,7 @@
 include(`pipeline.m4')
 include(`dai.m4')
 include(`utils.m4')
+include(`tone.m4')
 
 # Include TLV library
 include(`common/tlv.m4')
@@ -36,6 +37,9 @@ include(`dsps/byt.m4')
 #  Tone --B0--> volume --B1--> SSP2
 #
 
+# Set sample rate for tone
+define(`TONE_SAMPLE_RATE', 48000)
+
 # 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,
-- 
2.17.1



More information about the Sound-open-firmware mailing list