1# Acoustic echo cancelling Pipeline and PCM
2#
3# Pipeline Endpoints for connection are :-
4#
5#  host PCM_C <-- B0 <-- AEC <-- B1 <-- source DAI0
6#                         ^----- B2 <-- AEC reference
7
8# Include topology builder
9include(`utils.m4')
10include(`buffer.m4')
11include(`pcm.m4')
12include(`dai.m4')
13include(`mixercontrol.m4')
14include(`pipeline.m4')
15include(`bytecontrol.m4')
16include(`enumcontrol.m4')
17include(`google_rtc_audio_processing.m4')
18
19#
20# Controls
21#
22
23include(`google_rtc_audio_processing_default.m4')
24
25# Byte control for AEC tuning data
26C_CONTROLBYTES(`Config', PIPELINE_ID,
27	CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258),
28	CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258),
29	, , ,
30	CONTROLBYTES_MAX(, 2048),
31	,
32	GOOGLE_RTC_AUDIO_PROCESSING_priv)
33
34#
35# Components and Buffers
36#
37
38# Host "Google RTC Audio Processing Capture" PCM
39# with 0 sink and 2 source periods
40W_PCM_CAPTURE(PCM_ID, Google RTC Audio Processing, 0, DAI_PERIODS, SCHEDULE_CORE)
41
42W_GOOGLE_RTC_AUDIO_PROCESSING(0, PIPELINE_FORMAT, 2, DAI_PERIODS, SCHEDULE_CORE,
43	`',
44	LIST(`          ', "Config"))
45
46# Capture Buffers
47W_BUFFER(0, COMP_BUFFER_SIZE(2,
48	COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
49	PLATFORM_HOST_MEM_CAP)
50W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS,
51	COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
52	PLATFORM_DAI_MEM_CAP)
53W_BUFFER(2, COMP_BUFFER_SIZE(DAI_PERIODS,
54	COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
55	PLATFORM_DAI_MEM_CAP)
56
57define(`N_AEC_REF_BUF',`BUF'PIPELINE_ID`.'2)
58#
59# Pipeline Graph
60#
61#  host PCM_P <-- B0 <-- AEC 0 <-- B1 <-- sink DAI0
62#                         ^------- B2 <-- AEC ref
63
64P_GRAPH(pipe-google-aec-capture-PIPELINE_ID, PIPELINE_ID,
65	LIST(`		',
66	`dapm(N_PCMC(PCM_ID), N_BUFFER(0))',
67	`dapm(N_BUFFER(0), N_GOOGLE_RTC_AUDIO_PROCESSING(0))',
68	`dapm(N_GOOGLE_RTC_AUDIO_PROCESSING(0), N_BUFFER(1))',
69	`dapm(N_GOOGLE_RTC_AUDIO_PROCESSING(0), N_BUFFER(2))'))
70
71#
72# Pipeline Source and Sinks
73#
74indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(1))
75indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Google RTC Audio Processing PCM_ID)
76
77#
78# PCM Configuration
79#
80
81PCM_CAPABILITIES(Google RTC Audio Processing PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT),
82	PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS,
83	2, 16, 192, 16384, 65536, 65536)
84