Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit 6efe3d4

Browse files
authored
Merge pull request #95 from singalsu/tplg_add_iir_dmic_pipe
Topology: Add DMIC capture pipeline with gain and high-pass filter
2 parents 7f47792 + 27281d7 commit 6efe3d4

6 files changed

Lines changed: 179 additions & 2 deletions

File tree

topology/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ MACHINES = \
3939
sof-apl-da7219.tplg \
4040
sof-glk-da7219.tplg \
4141
sof-icl-nocodec.tplg \
42-
sof-apl-eq-pcm512x.tplg
42+
sof-apl-eq-pcm512x.tplg \
43+
sof-apl-eq-dmic.tplg
4344

4445
# Uncomment the following line if you want to debug conf files
4546
.PRECIOUS: %.conf
@@ -79,4 +80,5 @@ EXTRA_DIST = \
7980
sof-apl-da7219.m4 \
8081
sof-glk-da7219.m4 \
8182
sof-icl-nocodec.m4 \
82-
sof-apl-eq-pcm512x.m4
83+
sof-apl-eq-pcm512x.m4 \
84+
sof-apl-eq-dmic.m4

topology/m4/eq_fir_coef_flat.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Flat FIR EQ 11-Oct-2018
2+
CONTROLBYTES_PRIV(EQFIR_priv,
3+
` bytes "0x18,0x00,0x00,0x00,0x02,0x00,0x01,0x00,'
4+
` 0x00,0x00,0x00,0x00,0x04,0x00,0xff,0xff,'
5+
` 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00"'
6+
)

topology/m4/eq_iir_coef_flat.m4

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Flat IIR EQ 11-Oct-2018
2+
CONTROLBYTES_PRIV(EQIIR_priv,
3+
` bytes "0x38,0x00,0x00,0x00,0x02,0x00,0x00,0x00,'
4+
` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
5+
` 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,'
6+
` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
7+
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
8+
` 0x00,0x00,0x00,0x00,0x9e,0x73,0x13,0x20,'
9+
` 0x00,0x00,0x00,0x00,0xb2,0x7f,0x00,0x00"'
10+
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 50 Hz 2nd order high-pass and +20 dB gain 09-Oct-2018
2+
CONTROLBYTES_PRIV(EQIIR_priv,
3+
` bytes "0x38,0x00,0x00,0x00,0x02,0x00,0x00,0x00,'
4+
` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
5+
` 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,'
6+
` 0x01,0x00,0x00,0x00,0x63,0xf3,0x96,0xc0,'
7+
` 0xc6,0x59,0x68,0x7f,0x6d,0x89,0xed,0x1f,'
8+
` 0x27,0xed,0x24,0xc0,0x6d,0x89,0xed,0x1f,'
9+
` 0xfc,0xff,0xff,0xff,0xd0,0x4f,0x00,0x00"'
10+
)

topology/sof-apl-eq-dmic.m4

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#
2+
# Topology for Apollo Lake with direct attach digital microphones array
3+
#
4+
5+
# Include topology builder
6+
include(`utils.m4')
7+
include(`dai.m4')
8+
include(`pipeline.m4')
9+
10+
# Include TLV library
11+
include(`common/tlv.m4')
12+
13+
# Include Token library
14+
include(`sof/tokens.m4')
15+
16+
# Include Apollolake DSP configuration
17+
include(`platform/intel/bxt.m4')
18+
include(`platform/intel/dmic.m4')
19+
20+
#
21+
# Define the pipelines
22+
#
23+
# PCM6 <---- volume <----- DMIC6 (DMIC01)
24+
#
25+
26+
dnl PIPELINE_PCM_ADD(pipeline,
27+
dnl pipe id, pcm, max channels, format,
28+
dnl frames, deadline, priority, core)
29+
30+
31+
# Passthrough capture pipeline 13 on PCM 6 using max 4 channels.
32+
# Schedule 48 frames per 1000us deadline on core 0 with priority 0
33+
PIPELINE_PCM_ADD(sof/pipe-eq-capture.m4,
34+
1, 6, 4, s32le,
35+
48, 1000, 0, 0)
36+
37+
#
38+
# DAIs configuration
39+
#
40+
41+
dnl DAI_ADD(pipeline,
42+
dnl pipe id, dai type, dai_index, dai_be,
43+
dnl buffer, periods, format,
44+
dnl frames, deadline, priority, core)
45+
46+
47+
# capture DAI is DMIC 0 using 2 periods
48+
# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
49+
DAI_ADD(sof/pipe-dai-capture.m4,
50+
1, DMIC, 0, NoCodec-6,
51+
PIPELINE_SINK_1, 2, s32le,
52+
48, 1000, 0, 0)
53+
54+
dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture)
55+
56+
dnl PCM_CAPTURE_ADD(name, pipeline, capture)
57+
PCM_CAPTURE_ADD(DMIC01, 6, PIPELINE_PCM_1)
58+
59+
#
60+
# BE configurations - overrides config in ACPI if present
61+
#
62+
63+
dnl DAI_CONFIG(type, dai_index, link_id, name, ssp_config/dmic_config)
64+
65+
DAI_CONFIG(DMIC, 0, 6, NoCodec-6,
66+
dnl DMIC_CONFIG(driver_version, clk_min, clk_mac, duty_min, duty_max,
67+
dnl sample_rate,
68+
dnl fifo word length, type, dai_index, pdm controller config)
69+
DMIC_CONFIG(1, 500000, 4800000, 40, 60, 48000,
70+
dnl DMIC_WORD_LENGTH(frame_format)
71+
DMIC_WORD_LENGTH(s32le), DMIC, 0,
72+
dnl PDM_CONFIG(type, dai_index, num pdm active, pdm tuples list)
73+
dnl STEREO_PDM0 is a pre-defined pdm config for stereo capture
74+
PDM_CONFIG(DMIC, 0, FOUR_CH_PDM0_PDM1)))
75+

topology/sof/pipe-eq-capture.m4

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Capture Passthrough Pipeline and PCM
2+
#
3+
# Pipeline Endpoints for connection are :-
4+
#
5+
# host PCM_C <-- B0 <-- sink DAI0
6+
7+
# Include topology builder
8+
include(`utils.m4')
9+
include(`buffer.m4')
10+
include(`pcm.m4')
11+
include(`dai.m4')
12+
include(`pipeline.m4')
13+
include(`bytecontrol.m4')
14+
include(`eq_iir.m4')
15+
16+
#
17+
# Controls
18+
#
19+
20+
# Use 50 Hz highpass response with +20 dB gain
21+
include(`eq_iir_coef_highpass_50hz_20db_48khz.m4')
22+
23+
# EQ Bytes control with max value of 255
24+
C_CONTROLBYTES(EQIIR, PIPELINE_ID,
25+
CONTROLBYTES_OPS(bytes, 258 binds the mixer control to bytes get/put handlers, 258, 258),
26+
CONTROLBYTES_EXTOPS(258 binds the mixer control to bytes get/put handlers, 258, 258),
27+
, , ,
28+
CONTROLBYTES_MAX(, 316),
29+
,
30+
EQIIR_priv)
31+
32+
#
33+
# Components and Buffers
34+
#
35+
36+
# Host "Highpass Capture" PCM
37+
# with 0 sink and 2 source periods
38+
W_PCM_CAPTURE(PCM_ID, Highpass Capture, 0, 2, 2)
39+
40+
# "EQ 0" has 2 sink period and 2 source periods
41+
W_EQ_IIR(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "EQIIR"))
42+
43+
# Capture Buffers
44+
W_BUFFER(0, COMP_BUFFER_SIZE(2,
45+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
46+
PLATFORM_PASS_MEM_CAP)
47+
48+
W_BUFFER(1, COMP_BUFFER_SIZE(2,
49+
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, SCHEDULE_FRAMES),
50+
PLATFORM_PASS_MEM_CAP)
51+
52+
#
53+
# Pipeline Graph
54+
#
55+
# host PCM_C <--- B1 <--- EQ_IIR 0 <-- B0 <-- sink DAI0
56+
57+
P_GRAPH(pipe-pass-capture-PIPELINE_ID, PIPELINE_ID,
58+
LIST(` ',
59+
`dapm(Highpass Capture PCM_ID, N_PCMC(PCM_ID))',
60+
`dapm(N_PCMC(PCM_ID), N_BUFFER(1))',
61+
`dapm(N_BUFFER(1), N_EQ_IIR(0))',
62+
`dapm(N_EQ_IIR(0), N_BUFFER(0))'))
63+
64+
#
65+
# Pipeline Source and Sinks
66+
#
67+
indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(0))
68+
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Highpass Capture PCM_ID)
69+
70+
#
71+
# PCM Configuration
72+
#
73+
74+
PCM_CAPABILITIES(Highpass Capture PCM_ID, COMP_FORMAT_NAME(PIPELINE_FORMAT), 48000, 48000, PIPELINE_CHANNELS, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)

0 commit comments

Comments
 (0)