[Sound-open-firmware] [RFC PATCH 3/4] topology: add SAMPLE_RATE token for tone comp and include it in the tone comp definition

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu Jun 14 09:59:55 CEST 2018


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 at 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"
> +}
> +


More information about the Sound-open-firmware mailing list