Skip to content

Commit 02a1102

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 02a1102

2 files changed

Lines changed: 168 additions & 3 deletions

File tree

tools/topology/topology2/include/pipelines/cavs/host-gateway-tdfb-drc-capture.conf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
<include/components/tdfb.conf>
2020
<include/pipelines/cavs/host-gateway-capture.conf>
2121

22+
Define {
23+
DMIC_PCM_CHANNELS 2
24+
DMIC_CHANNEL_CFG $CHANNEL_CONFIG_STEREO
25+
DMIC_CHANNEL_MAP $CHANNEL_MAP_STEREO
26+
}
27+
2228
Class.Pipeline."host-gateway-tdfb-drc-capture" {
2329

2430
SubTreeCopy.baseclass {
@@ -57,12 +63,18 @@ Class.Pipeline."host-gateway-tdfb-drc-capture" {
5763
{
5864
in_bit_depth 32
5965
in_valid_bit_depth 32
66+
in_channels $DMIC_PCM_CHANNELS
67+
in_ch_cfg $DMIC_CHANNEL_CFG
68+
in_ch_map $DMIC_CHANNEL_MAP
6069
}
6170
]
6271
Object.Base.output_audio_format [
6372
{
6473
out_bit_depth 32
6574
out_valid_bit_depth 32
75+
out_channels $DMIC_PCM_CHANNELS
76+
out_ch_cfg $DMIC_CHANNEL_CFG
77+
out_ch_map $DMIC_CHANNEL_MAP
6678
}
6779
]
6880
}
@@ -82,12 +94,18 @@ Class.Pipeline."host-gateway-tdfb-drc-capture" {
8294
{
8395
in_bit_depth 32
8496
in_valid_bit_depth 32
97+
in_channels $DMIC_PCM_CHANNELS
98+
in_ch_cfg $DMIC_CHANNEL_CFG
99+
in_ch_map $DMIC_CHANNEL_MAP
85100
}
86101
]
87102
Object.Base.output_audio_format [
88103
{
89104
out_bit_depth 32
90105
out_valid_bit_depth 32
106+
out_channels $DMIC_PCM_CHANNELS
107+
out_ch_cfg $DMIC_CHANNEL_CFG
108+
out_ch_map $DMIC_CHANNEL_MAP
91109
}
92110
]
93111
}

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

Lines changed: 150 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
@@ -28,6 +58,9 @@ Object.Dai.ALH [
2858
IncludeByKey.SDW_DMIC_ENHANCED_CAPTURE {
2959

3060
"true" {
61+
DMIC_PCM_CHANNELS = $SDW_DMIC_PCM_CHANNELS
62+
DMIC_CHANNEL_CFG = $SDW_DMIC_CHANNEL_CFG
63+
DMIC_CHANNEL_MAP = $SDW_DMIC_CHANNEL_MAP
3164
Object.Pipeline {
3265
host-gateway-tdfb-drc-capture [
3366
{
@@ -41,43 +74,67 @@ IncludeByKey.SDW_DMIC_ENHANCED_CAPTURE {
4174
num_output_audio_formats 5
4275
Object.Base.output_audio_format [
4376
{
77+
out_channels $SDW_DMIC_PCM_CHANNELS
4478
out_bit_depth 16
4579
out_valid_bit_depth 16
80+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
81+
out_ch_map $SDW_DMIC_CHANNEL_MAP
4682
}
4783
{
84+
out_channels $SDW_DMIC_PCM_CHANNELS
4885
out_bit_depth 32
4986
out_valid_bit_depth 32
87+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
88+
out_ch_map $SDW_DMIC_CHANNEL_MAP
5089
}
5190
{
91+
out_channels $SDW_DMIC_PCM_CHANNELS
5292
out_bit_depth 32
5393
out_valid_bit_depth 24
94+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
95+
out_ch_map $SDW_DMIC_CHANNEL_MAP
5496
}
5597
{
98+
out_channels $SDW_DMIC_PCM_CHANNELS
5699
out_bit_depth 32
57100
out_valid_bit_depth 32
58101
out_sample_type $SAMPLE_TYPE_FLOAT
102+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
103+
out_ch_map $SDW_DMIC_CHANNEL_MAP
59104
}
60105
{
106+
out_channels $SDW_DMIC_PCM_CHANNELS
61107
out_bit_depth 8
62108
out_valid_bit_depth 8
63109
out_sample_type $SAMPLE_TYPE_UNSIGNED_INTEGER
110+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
111+
out_ch_map $SDW_DMIC_CHANNEL_MAP
64112
}
65113
]
66114
}
67115
"false" {
68116
num_output_audio_formats 3
69117
Object.Base.output_audio_format [
70118
{
119+
out_channels $SDW_DMIC_PCM_CHANNELS
71120
out_bit_depth 16
72121
out_valid_bit_depth 16
122+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
123+
out_ch_map $SDW_DMIC_CHANNEL_MAP
73124
}
74125
{
126+
out_channels $SDW_DMIC_PCM_CHANNELS
75127
out_bit_depth 32
76128
out_valid_bit_depth 24
129+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
130+
out_ch_map $SDW_DMIC_CHANNEL_MAP
77131
}
78132
{
133+
out_channels $SDW_DMIC_PCM_CHANNELS
79134
out_bit_depth 32
80135
out_valid_bit_depth 32
136+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
137+
out_ch_map $SDW_DMIC_CHANNEL_MAP
81138
}
82139
]
83140
}
@@ -121,6 +178,76 @@ IncludeByKey.SDW_DMIC_ENHANCED_CAPTURE {
121178
Object.Widget.host-copier.1 {
122179
stream_name "sdw dmic"
123180
pcm_id 4
181+
IncludeByKey.PCM_FORMAT_ALL {
182+
"true" {
183+
num_output_audio_formats 5
184+
Object.Base.output_audio_format [
185+
{
186+
out_channels $SDW_DMIC_PCM_CHANNELS
187+
out_bit_depth 16
188+
out_valid_bit_depth 16
189+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
190+
out_ch_map $SDW_DMIC_CHANNEL_MAP
191+
}
192+
{
193+
out_channels $SDW_DMIC_PCM_CHANNELS
194+
out_bit_depth 32
195+
out_valid_bit_depth 32
196+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
197+
out_ch_map $SDW_DMIC_CHANNEL_MAP
198+
}
199+
{
200+
out_channels $SDW_DMIC_PCM_CHANNELS
201+
out_bit_depth 32
202+
out_valid_bit_depth 24
203+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
204+
out_ch_map $SDW_DMIC_CHANNEL_MAP
205+
}
206+
{
207+
out_channels $SDW_DMIC_PCM_CHANNELS
208+
out_bit_depth 32
209+
out_valid_bit_depth 32
210+
out_sample_type $SAMPLE_TYPE_FLOAT
211+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
212+
out_ch_map $SDW_DMIC_CHANNEL_MAP
213+
}
214+
{
215+
out_channels $SDW_DMIC_PCM_CHANNELS
216+
out_bit_depth 8
217+
out_valid_bit_depth 8
218+
out_sample_type $SAMPLE_TYPE_UNSIGNED_INTEGER
219+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
220+
out_ch_map $SDW_DMIC_CHANNEL_MAP
221+
}
222+
]
223+
}
224+
"false" {
225+
num_output_audio_formats 3
226+
Object.Base.output_audio_format [
227+
{
228+
out_channels $SDW_DMIC_PCM_CHANNELS
229+
out_bit_depth 16
230+
out_valid_bit_depth 16
231+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
232+
out_ch_map $SDW_DMIC_CHANNEL_MAP
233+
}
234+
{
235+
out_channels $SDW_DMIC_PCM_CHANNELS
236+
out_bit_depth 32
237+
out_valid_bit_depth 24
238+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
239+
out_ch_map $SDW_DMIC_CHANNEL_MAP
240+
}
241+
{
242+
out_channels $SDW_DMIC_PCM_CHANNELS
243+
out_bit_depth 32
244+
out_valid_bit_depth 32
245+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
246+
out_ch_map $SDW_DMIC_CHANNEL_MAP
247+
}
248+
]
249+
}
250+
}
124251
}
125252
}
126253
]
@@ -141,19 +268,25 @@ Object.Widget {
141268
num_output_audio_formats 1
142269
num_output_pins 1
143270

144-
# 32-bit 48KHz 2ch
271+
# 32-bit 48KHz capture, channel count derived from NUM_DMICS.
145272
Object.Base.input_audio_format [
146273
{
274+
in_channels $SDW_DMIC_PCM_CHANNELS
147275
in_bit_depth 32
148276
in_valid_bit_depth $SDW_LINK_VALID_BITS
149277
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
278+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
279+
in_ch_map $SDW_DMIC_CHANNEL_MAP
150280
in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]"
151281
}
152282
]
153283
Object.Base.output_audio_format [
154284
{
285+
out_channels $SDW_DMIC_PCM_CHANNELS
155286
out_bit_depth 32
156287
out_valid_bit_depth 32
288+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
289+
out_ch_map $SDW_DMIC_CHANNEL_MAP
157290
}
158291
]
159292
}
@@ -174,14 +307,20 @@ Object.Widget {
174307
# index 41 is in herited from the pipeline definition
175308
Object.Base.input_audio_format [
176309
{
310+
in_channels $SDW_DMIC_PCM_CHANNELS
177311
in_bit_depth 32
178312
in_valid_bit_depth 32
313+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
314+
in_ch_map $SDW_DMIC_CHANNEL_MAP
179315
}
180316
]
181317
Object.Base.output_audio_format [
182318
{
319+
out_channels $SDW_DMIC_PCM_CHANNELS
183320
out_bit_depth 32
184321
out_valid_bit_depth 32
322+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
323+
out_ch_map $SDW_DMIC_CHANNEL_MAP
185324
}
186325
]
187326

@@ -197,14 +336,20 @@ Object.Widget {
197336
num_output_audio_formats 1
198337
Object.Base.input_audio_format [
199338
{
339+
in_channels $SDW_DMIC_PCM_CHANNELS
200340
in_bit_depth 32
201341
in_valid_bit_depth 32
342+
in_ch_cfg $SDW_DMIC_CHANNEL_CFG
343+
in_ch_map $SDW_DMIC_CHANNEL_MAP
202344
}
203345
]
204346
Object.Base.output_audio_format [
205347
{
348+
out_channels $SDW_DMIC_PCM_CHANNELS
206349
out_bit_depth 32
207350
out_valid_bit_depth 32
351+
out_ch_cfg $SDW_DMIC_CHANNEL_CFG
352+
out_ch_map $SDW_DMIC_CHANNEL_MAP
208353
}
209354
]
210355
}
@@ -226,6 +371,8 @@ Object.PCM.pcm [
226371

227372
Object.PCM.pcm_caps.1 {
228373
name "sdw dmic"
374+
channels_min $SDW_DMIC_PCM_CHANNELS
375+
channels_max $SDW_DMIC_PCM_CHANNELS
229376
IncludeByKey.PCM_FORMAT_ALL {
230377
"true" {
231378
formats 'S16_LE,S24_LE,S32_LE,U8,FLOAT_LE'

0 commit comments

Comments
 (0)