Skip to content

Commit 77b8620

Browse files
singalsulgirdwood
authored andcommitted
DMIC: Add support for decimation factor 12
This patch adds driver capability to capture with combination of 96 kHz and 16 kHz sample rates from FIFO A and FIFO B by using decimation factor 12 in FIR. The earlier capability for 96 kHz was with single FIFO only due to lack of suitable decimation filter for the 16 kHz output. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 5721291 commit 77b8620

5 files changed

Lines changed: 401 additions & 12 deletions

File tree

src/drivers/intel/cavs/Kconfig

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config CAVS_DMIC_FIR_FULL
2222
select CAVS_DMIC_FIR_DECIMATE_BY_5
2323
select CAVS_DMIC_FIR_DECIMATE_BY_6
2424
select CAVS_DMIC_FIR_DECIMATE_BY_8
25+
select CAVS_DMIC_FIR_DECIMATE_BY_12
2526
help
2627
This option adds to previous all currently defined FIR
2728
coefficients sets to support sample rates 8 - 96 kHz with
@@ -54,43 +55,65 @@ config CAVS_DMIC_FIR_DECIMATE_BY_2
5455
bool "FIR decimate by 2"
5556
default n
5657
help
57-
This includes FIR coefficients to decimate by 2
58-
into the build.
58+
This includes FIR coefficients to decimate by 2 into the build. It
59+
is commonly used for 48 kHz capture with 2.4 MHz microphone clock.
60+
Decimate by 2 in FIR gives good bandwidth vs. Nyquist and narrow
61+
transition region due to lower FIR order need compared to higher
62+
decimation factors.
5963

6064
config CAVS_DMIC_FIR_DECIMATE_BY_3
6165
bool "FIR decimate by 3"
6266
default n
6367
help
64-
This includes FIR coefficients to decimate by 3
65-
into the build.
68+
This includes FIR coefficients to decimate by 3 into the build.
69+
Decimation by 3 in FIR is useful with microphone clock and sample
70+
rate combinations where a 3 is the lowest factor of the oversampling
71+
ratio. Having this low prime decimation factor for FIR enabled is
72+
useful when decimation by 2 is not possible.
6673

6774
config CAVS_DMIC_FIR_DECIMATE_BY_4
6875
bool "FIR decimate by 4"
6976
default n
7077
help
71-
This includes FIR coefficients to decimate by 4
72-
into the build.
78+
This includes FIR coefficients to decimate by 4 into the build.
79+
Decimation by 4 in FIR is useful in some cases with high microphone
80+
clock rates due to max. decimation factor limit of CIC. In such
81+
cases decimation by 2 may not be usable.
7382

7483
config CAVS_DMIC_FIR_DECIMATE_BY_5
7584
bool "FIR decimate by 5"
7685
default n
7786
help
78-
This includes FIR coefficients to decimate by 5
79-
into the build.
87+
This includes FIR coefficients to decimate by 5 into the build.
88+
Decimation by 5 in FIR is useful with microphone clock and sample
89+
rate combinations where a 5 is the lowest factor of the oversampling
90+
ratio.
8091

8192
config CAVS_DMIC_FIR_DECIMATE_BY_6
8293
bool "FIR decimate by 6"
8394
default n
8495
help
85-
This includes FIR coefficients to decimate by 6
86-
into the build.
96+
This includes FIR coefficients to decimate by 6 into the build. It
97+
is commonly used for 16 kHz capture from secondary FIFO while
98+
primary FIFO is configured for 48 kHz rate.
8799

88100
config CAVS_DMIC_FIR_DECIMATE_BY_8
89101
bool "FIR decimate by 8"
90102
default n
91103
help
92-
This includes FIR coefficients to decimate by 8
93-
into the build.
104+
This includes FIR coefficients to decimate by 8 into the build.
105+
The high FIR decimation factors are needed for high microphone clock
106+
rates due to max. decimation factor limitation of CIC. Also dual
107+
FIFO configurations may need for one FIR decimation such high
108+
decimation factor.
109+
110+
config CAVS_DMIC_FIR_DECIMATE_BY_12
111+
bool "FIR decimate by 12"
112+
default n
113+
help
114+
This includes FIR coefficients to decimate by 12 into the build. It
115+
is used for 16 kHz capture for secondary FIFO while the primary
116+
FIFO is configured for 96 kHz.
94117

95118
endmenu # "Decimation factors"
96119

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause
2+
*
3+
* Copyright(c) 2019 Intel Corporation. All rights reserved.
4+
*
5+
* Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
6+
*/
7+
8+
const int32_t fir_int32_12_4156_6018_010_090[241] = {
9+
314962,
10+
709564,
11+
816474,
12+
1395294,
13+
1841297,
14+
2523842,
15+
3198174,
16+
3983930,
17+
4760567,
18+
5540984,
19+
6242495,
20+
6830948,
21+
7236018,
22+
7409213,
23+
7294862,
24+
6855241,
25+
6062372,
26+
4910076,
27+
3412857,
28+
1611207,
29+
-429417,
30+
-2618584,
31+
-4844101,
32+
-6976185,
33+
-8874470,
34+
-10396503,
35+
-11407299,
36+
-11789121,
37+
-11451868,
38+
-10342980,
39+
-8455043,
40+
-5831394,
41+
-2568927,
42+
1181866,
43+
5222520,
44+
9314693,
45+
13192098,
46+
16575721,
47+
19192718,
48+
20794900,
49+
21178214,
50+
20201702,
51+
17803225,
52+
14010668,
53+
8949436,
54+
2842879,
55+
-3994726,
56+
-11170475,
57+
-18232780,
58+
-24697913,
59+
-30079321,
60+
-33921136,
61+
-35832583,
62+
-35519729,
63+
-32814338,
64+
-27696482,
65+
-20307627,
66+
-10955587,
67+
-107030,
68+
11631605,
69+
23543158,
70+
34839849,
71+
44711664,
72+
52378576,
73+
57147364,
74+
58464306,
75+
55964858,
76+
49513162,
77+
39229018,
78+
25500353,
79+
8978376,
80+
-9446673,
81+
-28685271,
82+
-47507955,
83+
-64615363,
84+
-78721214,
85+
-88638504,
86+
-93366828,
87+
-92173696,
88+
-84664063,
89+
-70832479,
90+
-51094971,
91+
-26293298,
92+
2325527,
93+
33160341,
94+
64331225,
95+
93780584,
96+
119392064,
97+
139122267,
98+
151138511,
99+
153952683,
100+
146544581,
101+
128465090,
102+
99912102,
103+
61773380,
104+
15630736,
105+
-36276081,
106+
-91126422,
107+
-145634732,
108+
-196199513,
109+
-239081694,
110+
-270597744,
111+
-287325458,
112+
-286302172,
113+
-265212584,
114+
-222548033,
115+
-157732643,
116+
-71204480,
117+
35552627,
118+
160030161,
119+
298770593,
120+
447493387,
121+
601268344,
122+
754725438,
123+
902293927,
124+
1038455989,
125+
1158003615,
126+
1256284590,
127+
1329424450,
128+
1374513457,
129+
1389746873,
130+
1374513457,
131+
1329424450,
132+
1256284590,
133+
1158003615,
134+
1038455989,
135+
902293927,
136+
754725438,
137+
601268344,
138+
447493387,
139+
298770593,
140+
160030161,
141+
35552627,
142+
-71204480,
143+
-157732643,
144+
-222548033,
145+
-265212584,
146+
-286302172,
147+
-287325458,
148+
-270597744,
149+
-239081694,
150+
-196199513,
151+
-145634732,
152+
-91126422,
153+
-36276081,
154+
15630736,
155+
61773380,
156+
99912102,
157+
128465090,
158+
146544581,
159+
153952683,
160+
151138511,
161+
139122267,
162+
119392064,
163+
93780584,
164+
64331225,
165+
33160341,
166+
2325527,
167+
-26293298,
168+
-51094971,
169+
-70832479,
170+
-84664063,
171+
-92173696,
172+
-93366828,
173+
-88638504,
174+
-78721214,
175+
-64615363,
176+
-47507955,
177+
-28685271,
178+
-9446673,
179+
8978376,
180+
25500353,
181+
39229018,
182+
49513162,
183+
55964858,
184+
58464306,
185+
57147364,
186+
52378576,
187+
44711664,
188+
34839849,
189+
23543158,
190+
11631605,
191+
-107030,
192+
-10955587,
193+
-20307627,
194+
-27696482,
195+
-32814338,
196+
-35519729,
197+
-35832583,
198+
-33921136,
199+
-30079321,
200+
-24697913,
201+
-18232780,
202+
-11170475,
203+
-3994726,
204+
2842879,
205+
8949436,
206+
14010668,
207+
17803225,
208+
20201702,
209+
21178214,
210+
20794900,
211+
19192718,
212+
16575721,
213+
13192098,
214+
9314693,
215+
5222520,
216+
1181866,
217+
-2568927,
218+
-5831394,
219+
-8455043,
220+
-10342980,
221+
-11451868,
222+
-11789121,
223+
-11407299,
224+
-10396503,
225+
-8874470,
226+
-6976185,
227+
-4844101,
228+
-2618584,
229+
-429417,
230+
1611207,
231+
3412857,
232+
4910076,
233+
6062372,
234+
6855241,
235+
7294862,
236+
7409213,
237+
7236018,
238+
6830948,
239+
6242495,
240+
5540984,
241+
4760567,
242+
3983930,
243+
3198174,
244+
2523842,
245+
1841297,
246+
1395294,
247+
816474,
248+
709564,
249+
314962
250+
251+
};
252+
253+
struct pdm_decim pdm_decim_int32_12_4156_6018_010_090 = {
254+
12, 241, 3, 4156, 6018, 10, 90, fir_int32_12_4156_6018_010_090
255+
};

src/include/sof/audio/coefficients/pdm_decim/pdm_decim_table.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#if CONFIG_CAVS_DMIC_FIR_DECIMATE_BY_8
3535
#include "pdm_decim_int32_08_4156_5380_010_090.h"
3636
#endif
37+
#if CONFIG_CAVS_DMIC_FIR_DECIMATE_BY_12
38+
#include "pdm_decim_int32_12_4156_6018_010_090.h"
39+
#endif
3740

3841
/* Note: Higher spec filter must be before lower spec filter
3942
* if there are multiple filters for a decimation factor. The naming
@@ -60,6 +63,9 @@ struct pdm_decim *fir_list[] = {
6063
#endif
6164
#if CONFIG_CAVS_DMIC_FIR_DECIMATE_BY_8
6265
&pdm_decim_int32_08_4156_5380_010_090,
66+
#endif
67+
#if CONFIG_CAVS_DMIC_FIR_DECIMATE_BY_12
68+
&pdm_decim_int32_12_4156_6018_010_090,
6369
#endif
6470
NULL, /* This marks the end of coefficients */
6571
};

tools/topology/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ set(TPLGS
7878
"sof-apl-dmic-a2ch-b2ch\;sof-apl-dmic-a2ch-b2ch"
7979
"sof-apl-dmic-a4ch-b2ch\;sof-apl-dmic-a4ch-b2ch"
8080
"sof-apl-dmic-a2ch-b4ch\;sof-apl-dmic-a2ch-b4ch"
81+
"sof-apl-dmic-a96k-b16k\;sof-apl-dmic-a96k-b16k"
8182
"sof-apl-dmic\;sof-apl-dmic-4ch\;-DCHANNELS=4"
8283
"sof-apl-dmic\;sof-apl-dmic-2ch\;-DCHANNELS=2"
8384
"sof-apl-src-50khz-pcm512x\;sof-apl-src-50khz-pcm512x"

0 commit comments

Comments
 (0)