Skip to content

Commit db974a4

Browse files
lyakhRanderWang
authored andcommitted
topology2: nocodec: add a second level copier
Insert a second copier into the DMIC0 stream to generate a total of three PCMs from it. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 1d19080 commit db974a4

File tree

2 files changed

+258
-2
lines changed

2 files changed

+258
-2
lines changed

tools/topology/topology2/cavs-nocodec.conf

Lines changed: 156 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<host-copier-gain-mixin-playback.conf>
1818
<mixout-gain-dai-copier-playback.conf>
1919
<dai-copier-gain-module-copier-capture.conf>
20+
<gain-module-copier.conf>
2021
<gain-capture.conf>
2122
<gain-copier-capture.conf>
2223
<deepbuffer-playback.conf>
@@ -270,6 +271,68 @@ Object.Pipeline {
270271
}
271272
}
272273

274+
gain-module-copier.1 {
275+
index 19
276+
direction "capture"
277+
Object.Widget.pipeline.1 {
278+
stream_name $DMIC0_DAI_COPIER
279+
}
280+
Object.Widget.copier.1 {
281+
stream_name 'Gain Capture 19'
282+
num_audio_formats 2
283+
num_sink_audio_formats 2
284+
num_source_audio_formats 2
285+
Object.Base.audio_format.1 {
286+
in_bit_depth 32
287+
in_valid_bit_depth 32
288+
out_bit_depth 32
289+
out_valid_bit_depth 32
290+
dma_buffer_size "$[$ibs * 2]"
291+
}
292+
Object.Base.audio_format.2 {
293+
in_channels 4
294+
in_bit_depth 32
295+
in_valid_bit_depth 32
296+
out_channels 4
297+
out_bit_depth 32
298+
out_valid_bit_depth 32
299+
dma_buffer_size "$[$ibs * 2]"
300+
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
301+
in_ch_map $CHANNEL_MAP_3_POINT_1
302+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
303+
out_ch_map $CHANNEL_MAP_3_POINT_1
304+
}
305+
}
306+
Object.Widget.gain.1 {
307+
num_audio_formats 2
308+
num_sink_audio_formats 2
309+
num_source_audio_formats 2
310+
Object.Base.audio_format.1 {
311+
in_bit_depth 32
312+
in_valid_bit_depth 32
313+
out_bit_depth 32
314+
out_valid_bit_depth 32
315+
dma_buffer_size "$[$ibs * 2]"
316+
}
317+
Object.Base.audio_format.2 {
318+
in_channels 4
319+
in_bit_depth 32
320+
in_valid_bit_depth 32
321+
out_channels 4
322+
out_bit_depth 32
323+
out_valid_bit_depth 32
324+
dma_buffer_size "$[$ibs * 2]"
325+
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
326+
in_ch_map $CHANNEL_MAP_3_POINT_1
327+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
328+
out_ch_map $CHANNEL_MAP_3_POINT_1
329+
}
330+
Object.Control.mixer.1 {
331+
name 'Main Capture Volume 3'
332+
}
333+
}
334+
}
335+
273336
dai-copier-gain-module-copier-capture.4 {
274337
index 8
275338
Object.Widget.copier."1" {
@@ -370,8 +433,10 @@ Object.Pipeline {
370433
stream_name "DMIC0 Raw"
371434
}
372435
Object.Widget.copier.1 {
373-
stream_name "DMIC0 Raw"
436+
stream_name "Gain Capture 18"
374437
num_audio_formats 2
438+
num_sink_audio_formats 2
439+
num_source_audio_formats 2
375440
Object.Base.audio_format.1 {
376441
in_bit_depth 32
377442
in_valid_bit_depth 32
@@ -395,6 +460,8 @@ Object.Pipeline {
395460
}
396461
Object.Widget.gain.1 {
397462
num_audio_formats 2
463+
num_sink_audio_formats 2
464+
num_source_audio_formats 2
398465
Object.Base.audio_format.1 {
399466
in_bit_depth 32
400467
in_valid_bit_depth 32
@@ -420,6 +487,68 @@ Object.Pipeline {
420487
}
421488
}
422489
}
490+
491+
gain-capture.6 {
492+
format $FORMAT
493+
index 20
494+
Object.Widget.pipeline.1 {
495+
stream_name "DMIC0 Raw 2"
496+
}
497+
Object.Widget.copier.1 {
498+
stream_name "Gain Capture 20"
499+
num_audio_formats 2
500+
num_sink_audio_formats 2
501+
num_source_audio_formats 2
502+
Object.Base.audio_format.1 {
503+
in_bit_depth 32
504+
in_valid_bit_depth 32
505+
out_bit_depth 32
506+
out_valid_bit_depth 32
507+
dma_buffer_size "$[$ibs * 2]"
508+
}
509+
Object.Base.audio_format.2 {
510+
in_channels 4
511+
in_bit_depth 32
512+
in_valid_bit_depth 32
513+
out_channels 4
514+
out_bit_depth 32
515+
out_valid_bit_depth 32
516+
dma_buffer_size "$[$ibs * 2]"
517+
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
518+
in_ch_map $CHANNEL_MAP_3_POINT_1
519+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
520+
out_ch_map $CHANNEL_MAP_3_POINT_1
521+
}
522+
}
523+
Object.Widget.gain.1 {
524+
num_audio_formats 2
525+
num_sink_audio_formats 2
526+
num_source_audio_formats 2
527+
Object.Base.audio_format.1 {
528+
in_bit_depth 32
529+
in_valid_bit_depth 32
530+
out_bit_depth 32
531+
out_valid_bit_depth 32
532+
dma_buffer_size "$[$ibs * 2]"
533+
}
534+
Object.Base.audio_format.2 {
535+
in_channels 4
536+
in_bit_depth 32
537+
in_valid_bit_depth 32
538+
out_channels 4
539+
out_bit_depth 32
540+
out_valid_bit_depth 32
541+
dma_buffer_size "$[$ibs * 2]"
542+
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
543+
in_ch_map $CHANNEL_MAP_3_POINT_1
544+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
545+
out_ch_map $CHANNEL_MAP_3_POINT_1
546+
}
547+
Object.Control.mixer.1 {
548+
name 'Capture Raw Volume 2'
549+
}
550+
}
551+
}
423552
}
424553

425554
Object.PCM {
@@ -503,7 +632,22 @@ Object.PCM {
503632
Object.Base.fe_dai."DMIC0 Raw" {}
504633

505634
Object.PCM.pcm_caps."capture" {
506-
name "DMIC0 Raw"
635+
name "Gain Capture 18"
636+
# only 32-bit capture supported now
637+
formats 'S32_LE'
638+
channels_min $NUM_DMICS
639+
channels_max $NUM_DMICS
640+
}
641+
}
642+
643+
pcm.28 {
644+
name "DMIC0 Raw 2"
645+
id 28
646+
direction "capture"
647+
Object.Base.fe_dai."DMIC0 Raw 2" {}
648+
649+
Object.PCM.pcm_caps."capture" {
650+
name "Gain Capture 20"
507651
# only 32-bit capture supported now
508652
formats 'S32_LE'
509653
channels_min $NUM_DMICS
@@ -568,6 +712,16 @@ Object.Base {
568712

569713
route.12 {
570714
source copier.module.14.2
715+
sink gain.19.1
716+
}
717+
718+
route.13 {
719+
source copier.module.19.1
571720
sink gain.18.1
572721
}
722+
723+
route.14 {
724+
source copier.module.19.1
725+
sink gain.20.1
726+
}
573727
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#
2+
# mid-stream pipeline: gain-module-copier
3+
#
4+
# All attributes defined herein are namespaced
5+
# by alsatplg to "Object.Pipeline.gain-module-copier.N.attribute_name"
6+
#
7+
# Usage: gain-module-copier pipeline object can be instantiated as:
8+
#
9+
# Object.Pipeline.gain-module-copier."N" {
10+
# direction "capture"
11+
# period 1000
12+
# channels 2
13+
# rate 48000
14+
# }
15+
#
16+
# Where N is the unique pipeline ID within the same alsaconf node.
17+
#
18+
19+
<include/common/audio_format.conf>
20+
<include/components/copier.conf>
21+
<include/components/gain.conf>
22+
<include/components/pipeline.conf>
23+
24+
Class.Pipeline."gain-module-copier" {
25+
26+
DefineAttribute."index" {}
27+
28+
<include/pipelines/pipeline-common.conf>
29+
30+
attributes {
31+
!constructor [
32+
"index"
33+
]
34+
35+
!mandatory [
36+
"direction"
37+
]
38+
39+
#
40+
# dai-copier-gain-module-copier-capture objects instantiated
41+
# within the same alsaconf node must have unique pipeline_id
42+
# attribute
43+
#
44+
unique "instance"
45+
}
46+
47+
Object.Widget {
48+
gain."1" {
49+
num_audio_formats 2
50+
num_sink_audio_formats 2
51+
num_source_audio_formats 2
52+
53+
#16-bit 48KHz 2ch
54+
Object.Base.audio_format.1 {}
55+
# 32-bit 48KHz 2ch
56+
Object.Base.audio_format.2 {
57+
in_bit_depth 32
58+
in_valid_bit_depth 32
59+
out_bit_depth 32
60+
out_valid_bit_depth 32
61+
}
62+
}
63+
copier."1" {
64+
type buffer
65+
copier_type "module"
66+
period_sink_count 2
67+
period_source_count 0
68+
num_audio_formats 2
69+
num_sink_audio_formats 2
70+
num_source_audio_formats 2
71+
72+
Object.Base.audio_format.1 {
73+
in_bit_depth 32
74+
in_valid_bit_depth 32
75+
out_bit_depth 32
76+
out_valid_bit_depth 32
77+
dma_buffer_size "$[$ibs * 2]"
78+
}
79+
}
80+
81+
pipeline."1" {
82+
priority 0
83+
lp_mode 0
84+
}
85+
}
86+
87+
Object.Base {
88+
route.1 {
89+
source gain..1
90+
sink copier.module..1
91+
}
92+
}
93+
94+
dynamic_pipeline 1
95+
time_domain "timer"
96+
channels 2
97+
channels_min 2
98+
channels_max 2
99+
rate 48000
100+
rate_min 48000
101+
rate_max 48000
102+
}

0 commit comments

Comments
 (0)