1#
2# Topology for Icelake with rt711 + rt1308 (x2) + rt715.
3#
4
5# Include topology builder
6include(`utils.m4')
7include(`dai.m4')
8include(`pipeline.m4')
9include(`alh.m4')
10include(`muxdemux.m4')
11include(`hda.m4')
12
13# Include TLV library
14include(`common/tlv.m4')
15
16# Include Token library
17include(`sof/tokens.m4')
18
19# Include Platform specific DSP configuration
20include(`platform/intel/'PLATFORM`.m4')
21
22ifdef(`UAJ_LINK',`',
23`define(UAJ_LINK, `0')')
24
25ifdef(`AMP_1_LINK',`',
26`define(AMP_1_LINK, `1')')
27
28ifdef(`AMP_2_LINK',`',
29`define(AMP_2_LINK, `2')')
30
31ifdef(`MIC_LINK',`',
32`define(MIC_LINK, `3')')
33
34# uncomment to remove HDMI support
35#define(NOHDMI, `1')
36
37# UAJ ID: 0, 1
38# AMP ID: 2, 3 (if EXT_AMP_REF defined)
39# DMIC ID: 4
40# HDMI ID calculated based on the configuration
41define(HDMI_BE_ID_BASE, `0')
42
43ifdef(`NO_JACK', `',
44	`undefine(`HDMI_BE_ID_BASE')
45	 define(HDMI_BE_ID_BASE, `2')'
46)
47
48ifdef(`NOAMP', `',
49	`undefine(`HDMI_BE_ID_BASE')
50	 define(HDMI_BE_ID_BASE, `3')'
51)
52
53ifdef(`EXT_AMP_REF',
54	`undefine(`HDMI_BE_ID_BASE')
55	 define(HDMI_BE_ID_BASE, `4')',
56	`'
57)
58
59ifdef(`NO_LOCAL_MIC', `',
60	`undefine(`HDMI_BE_ID_BASE')
61	 define(HDMI_BE_ID_BASE, `5')'
62)
63
64DEBUG_START
65
66dnl Configure demux
67dnl name, pipeline_id, routing_matrix_rows
68dnl Diagonal 1's in routing matrix mean that every input channel is
69dnl copied to corresponding output channels in all output streams.
70dnl I.e. row index is the input channel, 1 means it is copied to
71dnl corresponding output channel (column index), 0 means it is discarded.
72dnl There's a separate matrix for all outputs.
73ifdef(`NOAMP', `',
74`
75ifdef(`MONO', `',
76`
77define(matrix1, `ROUTE_MATRIX(3,
78			     `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)',
79			     `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)',
80			     `BITS_TO_BYTE(0, 0, 1 ,0 ,0 ,0 ,0 ,0)',
81			     `BITS_TO_BYTE(0, 0, 0 ,1 ,0 ,0 ,0 ,0)',
82			     `BITS_TO_BYTE(0, 0, 0 ,0 ,1 ,0 ,0 ,0)',
83			     `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,1 ,0 ,0)',
84			     `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,1 ,0)',
85			     `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')')
86
87define(matrix2, `ROUTE_MATRIX(4,
88			     `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)',
89			     `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)',
90			     `BITS_TO_BYTE(0, 0, 1 ,0 ,0 ,0 ,0 ,0)',
91			     `BITS_TO_BYTE(0, 0, 0 ,1 ,0 ,0 ,0 ,0)',
92			     `BITS_TO_BYTE(0, 0, 0 ,0 ,1 ,0 ,0 ,0)',
93			     `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,1 ,0 ,0)',
94			     `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,1 ,0)',
95			     `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')')
96
97dnl name, num_streams, route_matrix list
98MUXDEMUX_CONFIG(demux_priv_3, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2'))
99')
100')
101
102#
103# Define the pipelines
104#
105ifdef(`NOJACK', `',
106`
107# PCM0 ---> volume ----> mixer --->ALH 2 BE UAJ_LINK
108# PCM31 ---> volume ------^
109# PCM1 <--- volume <---- ALH 3 BE UAJ_LINK
110')
111ifdef(`NOAMP', `',
112`
113# PCM2 ---> volume ----> ALH 2 BE AMP_1_LINK
114ifdef(`MONO', `',
115`# PCM40 ---> volume ----> ALH 2 BE AMP_2_LINK')
116')
117ifdef(`NO_LOCAL_MIC', `',
118`# PCM4 <--- volume <---- ALH 2 BE MIC_LINK')
119
120ifdef(`NOHDMI', `',
121`
122# PCM5 ---> volume ----> iDisp1
123# PCM6 ---> volume ----> iDisp2
124# PCM7 ---> volume ----> iDisp3
125')
126
127dnl PIPELINE_PCM_ADD(pipeline,
128dnl     pipe id, pcm, max channels, format,
129dnl     period, priority, core,
130dnl     pcm_min_rate, pcm_max_rate, pipeline_rate,
131dnl     time_domain, sched_comp)
132
133ifdef(`NOJACK', `',
134`
135# Low Latency capture pipeline 2 on PCM 1 using max 2 channels of s32le.
136# Schedule 48 frames per 1000us deadline with priority 0 on core 0
137PIPELINE_PCM_ADD(sof/pipe-volume-switch-capture.m4,
138	2, 1, 2, s32le,
139	1000, 0, 0,
140	48000, 48000, 48000)
141')
142
143ifdef(`NOAMP', `',
144`
145ifdef(`MONO',
146`
147# Low Latency playback pipeline 3 on PCM 2 using max 2 channels of s32le.
148# Schedule 48 frames per 1000us deadline with priority 0 on core 0
149PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
150	3, 2, 2, s32le,
151	1000, 0, 0,
152	48000, 48000, 48000)
153',
154`
155# Low Latency playback pipeline 3 on PCM 2 using max 2 channels of s32le.
156# Schedule 48 frames per 1000us deadline with priority 0 on core 0
157PIPELINE_PCM_ADD(sof/pipe-volume-demux-playback.m4,
158	3, 2, 2, s32le,
159	1000, 0, 0,
160	48000, 48000, 48000)
161
162# Low Latency playback pipeline 4 on PCM 40 using max 2 channels of s32le.
163# Schedule 48 frames per 1000us deadline with priority 0 on core 0
164PIPELINE_PCM_ADD(sof/pipe-dai-endpoint.m4,
165	4, 40, 2, s32le,
166	1000, 0, 0,
167	48000, 48000, 48000)
168')
169')
170
171ifdef(`NO_LOCAL_MIC', `',
172`
173# Low Latency capture pipeline 5 on PCM 4 using max 2 channels of s32le.
174# Schedule 48 frames per 1000us deadline with priority 0 on core 0
175PIPELINE_PCM_ADD(sof/pipe-highpass-switch-capture.m4,
176	5, 4, 2, s32le,
177	1000, 0, 0,
178	48000, 48000, 48000)
179')
180
181# Low Latency playback pipeline 6 on PCM 5 using max 2 channels of s32le.
182# Schedule 48 frames per 1000us deadline with priority 0 on core 0
183PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
184	6, 5, 2, s32le,
185	1000, 0, 0,
186	48000, 48000, 48000)
187
188# Low Latency playback pipeline 7 on PCM 6 using max 2 channels of s32le.
189# Schedule 48 frames per 1000us deadline with priority 0 on core 0
190PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
191	7, 6, 2, s32le,
192	1000, 0, 0,
193	48000, 48000, 48000)
194
195# Low Latency playback pipeline 8 on PCM 7 using max 2 channels of s32le.
196# Schedule 48 frames per 1000us deadline with priority 0 on core 0
197PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
198	8, 7, 2, s32le,
199	1000, 0, 0,
200	48000, 48000, 48000)
201
202#
203# DAIs configuration
204#
205
206dnl DAI_ADD(pipeline,
207dnl     pipe id, dai type, dai_index, dai_be,
208dnl     buffer, periods, format,
209dnl     deadline, priority, core, time_domain)
210
211ifdef(`NOJACK', `',
212`
213# playback DAI is ALH(UAJ_LINK PIN2) using 2 periods
214# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
215# The NOT_USED_IGNORED is due to dependencies and is adjusted later with an explicit dapm line.
216
217DAI_ADD(sof/pipe-mixer-volume-dai-playback.m4,
218	1, ALH, eval(UAJ_LINK * 256 + 2), `SDW'eval(UAJ_LINK)`-Playback',
219	NOT_USE_IGNORED, 2, s24le,
220	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER, 2, 48000)
221
222# capture DAI is ALH(UAJ_LINK PIN3) using 2 periods
223# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
224DAI_ADD(sof/pipe-dai-capture.m4,
225	2, ALH, eval(UAJ_LINK * 256 + 3), `SDW'eval(UAJ_LINK)`-Capture',
226	PIPELINE_SINK_2, 2, s24le,
227	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
228
229# Low Latency playback pipeline 30 on PCM 0 using max 2 channels of s32le.
230# Schedule 48 frames per 1000us deadline on core 0 with priority 0
231PIPELINE_PCM_ADD(sof/pipe-host-volume-playback.m4,
232	30, 0, 2, s32le,
233	1000, 0, 0,
234	48000, 48000, 48000,
235	SCHEDULE_TIME_DOMAIN_TIMER,
236	PIPELINE_PLAYBACK_SCHED_COMP_1)
237
238# Deep buffer playback pipeline 31 on PCM 31 using max 2 channels of s32le
239# Set 1000us deadline on core 0 with priority 0.
240# TODO: Modify pipeline deadline to account for deep buffering
241ifdef(`HEADSET_DEEP_BUFFER',
242`
243PIPELINE_PCM_ADD(sof/pipe-host-volume-playback.m4,
244	31, 31, 2, s32le,
245	1000, 0, 0,
246	48000, 48000, 48000,
247	SCHEDULE_TIME_DOMAIN_TIMER,
248	PIPELINE_PLAYBACK_SCHED_COMP_1)
249'
250)
251
252SectionGraph."mixer-host" {
253	index "0"
254
255	lines [
256		# connect mixer dai pipelines to PCM pipelines
257		dapm(PIPELINE_MIXER_1, PIPELINE_SOURCE_30)
258ifdef(`HEADSET_DEEP_BUFFER',
259`
260		dapm(PIPELINE_MIXER_1, PIPELINE_SOURCE_31)
261'
262)
263	]
264}
265
266'
267)
268
269ifdef(`NOAMP', `',
270`
271# playback DAI is ALH(AMP_1_LINK PIN2/AMP_2_LINK PIN2) using 2 periods
272# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
273DAI_ADD(sof/pipe-dai-playback.m4,
274	3, ALH, eval(AMP_1_LINK * 256 + 2), `SDW'eval(AMP_1_LINK)`-Playback',
275	PIPELINE_SOURCE_3, 2, s24le,
276	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
277
278ifdef(`MONO', `',
279`DAI_ADD_SCHED(sof/pipe-dai-sched-playback.m4,
280	4, ALH, eval(AMP_2_LINK * 256 + 2), `SDW'eval(AMP_1_LINK)`-Playback',
281	PIPELINE_SOURCE_4, 2, s24le,
282	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER,
283	PIPELINE_PLAYBACK_SCHED_COMP_3)
284
285# Connect demux to 2nd pipeline
286SectionGraph."PIPE_DEMUX" {
287	index "4"
288
289	lines [
290		# mux to 2nd pipeline
291		dapm(PIPELINE_SOURCE_4, PIPELINE_DEMUX_3)
292	]
293}
294')
295')
296
297ifdef(`NO_LOCAL_MIC', `',
298`
299# capture DAI is ALH(MIC_LINK PIN2) using 2 periods
300# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
301DAI_ADD(sof/pipe-dai-capture.m4,
302	5, ALH, eval(MIC_LINK * 256 + 2), `SDW'eval(MIC_LINK)`-Capture',
303	PIPELINE_SINK_5, 2, s24le,
304	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
305')
306
307ifdef(`NOHDMI', `',
308`
309# playback DAI is iDisp1 using 2 periods
310# # Buffers use s32le format, 1000us deadline with priority 0 on core 0
311DAI_ADD(sof/pipe-dai-playback.m4,
312	6, HDA, 0, iDisp1,
313	PIPELINE_SOURCE_6, 2, s32le,
314	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
315
316# playback DAI is iDisp2 using 2 periods
317# # Buffers use s32le format, 1000us deadline with priority 0 on core 0
318DAI_ADD(sof/pipe-dai-playback.m4,
319	7, HDA, 1, iDisp2,
320	PIPELINE_SOURCE_7, 2, s32le,
321	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
322
323# playback DAI is iDisp3 using 2 periods
324# # Buffers use s32le format, 1000us deadline with priority 0 on core 0
325DAI_ADD(sof/pipe-dai-playback.m4,
326	8, HDA, 2, iDisp3,
327	PIPELINE_SOURCE_8, 2, s32le,
328	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
329')
330
331# PCM Low Latency, id 0
332dnl PCM_PLAYBACK_ADD(name, pcm_id, playback)
333
334ifdef(`NOJACK', `',
335`
336PCM_PLAYBACK_ADD(Jack Out, 0, PIPELINE_PCM_30)
337ifdef(`HEADSET_DEEP_BUFFER',
338`
339PCM_PLAYBACK_ADD(Jack Out DeepBuffer, 31, PIPELINE_PCM_31)
340'
341)
342PCM_CAPTURE_ADD(Jack In, 1, PIPELINE_PCM_2)
343')
344ifdef(`NOAMP', `',
345`
346PCM_PLAYBACK_ADD(Speaker, 2, PIPELINE_PCM_3)
347')
348ifdef(`NO_LOCAL_MIC', `', `PCM_CAPTURE_ADD(Microphone, 4, PIPELINE_PCM_5)')
349
350ifdef(`NOHDMI', `',
351`
352PCM_PLAYBACK_ADD(HDMI 1, 5, PIPELINE_PCM_6)
353PCM_PLAYBACK_ADD(HDMI 2, 6, PIPELINE_PCM_7)
354PCM_PLAYBACK_ADD(HDMI 3, 7, PIPELINE_PCM_8)
355')
356
357#
358# BE configurations - overrides config in ACPI if present
359#
360
361ifdef(`NOJACK', `',
362`
363#ALH dai index = ((link_id << 8) | PDI id)
364#ALH UAJ_LINK Pin2 (ID: 0)
365DAI_CONFIG(ALH, eval(UAJ_LINK * 256 + 2), 0, `SDW'eval(UAJ_LINK)`-Playback',
366	ALH_CONFIG(ALH_CONFIG_DATA(ALH, eval(UAJ_LINK * 256 + 2), 48000, 2)))
367
368#ALH UAJ_LINK Pin3 (ID: 1)
369DAI_CONFIG(ALH, eval(UAJ_LINK * 256 + 3), 1, `SDW'eval(UAJ_LINK)`-Capture',
370	ALH_CONFIG(ALH_CONFIG_DATA(ALH, eval(UAJ_LINK * 256 + 3), 48000, 2)))
371')
372
373ifdef(`NOAMP', `',
374`
375#ALH AMP_1_LINK Pin2 (ID: 2)
376DAI_CONFIG(ALH, eval(AMP_1_LINK * 256 + 2), 2, `SDW'eval(AMP_1_LINK)`-Playback',
377	ALH_CONFIG(ALH_CONFIG_DATA(ALH, eval(AMP_1_LINK * 256 + 2), 48000, 2)))
378')
379
380ifdef(`NO_LOCAL_MIC', `',
381`
382#ALH MIC_LINK Pin2 (ID: 4)
383DAI_CONFIG(ALH, eval(MIC_LINK * 256 + 2), 4, `SDW'eval(MIC_LINK)`-Capture',
384	ALH_CONFIG(ALH_CONFIG_DATA(ALH, eval(MIC_LINK * 256 + 2), 48000, 2)))
385')
386
387ifdef(`NOHDMI', `',
388`
389# 3 HDMI/DP outputs (ID: from HDMI_BE_ID_BASE)
390DAI_CONFIG(HDA, 0, HDMI_BE_ID_BASE, iDisp1,
391	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 0, 48000, 2)))
392DAI_CONFIG(HDA, 1, eval(HDMI_BE_ID_BASE + 1), iDisp2,
393	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 1, 48000, 2)))
394DAI_CONFIG(HDA, 2, eval(HDMI_BE_ID_BASE + 2), iDisp3,
395	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 2, 48000, 2)))
396')
397
398DEBUG_END
399