mirror of https://github.com/thesofproject/sof.git
topology1: mt8195: support Google rtc audio process with RTNR
This commit adds Google RTC Audio Processing with RTNR to MT8195 topology. Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
This commit is contained in:
parent
2fbbdb032c
commit
c8b375638c
|
@ -235,6 +235,7 @@ set(TPLGS
|
|||
"sof-mt8195-mt6359-rt1019-rt5682\;sof-mt8195-mt6359-rt1019-rt5682-dts\;-DDTS=`DTS'"
|
||||
"sof-mt8195-mt6359-rt1019-rt5682\;sof-mt8195-mt6359-max98390-rt5682"
|
||||
"sof-mt8195-mt6359-rt1019-rt5682\;sof-mt8195-mt6359-max98390-rt5682-rtnr\;-DCHANNELS=2\;-DRTNR"
|
||||
"sof-mt8195-mt6359-rt1019-rt5682\;sof-mt8195-mt6359-max98390-rt5682-google-aec-rtnr\;-DGOOGLE_RTC_AUDIO_PROCESSING\;-DCHANNELS=2\;-DRTNR"
|
||||
"sof-mt8186-mt6366\;sof-mt8186-mt6366-rt1019-rt5682s"
|
||||
"sof-mt8186-mt6366\;sof-mt8186-mt6366-da7219-max98357"
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ include(`pipeline.m4')
|
|||
include(`afe.m4')
|
||||
include(`pcm.m4')
|
||||
include(`buffer.m4')
|
||||
include(`muxdemux.m4')
|
||||
|
||||
# Include TLV library
|
||||
include(`common/tlv.m4')
|
||||
|
@ -19,6 +20,41 @@ include(`sof/tokens.m4')
|
|||
# Include DSP configuration
|
||||
include(`platform/mediatek/mt8195.m4')
|
||||
|
||||
#
|
||||
# Define the demux configure
|
||||
#
|
||||
dnl Configure demux
|
||||
dnl name, pipeline_id, routing_matrix_rows
|
||||
dnl Diagonal 1's in routing matrix mean that every input channel is
|
||||
dnl copied to corresponding output channels in all output streams.
|
||||
dnl I.e. row index is the input channel, 1 means it is copied to
|
||||
dnl corresponding output channel (column index), 0 means it is discarded.
|
||||
dnl There's a separate matrix for all outputs.
|
||||
define(matrix1, `ROUTE_MATRIX(1,
|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_PERIOD_US', 10000)', `define(`MIC_PERIOD_US', 2000)')
|
||||
|
||||
#
|
||||
# Define the pipelines
|
||||
#
|
||||
|
@ -37,9 +73,10 @@ dnl time_domain, sched_comp)
|
|||
# Low Latency playback pipeline 1 on PCM 16 using max 2 channels of s16le
|
||||
# Set 10000us deadline with priority 0 on core 0
|
||||
PIPELINE_PCM_ADD(
|
||||
ifdef(`DTS', sof/pipe-eq-iir-dts-codec-playback.m4, sof/pipe-passthrough-playback.m4),
|
||||
ifdef(`DTS', sof/pipe-eq-iir-dts-codec-playback.m4,
|
||||
ifdef(`GOOGLE_RTC_AUDIO_PROCESSING', sof/pipe-volume-demux-playback.m4, sof/pipe-passthrough-playback.m4)),
|
||||
1, 16, 2, s16le,
|
||||
1000, 0, 0,
|
||||
SPK_PERIOD_US, 0, 0,
|
||||
48000, 48000, 48000)
|
||||
|
||||
# Low Latency playback pipeline 2 on PCM 17 using max 2 channels of s16le
|
||||
|
@ -53,9 +90,13 @@ PIPELINE_PCM_ADD(
|
|||
# Low Latency capture pipeline 3 on PCM 18 using max 2 channels of s16le
|
||||
# Set 2000us deadline with priority 0 on core 0
|
||||
PIPELINE_PCM_ADD(
|
||||
ifdef(`RTNR', sof/pipe-rtnr-capture.m4, sof/pipe-passthrough-capture.m4),
|
||||
ifdef(`RTNR',
|
||||
ifdef(`GOOGLE_RTC_AUDIO_PROCESSING',
|
||||
sof/pipe-google-rtc-audio-processing-rtnr-capture.m4,
|
||||
sof/pipe-rtnr-capture.m4),
|
||||
sof/pipe-passthrough-capture.m4),
|
||||
3, 18, 2, s16le,
|
||||
2000, 0, 0,
|
||||
MIC_PERIOD_US, 0, 0,
|
||||
48000, 48000, 48000)
|
||||
|
||||
# Low Latency capture pipeline 4 on PCM 19 using max 2 channels of s16le
|
||||
|
@ -69,6 +110,19 @@ PIPELINE_PCM_ADD(sof/pipe-passthrough-capture.m4,
|
|||
# DAIs configuration
|
||||
#
|
||||
|
||||
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
|
||||
, `')
|
||||
|
||||
dnl DAI_ADD(pipeline,
|
||||
dnl pipe id, dai type, dai_index, dai_be,
|
||||
dnl buffer, periods, format,
|
||||
|
@ -80,7 +134,7 @@ dnl deadline, priority, core)
|
|||
DAI_ADD(sof/pipe-dai-playback.m4,
|
||||
1, AFE, 0, AFE_SOF_DL2,
|
||||
PIPELINE_SOURCE_1, 2, s16le,
|
||||
1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
|
||||
SPK_PERIOD_US, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
|
||||
|
||||
# playback DAI is AFE using 2 periods
|
||||
# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0
|
||||
|
@ -94,7 +148,7 @@ DAI_ADD(sof/pipe-dai-playback.m4,
|
|||
DAI_ADD(sof/pipe-dai-capture.m4,
|
||||
3, AFE, 2, AFE_SOF_UL4,
|
||||
PIPELINE_SINK_3, 2, s16le,
|
||||
2000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
|
||||
MIC_PERIOD_US, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)
|
||||
|
||||
# capture DAI is AFE using 2 periods
|
||||
# Buffers use s16le format, with 48 frame per 2000us on core 0 with priority 0
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
# 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')
|
||||
include(`rtnr.m4')
|
||||
|
||||
#
|
||||
# Controls
|
||||
#
|
||||
|
||||
include(`google_rtc_audio_processing_default.m4')
|
||||
|
||||
# Byte control for AEC tuning data
|
||||
C_CONTROLBYTES(`Config', 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)
|
||||
|
||||
define(DEF_RTNR_PRIV, concat(`rtnr_priv_', PIPELINE_ID))
|
||||
define(DEF_RTNR_BYTES, concat(`rtnr_bytes_', PIPELINE_ID))
|
||||
|
||||
CONTROLBYTES_PRIV(DEF_RTNR_PRIV,
|
||||
` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,'
|
||||
` 0x20,0x00,0x00,0x00,0x00,0x30,0x01,0x03,'
|
||||
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
|
||||
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
|
||||
` 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
|
||||
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
|
||||
` 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,'
|
||||
` 0x80,0xbb,0x00,0x00,0x00,0x00,0x00,0x00"'
|
||||
)
|
||||
|
||||
# RTNR Bytes control with max value of 255
|
||||
C_CONTROLBYTES(DEF_RTNR_BYTES, PIPELINE_ID,
|
||||
CONTROLBYTES_OPS(bytes, 258 binds the mixer control to bytes get/put handlers, 258, 258),
|
||||
CONTROLBYTES_EXTOPS(258 binds the mixer control to bytes get/put handlers, 258, 258),
|
||||
, , ,
|
||||
CONTROLBYTES_MAX(, 256),
|
||||
,
|
||||
DEF_RTNR_PRIV)
|
||||
|
||||
# RTNR Enable switch
|
||||
define(DEF_RTNR_ENABLE, concat(`rtnr_enable_', PIPELINE_ID))
|
||||
define(`CONTROL_NAME', `DEF_RTNR_ENABLE')
|
||||
|
||||
C_CONTROLMIXER(DEF_RTNR_ENABLE, PIPELINE_ID,
|
||||
CONTROLMIXER_OPS(volsw, 259 binds the mixer control to switch get/put handlers, 259, 259),
|
||||
CONTROLMIXER_MAX(max 1 indicates switch type control, 1),
|
||||
false,
|
||||
,
|
||||
Channel register and shift for Front Center,
|
||||
LIST(` ', KCONTROL_CHANNEL(FC, 3, 0)),
|
||||
"1")
|
||||
undefine(`CONTROL_NAME')
|
||||
|
||||
#
|
||||
# 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(` ', "Config"))
|
||||
|
||||
# "RTNR 0" has 2 sink period and 2 source periods
|
||||
W_RTNR(0, PIPELINE_FORMAT, 2, DAI_PERIODS, SCHEDULE_CORE,
|
||||
LIST(` ', "DEF_RTNR_BYTES"),
|
||||
LIST(` ', "DEF_RTNR_ENABLE"))
|
||||
|
||||
# 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)
|
||||
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)
|
||||
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)
|
||||
W_BUFFER(3, COMP_BUFFER_SIZE(DAI_PERIODS,
|
||||
COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
|
||||
PLATFORM_DAI_MEM_CAP)
|
||||
|
||||
define(`N_AEC_REF_BUF',`BUF'PIPELINE_ID`.'2)
|
||||
#
|
||||
# Pipeline Graph
|
||||
#
|
||||
# host PCM_P <-- B0 <-- RTNR 0 <-- B3 <-- 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_RTNR(0))',
|
||||
`dapm(N_RTNR(0), N_BUFFER(3))',
|
||||
`dapm(N_BUFFER(3), 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 RTC Audio Processing PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT),
|
||||
PCM_MIN_RATE, PCM_MAX_RATE, PIPELINE_CHANNELS, PIPELINE_CHANNELS,
|
||||
2, 16, 192, 16384, 65536, 65536)
|
||||
|
||||
undefine(`DEF_RTNR_ENABLE')
|
||||
undefine(`DEF_RTNR_PRIV')
|
||||
undefine(`DEF_RTNR_BYTES')
|
Loading…
Reference in New Issue