topology1: google-aec topology

Add topology to include google-rtc-audio-processing to a main topology.

Signed-off-by: Lionel Koenig <lionelk@google.com>
This commit is contained in:
Lionel Koenig 2022-01-18 16:44:16 +01:00 committed by Liam Girdwood
parent 12675d51ff
commit c48a5281a0
5 changed files with 145 additions and 8 deletions

View File

@ -139,6 +139,7 @@ set(TPLGS
"sof-tgl-max98357a-rt5682\;sof-adl-max98360a-rt5682-2way\;-DCODEC=MAX98360A_TDM\;-DFMT=s32le\;-DPLATFORM=adl\;-DAMP_SSP=1\;-D2CH_2WAY"
"sof-tgl-max98357a-rt5682\;sof-adl-max98360a-rt5682-4ch\;-DCODEC=MAX98360A_TDM\;-DFMT=s32le\;-DPLATFORM=adl\;-DAMP_SSP=1\;-D4CH_PASSTHROUGH"
"sof-tgl-max98357a-rt5682\;sof-tgl-max98357a-rt5682-pdm1\;-DCODEC=MAX98357A\;-DFMT=s16le\;-DDMIC_DAI_LINK_16k_PDM=STEREO_PDM1\;-DPLATFORM=tgl\;-DAMP_SSP=1"
"sof-tgl-max98357a-rt5682\;sof-tgl-max98357a-rt5682-pdm1-google-aec\;-DCODEC=MAX98357A\;-DFMT=s16le\;-DDMIC_DAI_LINK_16k_PDM=STEREO_PDM1\;-DPLATFORM=tgl\;-DAMP_SSP=1\;-DGOOGLE_RTC_AUDIO_PROCESSING"
"sof-tgl-max98357a-rt5682\;sof-tgl-max98357a-rt5682-pdm1-drceq\;-DCODEC=MAX98357A\;-DFMT=s16le\;-DDMIC_DAI_LINK_16k_PDM=STEREO_PDM1\;-DPLATFORM=tgl\;-DAMP_SSP=1\;-DDRC_EQ"
"sof-tgl-max98357a-rt5682\;sof-tgl-rt1011-rt5682\;-DCODEC=RT1011\;-DFMT=s24le\;-DPLATFORM=tgl\;-DAMP_SSP=1"
"sof-tgl-max98357a-rt5682\;sof-tgl-max98357a-rt5682-rtnr\;-DCODEC=MAX98357A\;-DFMT=s16le\;-DPLATFORM=tgl\;-DAMP_SSP=1\;-DCHANNELS=2\;-DRTNR"

View File

@ -0,0 +1,20 @@
CONTROLBYTES_PRIV(GOOGLE_RTC_AUDIO_PROCESSING_priv,
` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,'
` 0x6c,0x00,0x00,0x00,0x00,0x20,0x01,0x03,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0xe8,0x00,0x00,0x00,0x1e,'
` 0x00,0x00,0x00,0x01,0xd3,0x4d,0x62,0x00,'
` 0xb1,0xc2,0x09,0x04,0x00,0x00,0x00,0x40,'
` 0xa6,0x99,0x01,0x00,0xce,0xd8,0x0f,0x0a,'
` 0x1f,0x1a,0xf0,0xf5,0x83,0xc9,0xfe,0x01,'
` 0xdf,0x30,0x61,0x3a,0xcb,0x83,0x0e,0x01,'
` 0xef,0x84,0x73,0x01,0x6d,0x64,0x6b,0xff,'
` 0x03,0x41,0x22,0x00,0x05,0x00,0x00,0x00,'
` 0x00,0x10,0xf8,0x00,0xaa,0x81,0x10,0x00,'
` 0xf4,0xf0,0x8a,0x00,0xaa,0xe1,0x22,0x00,'
` 0xb9,0x9b,0x02,0x00"'
)

View File

@ -49,10 +49,17 @@ ifdef(`IGO',
`define(DMICPROC, igonr)',
`ifdef(`RTNR',
`define(DMICPROC, rtnr)',
`define(DMICPROC, passthrough)')')
`ifdef(`GOOGLE_RTC_AUDIO_PROCESSING',
`define(DMICPROC, google-rtc-audio-processing)', `define(DMICPROC, passthrough)')')')
# Prolong period to 16ms for igo_nr process
ifdef(`IGO', `define(`INTEL_GENERIC_DMIC_KWD_PERIOD', 16000)', `define(`INTEL_GENERIC_DMIC_KWD_PERIOD', 1000)')
ifdef(`IGO',
`define(`INTEL_GENERIC_DMIC_KWD_PERIOD', 16000)',
`ifdef(`GOOGLE_RTC_AUDIO_PROCESSING',
`define(`INTEL_GENERIC_DMIC_KWD_PERIOD', 10000)',
`define(`INTEL_GENERIC_DMIC_KWD_PERIOD', 1000)'
)'
)
# define(DMIC_DAI_LINK_16k_PDM, `STEREO_PDM0') define the PDM port, default is STEREO_PDM0
ifdef(`DMIC_DAI_LINK_16k_PDM',`',`define(DMIC_DAI_LINK_16k_PDM, `STEREO_PDM0')')
@ -80,7 +87,6 @@ define(`PGA_NAME', Dmic0)
PIPELINE_PCM_ADD(sof/pipe-`DMICPROC'-capture.m4,
DMIC_PIPELINE_48k_ID, DMIC_PCM_48k_ID, CHANNELS, s32le,
INTEL_GENERIC_DMIC_KWD_PERIOD, 0, DMIC_PIPELINE_48k_CORE_ID, 48000, 48000, 48000)
undefine(`PGA_NAME')
undefine(`PIPELINE_FILTER1')
undefine(`PIPELINE_FILTER2')

View File

@ -66,11 +66,26 @@ define(matrix3, `ROUTE_MATRIX(1,
`BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)',
`BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,0)')')
define(matrix4, `ROUTE_MATRIX(10,
`BITS_TO_BYTE(1, 0, 0 ,0 ,0 ,0 ,0 ,0)',
`BITS_TO_BYTE(0, 1, 0 ,0 ,0 ,0 ,0 ,0)',
`BITS_TO_BYTE(0, 0, 1 ,0 ,0 ,0 ,0 ,0)',
`BITS_TO_BYTE(0, 0, 0 ,1 ,0 ,0 ,0 ,0)',
`BITS_TO_BYTE(0, 0, 0 ,0 ,1 ,0 ,0 ,0)',
`BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,1 ,0 ,0)',
`BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,1 ,0)',
`BITS_TO_BYTE(0, 0, 0 ,0 ,0 ,0 ,0 ,1)')')
dnl name, num_streams, route_matrix list
ifdef(`NO_AMP',`',`
ifdef(`2CH_2WAY',
ifdef(`GOOGLE_RTC_AUDIO_PROCESSING',
`ifdef(`2CH_2WAY',
`MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix3,', `matrix4'))',
`MUXDEMUX_CONFIG(demux_priv_1, 3, LIST_NONEWLINE(`', `matrix1,', `matrix2,', `matrix4'))')',
`ifdef(`2CH_2WAY',
`MUXDEMUX_CONFIG(demux_priv_1, 1, LIST_NONEWLINE(`', `matrix3'))',
`MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2'))')')
`MUXDEMUX_CONFIG(demux_priv_1, 2, LIST_NONEWLINE(`', `matrix1,', `matrix2'))')'
)')
#
# Define the pipelines
@ -87,6 +102,8 @@ ifdef(`2CH_2WAY',
# PCM99 <---- volume <---- DMIC01 (dmic 48k capture)
# PCM100 <---- kpb <---- DMIC16K (dmic 16k capture)
ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', define(`SPK_MIC_PERIOD_US', 10000), define(`SPK_MIC_PERIOD_US', 1000))
ifdef(`NO_AMP',`',`
# Define pipeline id for sof-tgl-CODEC-rt5682.m4
ifdef(`AMP_SSP',`',`fatal_error(note: Define AMP_SSP for speaker amp SSP Index)')
@ -115,6 +132,8 @@ define(DMIC_PCM_16k_ID, `100')
define(DMIC_PIPELINE_16k_ID, `11')
define(DMIC_PIPELINE_KWD_ID, `12')
define(DMIC_DAI_LINK_16k_ID, `2')
define(DMIC_PIPELINE_48k_CORE_ID, `1')
# define pcm, pipeline and dai id
define(KWD_PIPE_SCH_DEADLINE_US, 5000)
@ -144,7 +163,7 @@ PIPELINE_PCM_ADD(
ifdef(`2CH_2WAY', sof/pipe-demux-eq-iir-playback.m4,
sof/pipe-volume-demux-playback.m4))),
1, 0, ifdef(`4CH_PASSTHROUGH', `4', `2'), s32le,
1000, 0, 0,
SPK_MIC_PERIOD_US, 0, 0,
48000, 48000, 48000)
undefine(`ENDPOINT_NAME')')
@ -207,7 +226,7 @@ ifdef(`NO_AMP',`',`
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, SPK_SSP_INDEX, SPK_SSP_NAME,
PIPELINE_SOURCE_1, 2, FMT,
1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
SPK_MIC_PERIOD_US, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
ifelse(CODEC, `MAX98390', `
# Low Latency capture pipeline 9 on PCM 6 using max 4 channels of s32le.
@ -258,6 +277,19 @@ SectionGraph."PIPE_CAP_VIRT" {
}
')')')
dnl if using Google AEC
ifdef(`GOOGLE_RTC_AUDIO_PROCESSING',
`# Connect demux to capture'
`SectionGraph."PIPE_GOOGLE_RTC_AUDIO_PROCESSING_REF_AEC" {'
` index "0"'
` lines ['
` # mux to capture'
` dapm(N_AEC_REF_BUF, PIPELINE_DEMUX_1)'
` ]'
`}'
dnl else
, `')
# playback DAI is SSP0 using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,

View File

@ -0,0 +1,78 @@
# Acoustic echo cancelling Pipeline and PCM
#
# Pipeline Endpoints for connection are :-
#
# host PCM_C <-- B0 <-- AEC <-- B1 <-- source DAI0
# ^----- B2 <-- AEC reference
# Include topology builder
include(`utils.m4')
include(`buffer.m4')
include(`pcm.m4')
include(`dai.m4')
include(`mixercontrol.m4')
include(`pipeline.m4')
include(`bytecontrol.m4')
include(`enumcontrol.m4')
include(`google_rtc_audio_processing.m4')
define(GOOGLE_RTC_AUDIO_PROCESSING_priv, concat(`google_rtc_audio_processing_bytes_', PIPELINE_ID))
define(GOOGLE_RTC_AUDIO_PROCESSING_CTRL, concat(`google_rtc_audio_processing_control_', PIPELINE_ID))
include(`google_rtc_audio_processing_default.m4')
C_CONTROLBYTES(GOOGLE_RTC_AUDIO_PROCESSING_CTRL, PIPELINE_ID,
CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258),
CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258),
, , ,
CONTROLBYTES_MAX(, 2048),
,
GOOGLE_RTC_AUDIO_PROCESSING_priv)
#
# Components and Buffers
#
# Host "Google RTC Audio Processing Capture" PCM
# with 0 sink and 2 source periods
W_PCM_CAPTURE(PCM_ID, Google RTC Audio Processing, 0, DAI_PERIODS, SCHEDULE_CORE)
W_GOOGLE_RTC_AUDIO_PROCESSING(0, PIPELINE_FORMAT, 2, DAI_PERIODS, SCHEDULE_CORE,
LIST(` ', "GOOGLE_RTC_AUDIO_PROCESSING_CTRL"))
# Capture Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(2,
COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
PLATFORM_HOST_MEM_CAP, SCHEDULE_CORE)
W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS,
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
PLATFORM_DAI_MEM_CAP, SCHEDULE_CORE)
W_BUFFER(2, COMP_BUFFER_SIZE(DAI_PERIODS,
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
PLATFORM_DAI_MEM_CAP, SCHEDULE_CORE)
define(`N_AEC_REF_BUF',`BUF'PIPELINE_ID`.'2)
#
# Pipeline Graph
#
# host PCM_P <-- B0 <-- AEC 0 <-- B1 <-- sink DAI0
# ^------- B2 <-- AEC ref
P_GRAPH(pipe-google-aec-capture-PIPELINE_ID, PIPELINE_ID,
LIST(` ',
`dapm(N_PCMC(PCM_ID), N_BUFFER(0))',
`dapm(N_BUFFER(0), N_GOOGLE_RTC_AUDIO_PROCESSING(0))',
`dapm(N_GOOGLE_RTC_AUDIO_PROCESSING(0), N_BUFFER(1))',
`dapm(N_GOOGLE_RTC_AUDIO_PROCESSING(0), N_BUFFER(2))'))
#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(1))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Google RTC Audio Processing PCM_ID)
#
# PCM Configuration
#
PCM_CAPABILITIES(Google AEC Capture PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT),
PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS,
2, 16, 192, 16384, 65536, 65536)