1# 2# Topology for MT8195 board with mt6359/rt5682/rt1019 3# 4 5# Include topology builder 6include(`utils.m4') 7include(`dai.m4') 8include(`pipeline.m4') 9include(`afe.m4') 10include(`pcm.m4') 11include(`buffer.m4') 12include(`muxdemux.m4') 13 14# Include TLV library 15include(`common/tlv.m4') 16 17# Include Token library 18include(`sof/tokens.m4') 19 20# Include DSP configuration 21include(`platform/mediatek/mt8195.m4') 22 23# 24# Define the demux configure 25# 26dnl Configure demux 27dnl name, pipeline_id, routing_matrix_rows 28dnl Diagonal 1's in routing matrix mean that every input channel is 29dnl copied to corresponding output channels in all output streams. 30dnl I.e. row index is the input channel, 1 means it is copied to 31dnl corresponding output channel (column index), 0 means it is discarded. 32dnl There's a separate matrix for all outputs. 33define(matrix1, `ROUTE_MATRIX(1, 34 `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', 35 `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', 36 `BITS_TO_BYTE(0, 0, 1 ,0 ,0 ,0 ,0 ,0)', 37 `BITS_TO_BYTE(0, 0, 0 ,1 ,0 ,0 ,0 ,0)', 38 `BITS_TO_BYTE(0, 0, 0 ,0 ,1 ,0 ,0 ,0)', 39 `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,1 ,0 ,0)', 40 `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,1 ,0)', 41 `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')') 42 43define(matrix2, `ROUTE_MATRIX(3, 44 `BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)', 45 `BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)', 46 `BITS_TO_BYTE(0, 0, 1 ,0 ,0 ,0 ,0 ,0)', 47 `BITS_TO_BYTE(0, 0, 0 ,1 ,0 ,0 ,0 ,0)', 48 `BITS_TO_BYTE(0, 0, 0 ,0 ,1 ,0 ,0 ,0)', 49 `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,1 ,0 ,0)', 50 `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,1 ,0)', 51 `BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')') 52 53 54ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', `MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2'))') 55ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', `define(`SPK_PERIOD_US', 10000)', `define(`SPK_PERIOD_US', 1000)') 56 57ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', 58 `define(`MIC_PERIOD_US', 10000)' 59 , 60 `ifdef(`RTNR', 61# 5ms period is required for RTNR build 20220728 and later versions 62 `define(`MIC_PERIOD_US', 5000)', 63 `define(`MIC_PERIOD_US', 2000)')' 64) 65 66# 67# Define the pipelines 68# 69# PCM16 ---> AFE (Speaker - rt1019) 70# PCM17 ---> AFE (Headset playback - rt5682) 71# PCM18 <--- AFE (DMIC - MT6365) 72# PCM19 <--- AFE (Headset record - rt5682) 73 74 75dnl PIPELINE_PCM_ADD(pipeline, 76dnl pipe id, pcm, max channels, format, 77dnl period, priority, core, 78dnl pcm_min_rate, pcm_max_rate, pipeline_rate, 79dnl time_domain, sched_comp) 80 81# Low Latency playback pipeline 1 on PCM 16 using max 2 channels of s16le 82# Set 10000us deadline with priority 0 on core 0 83PIPELINE_PCM_ADD( 84 ifdef(`DTS', sof/pipe-eq-iir-dts-codec-playback.m4, 85 ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', sof/pipe-volume-demux-playback.m4, sof/pipe-passthrough-playback.m4)), 86 1, 16, 2, s16le, 87 SPK_PERIOD_US, 0, 0, 88 48000, 48000, 48000) 89 90# Low Latency playback pipeline 2 on PCM 17 using max 2 channels of s16le 91# Set 10000us deadline with priority 0 on core 0 92PIPELINE_PCM_ADD( 93 ifdef(`DTS', sof/pipe-eq-iir-dts-codec-playback.m4, sof/pipe-passthrough-playback.m4), 94 2, 17, 2, s16le, 95 1000, 0, 0, 96 48000, 48000, 48000) 97 98# Low Latency capture pipeline 3 on PCM 18 using max 2 channels of s16le 99# Set 2000us deadline with priority 0 on core 0 100PIPELINE_PCM_ADD( 101 ifdef(`RTNR', 102 ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', 103 sof/pipe-rtnr-google-rtc-audio-processing-capture.m4, 104 sof/pipe-rtnr-capture.m4), 105 sof/pipe-passthrough-capture.m4), 106 3, 18, 2, s16le, 107 MIC_PERIOD_US, 0, 0, 108 48000, 48000, 48000) 109 110# Low Latency capture pipeline 4 on PCM 19 using max 2 channels of s16le 111# Set 2000us deadline with priority 0 on core 0 112PIPELINE_PCM_ADD(sof/pipe-passthrough-capture.m4, 113 4, 19, 2, s16le, 114 2000, 0, 0, 115 48000, 48000, 48000) 116 117# 118# DAIs configuration 119# 120 121dnl if using Google AEC 122ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', 123`# Connect demux to capture' 124`SectionGraph."PIPE_GOOGLE_RTC_AUDIO_PROCESSING_REF_AEC" {' 125` index "0"' 126` lines [' 127` # mux to capture' 128` dapm(N_AEC_REF_BUF, PIPELINE_DEMUX_1)' 129` ]' 130`}' 131dnl else 132, `') 133 134dnl DAI_ADD(pipeline, 135dnl pipe id, dai type, dai_index, dai_be, 136dnl buffer, periods, format, 137dnl deadline, priority, core) 138 139 140# playback DAI is AFE using 2 periods 141# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 142DAI_ADD(sof/pipe-dai-playback.m4, 143 1, AFE, 0, AFE_SOF_DL2, 144 PIPELINE_SOURCE_1, 2, s16le, 145 SPK_PERIOD_US, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) 146 147# playback DAI is AFE using 2 periods 148# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 149DAI_ADD(sof/pipe-dai-playback.m4, 150 2, AFE, 1, AFE_SOF_DL3, 151 PIPELINE_SOURCE_2, 2, s16le, 152 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) 153 154# capture DAI is AFE using 2 periods 155# Buffers use s16le format, with 48 frame per 2000us on core 0 with priority 0 156DAI_ADD(sof/pipe-dai-capture.m4, 157 3, AFE, 2, AFE_SOF_UL4, 158 PIPELINE_SINK_3, 2, s16le, 159 MIC_PERIOD_US, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) 160 161# capture DAI is AFE using 2 periods 162# Buffers use s16le format, with 48 frame per 2000us on core 0 with priority 0 163DAI_ADD(sof/pipe-dai-capture.m4, 164 4, AFE, 3, AFE_SOF_UL5, 165 PIPELINE_SINK_4, 2, s16le, 166 2000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) 167 168#SCHEDULE_TIME_DOMAIN_DMA 169dnl PCM_PLAYBACK_ADD(name, pcm_id, playback) 170 171# PCM Low Latency, id 0 172PCM_PLAYBACK_ADD(SOF_DL2, 16, PIPELINE_PCM_1) 173PCM_PLAYBACK_ADD(SOF_DL3, 17, PIPELINE_PCM_2) 174PCM_CAPTURE_ADD(SOF_UL4, 18, PIPELINE_PCM_3) 175PCM_CAPTURE_ADD(SOF_UL5, 19, PIPELINE_PCM_4) 176 177dnl DAI_CONFIG(type, dai_index, link_id, name, afe_config) 178 179DAI_CONFIG(AFE, 0, 0, AFE_SOF_DL2, 180 AFE_CONFIG(AFE_CONFIG_DATA(AFE, 0, 48000, 2, s16le))) 181 182DAI_CONFIG(AFE, 1, 0, AFE_SOF_DL3, 183 AFE_CONFIG(AFE_CONFIG_DATA(AFE, 1, 48000, 2, s16le))) 184 185DAI_CONFIG(AFE, 2, 0, AFE_SOF_UL4, 186 AFE_CONFIG(AFE_CONFIG_DATA(AFE, 2, 48000, 2, s16le))) 187 188DAI_CONFIG(AFE, 3, 0, AFE_SOF_UL5, 189 AFE_CONFIG(AFE_CONFIG_DATA(AFE, 3, 48000, 2, s16le))) 190