1#
2# Topology for i.MX8QM / i.MX8QXP boards mixing PCM and Compress streams
3#
4
5# Include topology builder
6include(`utils.m4')
7include(`dai.m4')
8include(`pipeline.m4')
9include(`pcm.m4')
10include(`sai.m4')
11
12# Include TLV library
13include(`common/tlv.m4')
14
15# Include Token library
16include(`sof/tokens.m4')
17
18# Include DSP configuration
19include(`platform/imx/imx8.m4')
20
21
22DECLARE_SOF_RT_UUID("Cadence Codec", cadence_codec_uuid, 0xd8218443, 0x5ff3,
23                    0x4a4c, 0xb3, 0x88, 0x6c, 0xfe, 0x07, 0xb9, 0x56, 0xaa);
24
25define(`CA_UUID', cadence_codec_uuid)
26
27# Post process setup config
28define(`CA_SETUP_CONTROLBYTES',
29``	bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,'
30`	0x0C,0x00,0x00,0x00,0x00,0x10,0x00,0x03,'
31`	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
32`	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
33`	0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,'
34`	0x20,0x00,0x00,0x00"''
35)
36
37define(`CA_SETUP_CONTROLBYTES_MAX', 300)
38
39undefine(`DAI_PERIODS')
40define(`DAI_PERIODS', 8)
41
42#
43# Define the pipelines
44#
45# PCM0 -----> volume ----------------v
46#                                    low latency mixer ----> volume ----> SAI1
47# Compr0 ----->Codec Adapter  -------^
48# PCM0 <---- Volume <---- SAI1
49#
50
51# Low Latency capture pipeline 2 on PCM 0 using max 2 channels of s32le.
52# 1000us deadline on core 0 with priority 0
53PIPELINE_PCM_ADD(sof/pipe-low-latency-capture.m4,
54	2, 0, 2, s32le,
55	1000, 0, 0,
56	48000, 48000, 48000)
57
58#
59# DAI configuration
60#
61# SAI port 1 is our only pipeline DAI
62#
63
64# playback DAI is SAI1 using 2 periods
65# Buffers use s32le format, 1000us deadline on core 0 with priority 1
66# this defines pipeline 1. The 'NOT_USED_IGNORED' is due to dependencies
67# and is adjusted later with an explicit dapm line.
68DAI_ADD(sof/pipe-mixer-volume-dai-playback.m4,
69	1, SAI, 1, sai1-wm8960-hifi,
70	NOT_USED_IGNORED, 2, s32le,
71	1000, 1, 0, SCHEDULE_TIME_DOMAIN_DMA,
72	2, 48000)
73
74# PCM Playback pipeline 3 on PCM 0 using max 2 channels of s32le.
75# 1000us deadline on core 0 with priority 0
76# this is connected to pipeline DAI 1
77PIPELINE_PCM_ADD(sof/pipe-host-volume-playback.m4,
78	3, 0, 2, s32le,
79	1000, 0, 0,
80	48000, 48000, 48000,
81	SCHEDULE_TIME_DOMAIN_DMA,
82	PIPELINE_PLAYBACK_SCHED_COMP_1)
83
84# Compress Playback pipeline 4 on Compr 1 using max 2 channels of s32le.
85# 5ms deadline on core 0 with priority 0
86# this is connected to pipeline DAI 1
87PIPELINE_PCM_ADD(sof/pipe-host-codec-adapter-playback.m4,
88	4, 1, 2, s32le,
89	5000, 0, 0,
90	48000, 48000, 48000,
91	SCHEDULE_TIME_DOMAIN_DMA,
92	PIPELINE_PLAYBACK_SCHED_COMP_1)
93
94# Connect pipelines together
95SectionGraph."PIPE_NAME" {
96	index "0"
97
98	lines [
99		# PCM pipeline 3 to DAI pipeline 1
100		dapm(PIPELINE_MIXER_1, PIPELINE_SOURCE_3)
101		# PCM pipeline 4 to DAI pipeline 1
102		dapm(PIPELINE_MIXER_1, PIPELINE_SOURCE_4)
103
104	]
105}
106
107# capture DAI is SAI1 using 2 periods
108# Buffers use s32le format, 1000us deadline on core 0 with priority 0
109# this is part of pipeline 2
110DAI_ADD(sof/pipe-dai-capture.m4,
111	2, SAI, 1, sai1-wm8960-hifi,
112	PIPELINE_SINK_2, 2, s32le,
113	1000, 0, 0, SCHEDULE_TIME_DOMAIN_DMA)
114
115
116# PCM definitions
117PCM_DUPLEX_ADD(PCM, 0, PIPELINE_PCM_3, PIPELINE_PCM_2)
118COMPR_PLAYBACK_ADD(PCM Deep Buffer, 1, PIPELINE_PCM_4)
119
120#
121# BE configurations
122#
123DAI_CONFIG(SAI, 1, 0, sai1-wm8960-hifi,
124	   SAI_CONFIG(I2S, SAI_CLOCK(mclk, 12288000, codec_mclk_in),
125		      SAI_CLOCK(bclk, 3072000, codec_master),
126		      SAI_CLOCK(fsync, 48000, codec_master),
127		      SAI_TDM(2, 16, 3, 3),
128
129		      SAI_CONFIG_DATA(SAI, 1, 0)))
130