From 190ce8bf7a442545d5a89c70aa38d0f8e7c67122 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Tue, 10 Nov 2020 15:43:06 +0200 Subject: [PATCH] Drivers: DMIC: Move decimation factors 5 and 10 to less preferred This patch changes FIR decimation factors preference from "2, 3, 4, 5, 6, 8, 10, 12" to "2, 3, 4, 6, 5, 8, 12, 10". The prime number factor 5 and 10 (2*5) are less preferred because when used for decimate for fist started FIR they restrict more the configuration choices for the second FIR. If e.g. capture at 16 kHz is started first with decimation factor 6, the 48 kHz stream can be decimated from common 96 kHz CIC rate by 2. Earlier the driver selected decimation by 5 to 16 kHz. There is no integer decimation factor to decimate from 80 kHz to 48 kHz. Similarly if decimate to 8 kHz programmed FIR to decimate by 10, the same 80 kHz rate prevents 48 kHz for the other DAI. Decimation factor 12 sets up CIC to 96 kHz that is compatible with many other sample rates. Signed-off-by: Seppo Ingalsuo --- .../coefficients/pdm_decim/pdm_decim_table.h | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/include/sof/audio/coefficients/pdm_decim/pdm_decim_table.h b/src/include/sof/audio/coefficients/pdm_decim/pdm_decim_table.h index d2c51afe5..cfd4368bb 100644 --- a/src/include/sof/audio/coefficients/pdm_decim/pdm_decim_table.h +++ b/src/include/sof/audio/coefficients/pdm_decim/pdm_decim_table.h @@ -40,9 +40,17 @@ #include "pdm_decim_int32_12_4156_5345_010_090.h" #endif -/* Note: Higher spec filter must be before lower spec filter - * if there are multiple filters for a decimation factor. The naming - * scheme of coefficients set is: +/* Note 1: Higher spec filter must be before lower spec filter + * if there are multiple filters for a decimation factor. The first + * filter is skipped if the length is too much vs. overrun limit. If + * other order the better filter would be never selected. + * + * Note 2: The introduction order of FIR decimation factors is the selection + * preference order. The decimation factor 5 and 10 (2*5) cause a often less + * compatible output sample rate for CIC so they are not used if there other + * suitable nearby values. + * + * The naming scheme of coefficients set is: * _____ */ struct pdm_decim *fir_list[] = { @@ -56,20 +64,20 @@ struct pdm_decim *fir_list[] = { #if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_4 &pdm_decim_int32_04_4318_5100_010_095, #endif -#if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_5 - &pdm_decim_int32_05_4325_5100_010_095, -#endif #if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_6 &pdm_decim_int32_06_4172_5100_010_095, #endif +#if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_5 + &pdm_decim_int32_05_4325_5100_010_095, +#endif #if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_8 &pdm_decim_int32_08_4156_5301_010_090, #endif -#if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_10 - &pdm_decim_int32_10_4156_5345_010_090, -#endif #if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_12 &pdm_decim_int32_12_4156_5345_010_090, +#endif +#if CONFIG_INTEL_DMIC_FIR_DECIMATE_BY_10 + &pdm_decim_int32_10_4156_5345_010_090, #endif NULL, /* This marks the end of coefficients */ };