1#
2# Topology for Tigerlake with Max98373 amp (SSP: $AMP_SSP)  + rt5682 codec + DMIC + 4 HDMI
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
18# Include Tigerlake DSP configuration
19include(`platform/intel/tgl.m4')
20include(`platform/intel/dmic.m4')
21
22DEBUG_START
23
24#
25# Define the pipelines
26#
27# PCM0 ----> smart_amp ----> SSP$AMP_SSP (Speaker -max98373)
28#              ^
29#              |
30#              |
31# PCM0 <---- demux <----- SSP$AMP_SSP (Speaker -max98373)
32# PCM1 <---> volume <----> SSP0  (Headset - ALC5682)
33# PCM2 ----> volume -----> iDisp1
34# PCM3 ----> volume -----> iDisp2
35# PCM4 ----> volume -----> iDisp3
36# PCM5 ----> volume -----> iDisp4
37# PCM6 ----> passthrough ----> SSP2 (Bluetooth)
38# PCM99 <---- volume <---- DMIC01 (dmic 48k capture)
39# PCM100 <---- kpb <---- DMIC16K (dmic 16k capture)
40
41
42ifdef(`AMP_SSP',`',`fatal_error(note: Define AMP_SSP for speaker amp SSP Index)')
43# Smart amplifier related
44# SSP related
45#define smart amplifier SSP index
46define(`SMART_SSP_INDEX', AMP_SSP)
47#define SSP BE dai_link name
48define(`SMART_SSP_NAME', concat(concat(`SSP', AMP_SSP),`-Codec'))
49#define BE dai_link ID
50define(`SMART_BE_ID', 7)
51#define SSP mclk
52define(`SSP_MCLK', 24576000)
53# Playback related
54define(`SMART_PB_PPL_ID', 1)
55define(`SMART_PB_CH_NUM', 2)
56define(`SMART_TX_CHANNELS', 4)
57define(`SMART_RX_CHANNELS', 4)
58define(`SMART_FB_CHANNELS', 4)
59# Ref capture related
60define(`SMART_REF_PPL_ID', 11)
61define(`SMART_REF_CH_NUM', 2)
62# PCM related
63define(`SMART_PCM_ID', 0)
64define(`SMART_PCM_NAME', `smart373-spk')
65
66# Include Smart Amplifier support
67include(`sof-smart-amplifier.m4')
68
69# Define pipeline id for intel-generic-dmic-kwd.m4
70# to generate dmic setting with kwd when we have dmic
71# define channel
72define(CHANNELS, `4')
73# define kfbm with volume
74define(KFBM_TYPE, `vol-kfbm')
75# define pcm, pipeline and dai id
76define(DMIC_PCM_48k_ID, `99')
77define(DMIC_PIPELINE_48k_ID, `4')
78define(DMIC_DAI_LINK_48k_ID, `1')
79define(DMIC_PCM_16k_ID, `100')
80define(DMIC_PIPELINE_16k_ID, `9')
81define(DMIC_PIPELINE_KWD_ID, `10')
82define(DMIC_DAI_LINK_16k_ID, `2')
83# Offload DMIC_PIPELINE_48K to secondary core of TGL.
84define(DMIC_PIPELINE_48k_CORE_ID, 1)
85# define pcm, pipeline and dai id
86define(KWD_PIPE_SCH_DEADLINE_US, 20000)
87# include the generic dmic with kwd
88include(`platform/intel/intel-generic-dmic-kwd.m4')
89
90# BT offload support
91define(`BT_PIPELINE_PB_ID', eval(SMART_REF_PPL_ID + 1))
92define(`BT_PIPELINE_CP_ID', eval(SMART_REF_PPL_ID + 2))
93define(`BT_DAI_LINK_ID', eval(SMART_BE_ID + 1))
94define(`BT_PCM_ID', `6')
95define(`HW_CONFIG_ID', `8')
96include(`platform/intel/intel-generic-bt.m4')
97
98dnl PIPELINE_PCM_ADD(pipeline,
99dnl     pipe id, pcm, max channels, format,
100dnl     frames, deadline, priority, core)
101
102ifdef(`INCLUDE_IIR_EQ',
103`
104# Low Latency playback pipeline 2 on PCM 1 using max 2 channels of s32le.
105# Schedule 48 frames per 1000us deadline on core 0 with priority 0
106PIPELINE_PCM_ADD(sof/pipe-eq-iir-volume-playback.m4,
107	2, 1, 2, s32le,
108	1000, 0, 0,
109	48000, 48000, 48000)
110'
111,
112`
113# Low Latency playback pipeline 2 on PCM 1 using max 2 channels of s32le.
114# Schedule 48 frames per 1000us deadline on core 0 with priority 0
115PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
116	2, 1, 2, s32le,
117	1000, 0, 0,
118	48000, 48000, 48000)
119')
120
121
122# Low Latency capture pipeline 3 on PCM 1 using max 2 channels of s32le.
123# Schedule 48 frames per 1000us deadline on core 0 with priority 0
124PIPELINE_PCM_ADD(sof/pipe-volume-capture.m4,
125	3, 1, 2, s32le,
126	1000, 0, 0,
127	48000, 48000, 48000)
128
129# Low Latency playback pipeline 5 on PCM 2 using max 2 channels of s32le.
130# Schedule 48 frames per 1000us deadline on core 0 with priority 0
131PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
132	5, 2, 2, s32le,
133	1000, 0, 0,
134	48000, 48000, 48000)
135
136# Low Latency playback pipeline 6 on PCM 3 using max 2 channels of s32le.
137# Schedule 48 frames per 1000us deadline on core 0 with priority 0
138PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
139	6, 3, 2, s32le,
140	1000, 0, 0,
141	48000, 48000, 48000)
142
143# Low Latency playback pipeline 7 on PCM 4 using max 2 channels of s32le.
144# Schedule 48 frames per 1000us deadline on core 0 with priority 0
145PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
146	7, 4, 2, s32le,
147	1000, 0, 0,
148	48000, 48000, 48000)
149
150# Low Latency playback pipeline 8 on PCM 5 using max 2 channels of s32le.
151# Schedule 48 frames per 1000us deadline on core 0 with priority 0
152PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
153	8, 5, 2, s32le,
154	1000, 0, 0,
155	48000, 48000, 48000)
156
157#
158# DAIs configuration
159#
160
161dnl DAI_ADD(pipeline,
162dnl     pipe id, dai type, dai_index, dai_be,
163dnl     buffer, periods, format,
164dnl     frames, deadline, priority, core)
165
166# playback DAI is SSP0 using 2 periods
167# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
168DAI_ADD(sof/pipe-dai-playback.m4,
169        2, SSP, 0, SSP0-Codec,
170        PIPELINE_SOURCE_2, 2, s32le,
171        1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
172
173# capture DAI is SSP0 using 2 periods
174# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
175DAI_ADD(sof/pipe-dai-capture.m4,
176        3, SSP, 0, SSP0-Codec,
177        PIPELINE_SINK_3, 2, s32le,
178        1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
179
180# playback DAI is iDisp1 using 2 periods
181# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
182DAI_ADD(sof/pipe-dai-playback.m4,
183	5, HDA, 0, iDisp1,
184	PIPELINE_SOURCE_5, 2, s32le,
185	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
186
187# playback DAI is iDisp2 using 2 periods
188# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
189DAI_ADD(sof/pipe-dai-playback.m4,
190	6, HDA, 1, iDisp2,
191	PIPELINE_SOURCE_6, 2, s32le,
192	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
193
194# playback DAI is iDisp3 using 2 periods
195# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
196DAI_ADD(sof/pipe-dai-playback.m4,
197	7, HDA, 2, iDisp3,
198	PIPELINE_SOURCE_7, 2, s32le,
199	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
200
201# playback DAI is iDisp4 using 2 periods
202# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
203DAI_ADD(sof/pipe-dai-playback.m4,
204	8, HDA, 3, iDisp4,
205	PIPELINE_SOURCE_8, 2, s32le,
206	1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
207
208#
209# Bind PCM with the pipeline
210#
211dnl PCM_PLAYBACK_ADD(name, pcm_id, playback)
212PCM_DUPLEX_ADD(Headset, 1, PIPELINE_PCM_2, PIPELINE_PCM_3)
213PCM_PLAYBACK_ADD(HDMI1, 2, PIPELINE_PCM_5)
214PCM_PLAYBACK_ADD(HDMI2, 3, PIPELINE_PCM_6)
215PCM_PLAYBACK_ADD(HDMI3, 4, PIPELINE_PCM_7)
216PCM_PLAYBACK_ADD(HDMI4, 5, PIPELINE_PCM_8)
217
218#
219# BE configurations - overrides config in ACPI if present
220#
221dnl DAI_CONFIG(type, dai_index, link_id, name, ssp_config/dmic_config)
222dnl SSP_CONFIG(format, mclk, bclk, fsync, tdm, ssp_config_data)
223dnl SSP_CLOCK(clock, freq, codec_master, polarity)
224dnl SSP_CONFIG_DATA(type, idx, valid bits, mclk_id)
225dnl mclk_id is optional
226dnl ssp1-maxmspk, ssp0-RTHeadset
227
228#SSP 0 (ID: 0)
229DAI_CONFIG(SSP, 0, 0, SSP0-Codec,
230        SSP_CONFIG(I2S, SSP_CLOCK(mclk, SSP_MCLK, codec_mclk_in),
231                      SSP_CLOCK(bclk, 3072000, codec_slave),
232                      SSP_CLOCK(fsync, 48000, codec_slave),
233                      SSP_TDM(2, 32, 3, 3),
234                      SSP_CONFIG_DATA(SSP, 0, 32)))
235
236# 4 HDMI/DP outputs (ID: 3,4,5,6)
237DAI_CONFIG(HDA, 0, 3, iDisp1,
238	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 0, 48000, 2)))
239DAI_CONFIG(HDA, 1, 4, iDisp2,
240	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 1, 48000, 2)))
241DAI_CONFIG(HDA, 2, 5, iDisp3,
242	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 2, 48000, 2)))
243DAI_CONFIG(HDA, 3, 6, iDisp4,
244	HDA_CONFIG(HDA_CONFIG_DATA(HDA, 3, 48000, 2)))
245
246DEBUG_END
247