From 082f9714a9e54a288817e82dd6db81ed0e3f45d3 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Thu, 31 May 2018 10:34:47 -0700 Subject: [PATCH] topology: add DMIC config definition to DAI config This patch adds the DMIC config definition and the DMIC config entry in DAI config. Signed-off-by: Ranjani Sridharan --- topology/m4/dai.m4 | 59 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/topology/m4/dai.m4 b/topology/m4/dai.m4 index 8a79ebc..a349a3c 100644 --- a/topology/m4/dai.m4 +++ b/topology/m4/dai.m4 @@ -160,16 +160,72 @@ define(`SSP_SAMPLE_BITS', `}' ) +dnl PDM_TUPLES(pdm ctrl id, mic_a_enable, mic_b_enable, polarity_a, polarity_b, +dnl clk_egde, skew) +define(`PDM_TUPLES', +` tuples."short.pdm$1" {' +` SOF_TKN_INTEL_DMIC_PDM_CTRL_ID' STR($1) +` SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable' STR($2) +` SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable' STR($3) +` SOF_TKN_INTEL_DMIC_PDM_POLARITY_A' STR($4) +` SOF_TKN_INTEL_DMIC_PDM_POLARITY_B' STR($5) +` SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE' STR($6) +` SOF_TKN_INTEL_DMIC_PDM_SKEW' STR($7) +` }' +) + +dnl PDM_CONFIG(type, idx, pdm tuples list) +define(`PDM_CONFIG', +`SectionVendorTuples."'N_DAI_CONFIG($1$2)`_pdm_tuples" {' +` tokens "sof_dmic_pdm_tokens"' +$3 +`}' +) + +dnl DMIC currently only supports 16 bit or 32-bit word length +dnl DMIC_WORD_LENGTH(frame format) +define(`DMIC_WORD_LENGTH', +`ifelse($1, `s16le', 16, $1, `s32le', 32, `')') + +dnl DMIC_CONFIG(driver_version, clk_min, clk_mac, duty_min, duty_max, +dnl req pdm count, sample_rate, +dnl fifo word length, type, idx, pdm controller config) +define(`DMIC_CONFIG', +`SectionVendorTuples."'N_DAI_CONFIG($9$10)`_dmic_tuples" {' +` tokens "sof_dmic_tokens"' +` tuples."word" {' +` SOF_TKN_INTEL_DMIC_DRIVER_VERSION' STR($1) +` SOF_TKN_INTEL_DMIC_CLK_MIN' STR($2) +` SOF_TKN_INTEL_DMIC_CLK_MAX' STR($3) +` SOF_TKN_INTEL_DMIC_DUTY_MIN' STR($4) +` SOF_TKN_INTEL_DMIC_DUTY_MAX' STR($5) +` SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE' STR($6) +` SOF_TKN_INTEL_DMIC_SAMPLE_RATE' STR($7) +` SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH' STR($8) +` }' +`}' +dnl PDM config for the number of active PDM controllers +$11 +`SectionData."'N_DAI_CONFIG($9$10)`_pdm_data" {' +` tuples "'N_DAI_CONFIG($9$10)`_pdm_tuples"' +`}' +`SectionData."'N_DAI_CONFIG($9$10)`_data" {' +` tuples "'N_DAI_CONFIG($9$10)`_dmic_tuples"' + +`}' +) + dnl DAI Config) define(`N_DAI_CONFIG', `DAICONFIG.'$1) -dnl DAI_CONFIG(type, idx, link_id, name, ssp_config) +dnl DAI_CONFIG(type, idx, link_id, name, ssp_config/dmic_config) define(`DAI_CONFIG', `SectionHWConfig."'$1$2`" {' `' ` id "'$2`"' `' ` ifelse($1, `SSP', $5, `}')' +`ifelse($1, `DMIC', $5, `')' `SectionVendorTuples."'N_DAI_CONFIG($1$2)`_tuples_str" {' ` tokens "sof_dai_tokens"' ` tuples."string" {' @@ -191,6 +247,7 @@ define(`DAI_CONFIG', ` data [' ` "'N_DAI_CONFIG($1$2)`_data"' ` "'N_DAI_CONFIG($1$2)`_data_str"' +`ifelse($1, `DMIC',` "'N_DAI_CONFIG($1$2)`_pdm_data"', `')' ` ]' `}')