Skip to content

Commit c18e5de

Browse files
committed
topology2: sdw-dmic-generic: add multiple DMIC number support
Add NUM_DMICS to set SDW DMIC number. The value is 2 by default. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 45a3167 commit c18e5de

1 file changed

Lines changed: 151 additions & 3 deletions

File tree

tools/topology/topology2/platform/intel/sdw-dmic-generic.conf

Lines changed: 151 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,41 @@ Define {
55
SDW_DMIC_STREAM 'SDW3-Capture'
66
SDW_DMIC_BE_ID 4
77
SDW_DMIC_PASSTHROUGH "false"
8-
SDW_DMIC_HOST_PIPELINE_ID 40
8+
SDW_DMIC_HOST_PIPELINE_ID 40
9+
# If SDW_DMIC_PCM_CHANNELS is zero, copy it from NUM_DMICS.
10+
# This allows overriding PCM channels separately from NUM_DMICS when needed.
11+
NUM_DMICS 2
12+
SDW_DMIC_PCM_CHANNELS 0
13+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_STEREO
14+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_STEREO
15+
}
16+
17+
IncludeByKey.SDW_DMIC_PCM_CHANNELS {
18+
"0" {
19+
IncludeByKey.NUM_DMICS {
20+
"1" {
21+
Define {
22+
SDW_DMIC_PCM_CHANNELS 1
23+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_MONO
24+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_MONO
25+
}
26+
}
27+
"2" {
28+
Define {
29+
SDW_DMIC_PCM_CHANNELS 2
30+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_STEREO
31+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_STEREO
32+
}
33+
}
34+
"4" {
35+
Define {
36+
SDW_DMIC_PCM_CHANNELS 4
37+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_3_POINT_1
38+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_3_POINT_1
39+
}
40+
}
41+
}
42+
}
943
}
1044

1145
Object.Dai.ALH [
@@ -16,7 +50,7 @@ Object.Dai.ALH [
1650
name $SDW_DMIC_STREAM
1751
default_hw_conf_id 0
1852
rate 48000
19-
channels 2
53+
channels $SDW_DMIC_PCM_CHANNELS
2054

2155
Object.Base.hw_config.1 {
2256
id 0
@@ -41,43 +75,67 @@ IncludeByKey.SDW_DMIC_ENHANCED_CAPTURE {
4175
num_output_audio_formats 5
4276
Object.Base.output_audio_format [
4377
{
78+
out_channels $SDW_DMIC_PCM_CHANNELS
4479
out_bit_depth 16
4580
out_valid_bit_depth 16
81+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
82+
out_ch_map $SDW_DMIC_CHANNEL_MAP
4683
}
4784
{
85+
out_channels $SDW_DMIC_PCM_CHANNELS
4886
out_bit_depth 32
4987
out_valid_bit_depth 32
88+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
89+
out_ch_map $SDW_DMIC_CHANNEL_MAP
5090
}
5191
{
92+
out_channels $SDW_DMIC_PCM_CHANNELS
5293
out_bit_depth 32
5394
out_valid_bit_depth 24
95+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
96+
out_ch_map $SDW_DMIC_CHANNEL_MAP
5497
}
5598
{
99+
out_channels $SDW_DMIC_PCM_CHANNELS
56100
out_bit_depth 32
57101
out_valid_bit_depth 32
58102
out_sample_type $SAMPLE_TYPE_FLOAT
103+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
104+
out_ch_map $SDW_DMIC_CHANNEL_MAP
59105
}
60106
{
107+
out_channels $SDW_DMIC_PCM_CHANNELS
61108
out_bit_depth 8
62109
out_valid_bit_depth 8
63110
out_sample_type $SAMPLE_TYPE_UNSIGNED_INTEGER
111+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
112+
out_ch_map $SDW_DMIC_CHANNEL_MAP
64113
}
65114
]
66115
}
67116
"false" {
68117
num_output_audio_formats 3
69118
Object.Base.output_audio_format [
70119
{
120+
out_channels $SDW_DMIC_PCM_CHANNELS
71121
out_bit_depth 16
72122
out_valid_bit_depth 16
123+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
124+
out_ch_map $SDW_DMIC_CHANNEL_MAP
73125
}
74126
{
127+
out_channels $SDW_DMIC_PCM_CHANNELS
75128
out_bit_depth 32
76129
out_valid_bit_depth 24
130+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
131+
out_ch_map $SDW_DMIC_CHANNEL_MAP
77132
}
78133
{
134+
out_channels $SDW_DMIC_PCM_CHANNELS
79135
out_bit_depth 32
80136
out_valid_bit_depth 32
137+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
138+
out_ch_map $SDW_DMIC_CHANNEL_MAP
81139
}
82140
]
83141
}
@@ -121,6 +179,76 @@ IncludeByKey.SDW_DMIC_ENHANCED_CAPTURE {
121179
Object.Widget.host-copier.1 {
122180
stream_name "sdw dmic"
123181
pcm_id 4
182+
IncludeByKey.PCM_FORMAT_ALL {
183+
"true" {
184+
num_output_audio_formats 5
185+
Object.Base.output_audio_format [
186+
{
187+
out_channels $SDW_DMIC_PCM_CHANNELS
188+
out_bit_depth 16
189+
out_valid_bit_depth 16
190+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
191+
out_ch_map $SDW_DMIC_CHANNEL_MAP
192+
}
193+
{
194+
out_channels $SDW_DMIC_PCM_CHANNELS
195+
out_bit_depth 32
196+
out_valid_bit_depth 32
197+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
198+
out_ch_map $SDW_DMIC_CHANNEL_MAP
199+
}
200+
{
201+
out_channels $SDW_DMIC_PCM_CHANNELS
202+
out_bit_depth 32
203+
out_valid_bit_depth 24
204+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
205+
out_ch_map $SDW_DMIC_CHANNEL_MAP
206+
}
207+
{
208+
out_channels $SDW_DMIC_PCM_CHANNELS
209+
out_bit_depth 32
210+
out_valid_bit_depth 32
211+
out_sample_type $SAMPLE_TYPE_FLOAT
212+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
213+
out_ch_map $SDW_DMIC_CHANNEL_MAP
214+
}
215+
{
216+
out_channels $SDW_DMIC_PCM_CHANNELS
217+
out_bit_depth 8
218+
out_valid_bit_depth 8
219+
out_sample_type $SAMPLE_TYPE_UNSIGNED_INTEGER
220+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
221+
out_ch_map $SDW_DMIC_CHANNEL_MAP
222+
}
223+
]
224+
}
225+
"false" {
226+
num_output_audio_formats 3
227+
Object.Base.output_audio_format [
228+
{
229+
out_channels $SDW_DMIC_PCM_CHANNELS
230+
out_bit_depth 16
231+
out_valid_bit_depth 16
232+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
233+
out_ch_map $SDW_DMIC_CHANNEL_MAP
234+
}
235+
{
236+
out_channels $SDW_DMIC_PCM_CHANNELS
237+
out_bit_depth 32
238+
out_valid_bit_depth 24
239+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
240+
out_ch_map $SDW_DMIC_CHANNEL_MAP
241+
}
242+
{
243+
out_channels $SDW_DMIC_PCM_CHANNELS
244+
out_bit_depth 32
245+
out_valid_bit_depth 32
246+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
247+
out_ch_map $SDW_DMIC_CHANNEL_MAP
248+
}
249+
]
250+
}
251+
}
124252
}
125253
}
126254
]
@@ -141,19 +269,25 @@ Object.Widget {
141269
num_output_audio_formats 1
142270
num_output_pins 1
143271

144-
# 32-bit 48KHz 2ch
272+
# 32-bit 48KHz capture, channel count derived from NUM_DMICS.
145273
Object.Base.input_audio_format [
146274
{
275+
in_channels $SDW_DMIC_PCM_CHANNELS
147276
in_bit_depth 32
148277
in_valid_bit_depth $SDW_LINK_VALID_BITS
149278
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
279+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
280+
in_ch_map $SDW_DMIC_CHANNEL_MAP
150281
in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]"
151282
}
152283
]
153284
Object.Base.output_audio_format [
154285
{
286+
out_channels $SDW_DMIC_PCM_CHANNELS
155287
out_bit_depth 32
156288
out_valid_bit_depth 32
289+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
290+
out_ch_map $SDW_DMIC_CHANNEL_MAP
157291
}
158292
]
159293
}
@@ -174,14 +308,20 @@ Object.Widget {
174308
# index 41 is in herited from the pipeline definition
175309
Object.Base.input_audio_format [
176310
{
311+
in_channels $SDW_DMIC_PCM_CHANNELS
177312
in_bit_depth 32
178313
in_valid_bit_depth 32
314+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
315+
in_ch_map $SDW_DMIC_CHANNEL_MAP
179316
}
180317
]
181318
Object.Base.output_audio_format [
182319
{
320+
out_channels $SDW_DMIC_PCM_CHANNELS
183321
out_bit_depth 32
184322
out_valid_bit_depth 32
323+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
324+
out_ch_map $SDW_DMIC_CHANNEL_MAP
185325
}
186326
]
187327

@@ -197,14 +337,20 @@ Object.Widget {
197337
num_output_audio_formats 1
198338
Object.Base.input_audio_format [
199339
{
340+
in_channels $SDW_DMIC_PCM_CHANNELS
200341
in_bit_depth 32
201342
in_valid_bit_depth 32
343+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
344+
in_ch_map $SDW_DMIC_CHANNEL_MAP
202345
}
203346
]
204347
Object.Base.output_audio_format [
205348
{
349+
out_channels $SDW_DMIC_PCM_CHANNELS
206350
out_bit_depth 32
207351
out_valid_bit_depth 32
352+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
353+
out_ch_map $SDW_DMIC_CHANNEL_MAP
208354
}
209355
]
210356
}
@@ -226,6 +372,8 @@ Object.PCM.pcm [
226372

227373
Object.PCM.pcm_caps.1 {
228374
name "sdw dmic"
375+
channels_min $SDW_DMIC_PCM_CHANNELS
376+
channels_max $SDW_DMIC_PCM_CHANNELS
229377
IncludeByKey.PCM_FORMAT_ALL {
230378
"true" {
231379
formats 'S16_LE,S24_LE,S32_LE,U8,FLOAT_LE'

0 commit comments

Comments
 (0)