Skip to content

Commit 61dab4b

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 61dab4b

1 file changed

Lines changed: 147 additions & 3 deletions

File tree

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

Lines changed: 147 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,37 @@ 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+
SDW_DMIC_PCM_CHANNELS 2
10+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_STEREO
11+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_STEREO
12+
}
13+
14+
IncludeByKey.SDW_DMIC_PCM_CHANNELS {
15+
"1" {
16+
Define {
17+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_MONO
18+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_MONO
19+
}
20+
}
21+
"2" {
22+
Define {
23+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_STEREO
24+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_STEREO
25+
}
26+
}
27+
"4" {
28+
Define {
29+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_3_POINT_1
30+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_3_POINT_1
31+
}
32+
}
33+
"8" {
34+
Define {
35+
SDW_DMIC_CHANNEL_CFG $CHANNEL_CONFIG_7_POINT_1
36+
SDW_DMIC_CHANNEL_MAP $CHANNEL_MAP_7_POINT_1
37+
}
38+
}
939
}
1040

1141
Object.Dai.ALH [
@@ -16,7 +46,7 @@ Object.Dai.ALH [
1646
name $SDW_DMIC_STREAM
1747
default_hw_conf_id 0
1848
rate 48000
19-
channels 2
49+
channels $SDW_DMIC_PCM_CHANNELS
2050

2151
Object.Base.hw_config.1 {
2252
id 0
@@ -41,43 +71,67 @@ IncludeByKey.SDW_DMIC_ENHANCED_CAPTURE {
4171
num_output_audio_formats 5
4272
Object.Base.output_audio_format [
4373
{
74+
out_channels $SDW_DMIC_PCM_CHANNELS
4475
out_bit_depth 16
4576
out_valid_bit_depth 16
77+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
78+
out_ch_map $SDW_DMIC_CHANNEL_MAP
4679
}
4780
{
81+
out_channels $SDW_DMIC_PCM_CHANNELS
4882
out_bit_depth 32
4983
out_valid_bit_depth 32
84+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
85+
out_ch_map $SDW_DMIC_CHANNEL_MAP
5086
}
5187
{
88+
out_channels $SDW_DMIC_PCM_CHANNELS
5289
out_bit_depth 32
5390
out_valid_bit_depth 24
91+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
92+
out_ch_map $SDW_DMIC_CHANNEL_MAP
5493
}
5594
{
95+
out_channels $SDW_DMIC_PCM_CHANNELS
5696
out_bit_depth 32
5797
out_valid_bit_depth 32
5898
out_sample_type $SAMPLE_TYPE_FLOAT
99+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
100+
out_ch_map $SDW_DMIC_CHANNEL_MAP
59101
}
60102
{
103+
out_channels $SDW_DMIC_PCM_CHANNELS
61104
out_bit_depth 8
62105
out_valid_bit_depth 8
63106
out_sample_type $SAMPLE_TYPE_UNSIGNED_INTEGER
107+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
108+
out_ch_map $SDW_DMIC_CHANNEL_MAP
64109
}
65110
]
66111
}
67112
"false" {
68113
num_output_audio_formats 3
69114
Object.Base.output_audio_format [
70115
{
116+
out_channels $SDW_DMIC_PCM_CHANNELS
71117
out_bit_depth 16
72118
out_valid_bit_depth 16
119+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
120+
out_ch_map $SDW_DMIC_CHANNEL_MAP
73121
}
74122
{
123+
out_channels $SDW_DMIC_PCM_CHANNELS
75124
out_bit_depth 32
76125
out_valid_bit_depth 24
126+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
127+
out_ch_map $SDW_DMIC_CHANNEL_MAP
77128
}
78129
{
130+
out_channels $SDW_DMIC_PCM_CHANNELS
79131
out_bit_depth 32
80132
out_valid_bit_depth 32
133+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
134+
out_ch_map $SDW_DMIC_CHANNEL_MAP
81135
}
82136
]
83137
}
@@ -121,6 +175,76 @@ IncludeByKey.SDW_DMIC_ENHANCED_CAPTURE {
121175
Object.Widget.host-copier.1 {
122176
stream_name "sdw dmic"
123177
pcm_id 4
178+
IncludeByKey.PCM_FORMAT_ALL {
179+
"true" {
180+
num_output_audio_formats 5
181+
Object.Base.output_audio_format [
182+
{
183+
out_channels $SDW_DMIC_PCM_CHANNELS
184+
out_bit_depth 16
185+
out_valid_bit_depth 16
186+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
187+
out_ch_map $SDW_DMIC_CHANNEL_MAP
188+
}
189+
{
190+
out_channels $SDW_DMIC_PCM_CHANNELS
191+
out_bit_depth 32
192+
out_valid_bit_depth 32
193+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
194+
out_ch_map $SDW_DMIC_CHANNEL_MAP
195+
}
196+
{
197+
out_channels $SDW_DMIC_PCM_CHANNELS
198+
out_bit_depth 32
199+
out_valid_bit_depth 24
200+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
201+
out_ch_map $SDW_DMIC_CHANNEL_MAP
202+
}
203+
{
204+
out_channels $SDW_DMIC_PCM_CHANNELS
205+
out_bit_depth 32
206+
out_valid_bit_depth 32
207+
out_sample_type $SAMPLE_TYPE_FLOAT
208+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
209+
out_ch_map $SDW_DMIC_CHANNEL_MAP
210+
}
211+
{
212+
out_channels $SDW_DMIC_PCM_CHANNELS
213+
out_bit_depth 8
214+
out_valid_bit_depth 8
215+
out_sample_type $SAMPLE_TYPE_UNSIGNED_INTEGER
216+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
217+
out_ch_map $SDW_DMIC_CHANNEL_MAP
218+
}
219+
]
220+
}
221+
"false" {
222+
num_output_audio_formats 3
223+
Object.Base.output_audio_format [
224+
{
225+
out_channels $SDW_DMIC_PCM_CHANNELS
226+
out_bit_depth 16
227+
out_valid_bit_depth 16
228+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
229+
out_ch_map $SDW_DMIC_CHANNEL_MAP
230+
}
231+
{
232+
out_channels $SDW_DMIC_PCM_CHANNELS
233+
out_bit_depth 32
234+
out_valid_bit_depth 24
235+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
236+
out_ch_map $SDW_DMIC_CHANNEL_MAP
237+
}
238+
{
239+
out_channels $SDW_DMIC_PCM_CHANNELS
240+
out_bit_depth 32
241+
out_valid_bit_depth 32
242+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
243+
out_ch_map $SDW_DMIC_CHANNEL_MAP
244+
}
245+
]
246+
}
247+
}
124248
}
125249
}
126250
]
@@ -141,19 +265,25 @@ Object.Widget {
141265
num_output_audio_formats 1
142266
num_output_pins 1
143267

144-
# 32-bit 48KHz 2ch
268+
# 32-bit 48KHz capture, channel count derived from NUM_DMICS.
145269
Object.Base.input_audio_format [
146270
{
271+
in_channels $SDW_DMIC_PCM_CHANNELS
147272
in_bit_depth 32
148273
in_valid_bit_depth $SDW_LINK_VALID_BITS
149274
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
275+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
276+
in_ch_map $SDW_DMIC_CHANNEL_MAP
150277
in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]"
151278
}
152279
]
153280
Object.Base.output_audio_format [
154281
{
282+
out_channels $SDW_DMIC_PCM_CHANNELS
155283
out_bit_depth 32
156284
out_valid_bit_depth 32
285+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
286+
out_ch_map $SDW_DMIC_CHANNEL_MAP
157287
}
158288
]
159289
}
@@ -174,14 +304,20 @@ Object.Widget {
174304
# index 41 is in herited from the pipeline definition
175305
Object.Base.input_audio_format [
176306
{
307+
in_channels $SDW_DMIC_PCM_CHANNELS
177308
in_bit_depth 32
178309
in_valid_bit_depth 32
310+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
311+
in_ch_map $SDW_DMIC_CHANNEL_MAP
179312
}
180313
]
181314
Object.Base.output_audio_format [
182315
{
316+
out_channels $SDW_DMIC_PCM_CHANNELS
183317
out_bit_depth 32
184318
out_valid_bit_depth 32
319+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
320+
out_ch_map $SDW_DMIC_CHANNEL_MAP
185321
}
186322
]
187323

@@ -197,14 +333,20 @@ Object.Widget {
197333
num_output_audio_formats 1
198334
Object.Base.input_audio_format [
199335
{
336+
in_channels $SDW_DMIC_PCM_CHANNELS
200337
in_bit_depth 32
201338
in_valid_bit_depth 32
339+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
340+
in_ch_map $SDW_DMIC_CHANNEL_MAP
202341
}
203342
]
204343
Object.Base.output_audio_format [
205344
{
345+
out_channels $SDW_DMIC_PCM_CHANNELS
206346
out_bit_depth 32
207347
out_valid_bit_depth 32
348+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
349+
out_ch_map $SDW_DMIC_CHANNEL_MAP
208350
}
209351
]
210352
}
@@ -226,6 +368,8 @@ Object.PCM.pcm [
226368

227369
Object.PCM.pcm_caps.1 {
228370
name "sdw dmic"
371+
channels_min $SDW_DMIC_PCM_CHANNELS
372+
channels_max $SDW_DMIC_PCM_CHANNELS
229373
IncludeByKey.PCM_FORMAT_ALL {
230374
"true" {
231375
formats 'S16_LE,S24_LE,S32_LE,U8,FLOAT_LE'

0 commit comments

Comments
 (0)