1#
2# Topology for Cometlake with rt5682 codec and Keyword Detect.
3#
4
5# Include topology builder
6include(`utils.m4')
7include(`dai.m4')
8include(`pipeline.m4')
9include(`ssp.m4')
10include(`hda.m4')
11
12# Include TLV library
13include(`common/tlv.m4')
14
15# Include Token library
16include(`sof/tokens.m4')
17
18include(`abi.h')
19# Include Platform specific DSP configuration
20include(`platform/intel/'PLATFORM`.m4')
21
22define(KWD_PIPE_SCH_DEADLINE_US, 5000)
23
24DEBUG_START
25
26# if XPROC is not defined, define with default pipe
27ifdef(`HSMICPROC', , `define(HSMICPROC, volume)')
28ifdef(`HSEARPROC', , `define(HSEARPROC, volume)')
29ifdef(`DMICPROC', , `define(DMICPROC, passthrough)')
30ifdef(`DMIC16KPROC', , `define(DMIC16KPROC, passthrough)')
31
32# FIXME: Using DMIC16kHz instead of DMIC16k, otherwise M4 does not return.
33define(DMIC_16k_PCM_NAME, DMIC16kHz)
34
35#
36# Define the pipelines
37#
38# PCM0 <---> volume <----> SSP(SSP_INDEX, BE link 0)
39# PCM1 <---- DMICPROC <--- DMIC01 (dmic0 capture, , BE link 1)
40# PCM2 ----> volume -----> iDisp1 (HDMI/DP playback, BE link 3)
41# PCM3 ----> volume -----> iDisp2 (HDMI/DP playback, BE link 4)
42# PCM4 ----> volume -----> iDisp3 (HDMI/DP playback, BE link 5)
43# PCM8  <-------(pipe 8) <------------+- KPBM 0 <----- DMIC1 (dmic16k, BE link 2)
44#                                     |
45# Detector <--- selector (pipe 9) <---+
46#
47
48dnl PIPELINE_PCM_ADD(pipeline,
49dnl     pipe id, pcm, max channels, format,
50dnl     period, priority, core,
51dnl     pcm_min_rate, pcm_max_rate, pipeline_rate,
52dnl     time_domain, sched_comp)
53
54# Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s24le.
55# Schedule 1000us deadline with priority 0 on core 0
56PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
57	1, 0, 2, s24le,
58	1000, 0, 0,
59	48000, 48000, 48000)
60
61# Low Latency capture pipeline 2 on PCM 0 using max 2 channels of s24le.
62# Schedule 1000us deadline with priority 0 on core 0
63PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4,
64	2, 0, 2, s24le,
65	1000, 0, 0,
66	48000, 48000, 48000)
67
68# DMICPROC capture pipeline 3 on PCM 1 using max 4 channels.
69# Schedule 1000us deadline with priority 0 on core 0
70ifdef(`DMICPROC_FILTER1', `define(PIPELINE_FILTER1, DMICPROC_FILTER1)')
71ifdef(`DMICPROC_FILTER2', `define(PIPELINE_FILTER2, DMICPROC_FILTER2)')
72
73PIPELINE_PCM_ADD(sof/pipe-DMICPROC-capture.m4,
74	3, 1, 4, s32le,
75	1000, 0, 0,
76	48000, 48000, 48000)
77
78undefine(`PIPELINE_FILTER1')
79undefine(`PIPELINE_FILTER2')
80
81# Low Latency playback pipeline 4 on PCM 2 using max 2 channels of s32le.
82# Schedule 1000us deadline with priority 0 on core 0
83PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
84	4, 2, 2, s32le,
85	1000, 0, 0,
86	48000, 48000, 48000)
87
88# Low Latency playback pipeline 5 on PCM 3 using max 2 channels of s32le.
89# Schedule 1000us deadline with priority 0 on core 0
90PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
91	5, 3, 2, s32le,
92	1000, 0, 0,
93	48000, 48000, 48000)
94
95# Low Latency playback pipeline 6 on PCM 4 using max 2 channels of s32le.
96# Schedule 1000us deadline with priority 0 on core 0
97PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
98	6, 4, 2, s32le,
99	1000, 0, 0,
100	48000, 48000, 48000)
101
102#
103# DAIs configuration
104#
105
106dnl DAI_ADD(pipeline,
107dnl     pipe id, dai type, dai_index, dai_be,
108dnl     buffer, periods, format,
109dnl     deadline, priority, core, time_domain)
110
111# playback DAI is SSP(SPP_INDEX) using 2 periods
112# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
113DAI_ADD(sof/pipe-dai-playback.m4,
114	1, SSP, SSP_INDEX, SSP_NAME,
115	PIPELINE_SOURCE_1, 2, s24le,
116	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
117
118# capture DAI is SSP(SSP_INDEX) using 2 periods
119# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
120DAI_ADD(sof/pipe-dai-capture.m4,
121	2, SSP,SSP_INDEX, SSP_NAME,
122	PIPELINE_SINK_2, 2, s24le,
123	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
124
125# capture DAI is DMIC01 using 2 periods
126# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
127DAI_ADD(sof/pipe-dai-capture.m4,
128	3, DMIC, 0, dmic01,
129	PIPELINE_SINK_3, 2, s32le,
130	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
131
132# playback DAI is iDisp1 using 2 periods
133# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
134DAI_ADD(sof/pipe-dai-playback.m4,
135	4, HDA, 0, iDisp1,
136	PIPELINE_SOURCE_4, 2, s32le,
137	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
138
139# playback DAI is iDisp2 using 2 periods
140# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
141DAI_ADD(sof/pipe-dai-playback.m4,
142	5, HDA, 1, iDisp2,
143	PIPELINE_SOURCE_5, 2, s32le,
144	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
145
146# playback DAI is iDisp3 using 2 periods
147# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
148DAI_ADD(sof/pipe-dai-playback.m4,
149	6, HDA, 2, iDisp3,
150	PIPELINE_SOURCE_6, 2, s32le,
151	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
152
153#
154# KWD configuration
155#
156
157# Passthrough capture pipeline 7 on PCM 7 using max 2 channels.
158# Schedule 20000us deadline with priority 0 on core 0
159PIPELINE_PCM_DAI_ADD(sof/pipe-kfbm-capture.m4,
160	8, 8, 2, s24le,
161	KWD_PIPE_SCH_DEADLINE_US, 0, 0, DMIC, 1, s32le, 3,
162	16000, 16000, 16000)
163
164# capture DAI is DMIC 1 using 3 periods
165# Buffers use s32le format, with 320 frame per 20000us on core 0 with priority 0
166DAI_ADD(sof/pipe-dai-capture.m4,
167	8, DMIC, 1, dmic16k,
168	PIPELINE_SINK_8, 3, s32le,
169	KWD_PIPE_SCH_DEADLINE_US, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
170
171# PCM Low Latency, id 0
172dnl PCM_PLAYBACK_ADD(name, pcm_id, playback)
173PCM_DUPLEX_ADD(Port1, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
174PCM_CAPTURE_ADD(DMIC, 1, PIPELINE_PCM_3)
175PCM_PLAYBACK_ADD(HDMI1, 2, PIPELINE_PCM_4)
176PCM_PLAYBACK_ADD(HDMI2, 3, PIPELINE_PCM_5)
177PCM_PLAYBACK_ADD(HDMI3, 4, PIPELINE_PCM_6)
178
179# keyword detector pipe
180dnl PIPELINE_PCM_ADD(pipeline,
181dnl     pipe id, pcm, max channels, format,
182dnl     period, priority, core,
183dnl     pcm_min_rate, pcm_max_rate, pipeline_rate,
184dnl     time_domain, sched_comp, dynamic)
185PIPELINE_PCM_ADD(sof/pipe-detect.m4,
186	9, 1, 2, s24le,
187	KWD_PIPE_SCH_DEADLINE_US, 1, 0,
188	16000, 16000, 16000,
189	SCHEDULE_TIME_DOMAIN_TIMER,
190	PIPELINE_SCHED_COMP_8)
191
192# Connect pipelines together
193SectionGraph."pipe-sof-cml-keyword-detect" {
194        index "0"
195
196        lines [
197		# keyword detect
198                dapm(PIPELINE_SINK_9, PIPELINE_SOURCE_8)
199		dapm(PIPELINE_PCM_8, PIPELINE_DETECT_9)
200        ]
201}
202
203#
204# BE configurations - overrides config in ACPI if present
205#
206
207#SSP SSP_INDEX (ID: 0)
208DAI_CONFIG(SSP, SSP_INDEX, 0, SSP_NAME,
209	SSP_CONFIG(I2S, SSP_CLOCK(mclk, SSP_MCLK_RATE, codec_mclk_in),
210		      SSP_CLOCK(bclk, 2400000, codec_slave),
211		      SSP_CLOCK(fsync, 48000, codec_slave),
212		      SSP_TDM(2, 25, 3, 3),
213		      SSP_CONFIG_DATA(SSP, SSP_INDEX, 24)))
214
215# dmic01 (ID: 1)
216DAI_CONFIG(DMIC, 0, 1, dmic01,
217	   DMIC_CONFIG(1, 2400000, 4800000, 40, 60, 48000,
218		DMIC_WORD_LENGTH(s32le), 400, DMIC, 0,
219		PDM_CONFIG(DMIC, 0, FOUR_CH_PDM0_PDM1)))
220
221# dmic16k (ID: 2)
222DAI_CONFIG(DMIC, 1, 2, dmic16k,
223	   DMIC_CONFIG(1, 2400000, 4800000, 40, 60, 16000,
224		DMIC_WORD_LENGTH(s32le), 400, DMIC, 1,
225		PDM_CONFIG(DMIC, 1, STEREO_PDM0)))
226
227# 3 HDMI/DP outputs (ID: 3,4,5)
228DAI_CONFIG(HDA, 0, 3, iDisp1,
229	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 0, 48000, 2)))
230DAI_CONFIG(HDA, 1, 4, iDisp2,
231	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 1, 48000, 2)))
232DAI_CONFIG(HDA, 2, 5, iDisp3,
233	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 2, 48000, 2)))
234
235DEBUG_END
236