Skip to content

Commit d085f9e

Browse files
committed
Tools: Topology: Add deep buffer capture option for DMIC
If DMIC0_DEEP_BUFFER is defined as true in topology build a deep buffer capture PCM is branched from module copier in DMIC0 capture pipeline. The patch adds a pipeline class deepbuffer-capture.conf and a topology .conf snippet dmic-deep-buffer.conf that is conditionally included from dmic-generic.conf. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 0bd5581 commit d085f9e

File tree

6 files changed

+240
-0
lines changed

6 files changed

+240
-0
lines changed

tools/topology/topology2/cavs-sdw.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<gain-capture.conf>
2121
<gain-copier-capture.conf>
2222
<deepbuffer-playback.conf>
23+
<deepbuffer-capture.conf>
2324
<host-gateway-playback.conf>
2425
<host-gateway-capture.conf>
2526
<host-gateway-tdfb-drc-capture.conf>
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#
2+
# FE capture pipeline: deepbuffer-capture
3+
#
4+
# All attributes defined herein are namespaced
5+
# by alsatplg to "Object.Pipeline.deepbuffer-capture.N.attribute_name"
6+
#
7+
# Usage: deepbuffer-capture pipeline object can be instantiated as:
8+
#
9+
# Object.Pipeline.deepbuffer-capture."N" {
10+
# period 1000
11+
# time_domain "timer"
12+
# }
13+
#
14+
# Where N is the unique pipeline ID within the same alsaconf node.
15+
#
16+
17+
<include/common/input_audio_format.conf>
18+
<include/common/output_audio_format.conf>
19+
<include/components/host-copier.conf>
20+
<include/components/pipeline.conf>
21+
22+
Class.Pipeline."deepbuffer-capture" {
23+
24+
<include/pipelines/pipeline-common.conf>
25+
26+
attributes {
27+
!constructor [
28+
"index"
29+
]
30+
31+
!immutable [
32+
"direction"
33+
]
34+
35+
#
36+
# deepbuffer-capture objects instantiated within the same alsaconf node must have
37+
# unique pipeline_id attribute
38+
#
39+
unique "instance"
40+
}
41+
42+
Object.Widget {
43+
host-copier."1" {
44+
type "aif_out"
45+
node_type $HDA_HOST_INPUT_CLASS
46+
deep_buffer_dma_ms $DEEPBUFFER_FW_DMA_MS
47+
num_input_pins 1
48+
num_input_audio_formats 2
49+
num_output_audio_formats 6
50+
# Input sample format is always 32-bit for capture
51+
Object.Base.input_audio_format [
52+
{
53+
in_bit_depth 32
54+
in_valid_bit_depth 32
55+
}
56+
{
57+
in_bit_depth 32
58+
in_valid_bit_depth 32
59+
in_channels 4
60+
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
61+
in_ch_map $CHANNEL_MAP_3_POINT_1
62+
}
63+
]
64+
Object.Base.output_audio_format [
65+
{
66+
out_bit_depth 32
67+
out_valid_bit_depth 24
68+
}
69+
{
70+
out_bit_depth 32
71+
out_valid_bit_depth 32
72+
}
73+
{
74+
out_bit_depth 16
75+
out_valid_bit_depth 16
76+
}
77+
{
78+
out_bit_depth 32
79+
out_valid_bit_depth 24
80+
out_channels 4
81+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
82+
out_ch_map $CHANNEL_MAP_3_POINT_1
83+
}
84+
{
85+
out_bit_depth 32
86+
out_valid_bit_depth 32
87+
out_channels 4
88+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
89+
out_ch_map $CHANNEL_MAP_3_POINT_1
90+
}
91+
{
92+
out_bit_depth 16
93+
out_valid_bit_depth 16
94+
out_channels 4
95+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
96+
out_ch_map $CHANNEL_MAP_3_POINT_1
97+
}
98+
]
99+
}
100+
101+
pipeline."1" {
102+
priority 0
103+
# enable lp mode
104+
lp_mode 1
105+
}
106+
}
107+
108+
direction "capture"
109+
dynamic_pipeline 1
110+
time_domain "timer"
111+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
Object.Pipeline.deepbuffer-capture [
2+
{
3+
format $FORMAT
4+
index $DMIC0_DEEP_BUFFER_PIPELINE_ID
5+
Object.Widget.pipeline.1 {
6+
stream_name "$DMIC0_DEEP_BUFFER_PCM_NAME"
7+
}
8+
Object.Widget.host-copier.1 {
9+
stream_name $DMIC0_DEEP_BUFFER_PCM_NAME
10+
pcm_id $DMIC0_DEEP_BUFFER_PCM_ID
11+
num_input_audio_formats 2
12+
Object.Base.input_audio_format [
13+
{
14+
in_rate $DMIC0_RATE
15+
in_bit_depth 32
16+
in_valid_bit_depth 32
17+
}
18+
{
19+
in_rate $DMIC0_RATE
20+
in_channels 4
21+
in_bit_depth 32
22+
in_valid_bit_depth 32
23+
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
24+
in_ch_map $CHANNEL_MAP_3_POINT_1
25+
}
26+
]
27+
28+
num_output_audio_formats 6
29+
Object.Base.output_audio_format [
30+
{
31+
out_rate $DMIC0_RATE
32+
out_bit_depth 16
33+
out_valid_bit_depth 16
34+
}
35+
{
36+
out_rate $DMIC0_RATE
37+
out_bit_depth 32
38+
out_valid_bit_depth 24
39+
}
40+
{
41+
out_rate $DMIC0_RATE
42+
out_bit_depth 32
43+
out_valid_bit_depth 32
44+
}
45+
{
46+
out_rate $DMIC0_RATE
47+
out_channels 4
48+
out_bit_depth 16
49+
out_valid_bit_depth 16
50+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
51+
out_ch_map $CHANNEL_MAP_3_POINT_1
52+
}
53+
{
54+
out_rate $DMIC0_RATE
55+
out_channels 4
56+
out_bit_depth 32
57+
out_valid_bit_depth 24
58+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
59+
out_ch_map $CHANNEL_MAP_3_POINT_1
60+
}
61+
{
62+
out_rate $DMIC0_RATE
63+
out_channels 4
64+
out_bit_depth 32
65+
out_valid_bit_depth 32
66+
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
67+
out_ch_map $CHANNEL_MAP_3_POINT_1
68+
}
69+
]
70+
}
71+
}
72+
73+
]
74+
Object.PCM.pcm [
75+
{
76+
name "$DMIC0_DEEP_BUFFER_PCM_NAME"
77+
id $DMIC0_DEEP_BUFFER_PCM_ID
78+
direction "capture"
79+
capture_compatible_d0i3 $DEEPBUFFER_D0I3_COMPATIBLE
80+
81+
Object.Base.fe_dai."$DMIC0_DEEP_BUFFER_PCM_NAME" {}
82+
83+
Object.PCM.pcm_caps."capture" {
84+
name $DMIC0_DEEP_BUFFER_PCM_NAME
85+
formats 'S16_LE,S24_LE,S32_LE'
86+
channels_min $NUM_DMICS
87+
channels_max $NUM_DMICS
88+
# To avoid DMA spinning on a buffer we need bigger
89+
# buffer than the host buffer size, let's say twice as
90+
# big
91+
# (S16_LE, Stereo, 48KHz, DEEPBUFFER_FW_DMA_MS) * 2
92+
#
93+
# Note: The lower limit for the buffer size is rate
94+
# dependent
95+
IncludeByKey.DMIC0_RATE {
96+
"16000" {
97+
buffer_size_min "$[(((2 * $NUM_DMICS) * 16) * $DEEPBUFFER_FW_DMA_MS) * 2]"
98+
rates '16000'
99+
}
100+
"48000" {
101+
buffer_size_min "$[(((2 * $NUM_DMICS) * 48) * $DEEPBUFFER_FW_DMA_MS) * 2]"
102+
rates '48000'
103+
}
104+
"96000" {
105+
buffer_size_min "$[(((2 * $NUM_DMICS) * 96) * $DEEPBUFFER_FW_DMA_MS) * 2]"
106+
rates '96000'
107+
}
108+
}
109+
}
110+
}
111+
]
112+
Object.Base.route [
113+
{
114+
source "module-copier.$DMIC0_DAI_PIPELINE_ID.2"
115+
sink "host-copier.$DMIC0_DEEP_BUFFER_PCM_ID.capture"
116+
}
117+
]

tools/topology/topology2/platform/intel/dmic-default.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,10 @@ Define {
4747

4848
# Note: This will be redefined in dmic-generic.conf if not set from cmake
4949
DMIC0_PCM_CHANNELS 0
50+
51+
# Deep buffer capture
52+
DMIC0_DEEP_BUFFER_PCM_NAME "DMIC Deep Buffer"
53+
DMIC0_DEEP_BUFFER_PIPELINE_ID 18
54+
DMIC0_DEEP_BUFFER_PCM_ID 46
55+
DMIC0_DEEP_BUFFER false
5056
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,10 @@ Object.PCM.pcm [
10411041
}
10421042
]
10431043

1044+
IncludeByKey.DMIC0_DEEP_BUFFER {
1045+
"true" "platform/intel/dmic-deep-buffer.conf"
1046+
}
1047+
10441048
IncludeByKey.DMIC1_ENABLE {
10451049
"passthrough" "platform/intel/dmic1-passthrough.conf"
10461050
"mfcc" "platform/intel/dmic1-mfcc.conf"

tools/topology/topology2/sof-hda-generic.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<dai-copier-gain-eqiir-module-copier-capture.conf>
2525
<gain-capture.conf>
2626
<deepbuffer-playback.conf>
27+
<deepbuffer-capture.conf>
2728
<io-gateway.conf>
2829
<io-gateway-capture.conf>
2930
<highpass-capture-be.conf>

0 commit comments

Comments
 (0)