diff --git a/tools/topology/topology2/cavs-rt5682.conf b/tools/topology/topology2/cavs-rt5682.conf index e72046169158..cd6932dc9a82 100644 --- a/tools/topology/topology2/cavs-rt5682.conf +++ b/tools/topology/topology2/cavs-rt5682.conf @@ -21,6 +21,8 @@ + + @@ -41,6 +43,10 @@ + + + + Define { MCLK 24576000 @@ -91,6 +97,8 @@ Define { BT_PB_HOST_PIPELINE_SINK "copier.SSP.10.1" BT_PB_DAI_PIPELINE_SRC "copier.host.9.1" BT_PB_PIPELINE_STREAM_NAME "copier.SSP.10.1" + GOOGLE_RTC_AEC_SUPPORT 0 + GOOGLE_RTC_AEC_REF_SOURCE 'module-copier.8.2' } # override defaults with platform-specific config @@ -117,6 +125,11 @@ IncludeByKey.INCLUDE_ECHO_REF { "true" "platform/intel/speaker-echo-ref.conf" } +# enable GOOGLE RTC AEC if needed +IncludeByKey.GOOGLE_RTC_AEC_SUPPORT { + "[1]" "platform/intel/google-rtc-aec-reference.conf" +} + # # List of all DAIs # @@ -279,61 +292,6 @@ Object.Pipeline { } } ] - - gain-capture [ - { - format $FORMAT - index 16 - - Object.Widget.pipeline.1 { - stream_name "DMIC Raw" - } - Object.Widget.copier.1 { - stream_name "DMIC Raw" - Object.Base.audio_format.1 { - in_bit_depth 32 - in_valid_bit_depth 32 - out_bit_depth 32 - out_valid_bit_depth 32 - } - Object.Base.audio_format.2 { - in_channels 4 - in_bit_depth 32 - in_valid_bit_depth 32 - out_channels 4 - out_bit_depth 32 - out_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_QUATRO - in_ch_map $CHANNEL_MAP_3_POINT_1 - out_ch_cfg $CHANNEL_CONFIG_QUATRO - out_ch_map $CHANNEL_MAP_3_POINT_1 - } - } - Object.Widget.gain.1 { - Object.Base.audio_format.1 { - in_bit_depth 32 - in_valid_bit_depth 32 - out_bit_depth 32 - out_valid_bit_depth 32 - } - Object.Base.audio_format.2 { - in_channels 4 - in_bit_depth 32 - in_valid_bit_depth 32 - out_channels 4 - out_bit_depth 32 - out_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_QUATRO - in_ch_map $CHANNEL_MAP_3_POINT_1 - out_ch_cfg $CHANNEL_CONFIG_QUATRO - out_ch_map $CHANNEL_MAP_3_POINT_1 - } - Object.Control.mixer.1 { - name 'Capture Raw Volume 1' - } - } - } - ] } Object.PCM.pcm [ @@ -370,20 +328,6 @@ Object.PCM.pcm [ formats 'S16_LE,S24_LE,S32_LE' } } - { - name "DMIC Raw" - id 18 - direction "capture" - Object.Base.fe_dai."DMIC Raw" {} - - Object.PCM.pcm_caps."capture" { - name "DMIC Raw" - # only 32-bit capture supported now - formats 'S32_LE' - channels_min $NUM_DMICS - channels_max $NUM_DMICS - } - } ] Object.Base.route [ @@ -407,8 +351,4 @@ Object.Base.route [ source "copier.SSP.6.1" sink "copier.host.5.1" } - { - source "module-copier.14.2" - sink "gain.16.1" - } ] diff --git a/tools/topology/topology2/include/components/google-rtc-aec.conf b/tools/topology/topology2/include/components/google-rtc-aec.conf new file mode 100644 index 000000000000..f4c27ece570c --- /dev/null +++ b/tools/topology/topology2/include/components/google-rtc-aec.conf @@ -0,0 +1,139 @@ +# +# Common widget google-rtc-aec +# +# A generic google-rtc-aec widget. All attributes defined herein are namespaced +# by alsatplg to "Object.Widget.google-rtc-aec.N.attribute_name" +# +# Usage: this component can be used by instantiating it in the parent object. i.e. +# +# Object.Widget.google-rtc-aec."N" { +# index 1 +# type "effect" +# } +# +# Where N is the unique instance number for the google-rtc-aec object within the same alsaconf node. +Define { + AEC_UUID "a6:a0:80:b7:9f:26:6f:46:b4:77:23:df:a0:5a:f7:58" +} + +Class.Widget."google-rtc-aec" { + # + # Pipeline ID for the google-rtc-aec widget object + # + DefineAttribute."index" {} + + # + # google-rtc-aec object instance + # + DefineAttribute."instance" {} + + #include common component definition + + + DefineAttribute."num_audio_formats" { + # Token set reference name and type + token_ref "sof_tkn_comp.word" + } + + # + # google-rtc-aec widget UUID + # + DefineAttribute."uuid" { + type "string" + # Token set reference name and type + token_ref "sof_tkn_comp.uuid" + } + + DefineAttribute."cpc" { + # Token set reference name and type + token_ref "sof_tkn_comp.word" + } + + DefineAttribute."is_pages" { + # Token set reference name and type + token_ref "sof_tkn_comp.word" + } + + # Attribute categories + attributes { + # + # The google-rtc-aec widget name would be constructed using the index and instance attributes. + # For ex: "google-rtc-aec.1.1" or "google-rtc-aec.10.2" etc. + # + !constructor [ + "index" + "instance" + ] + + # + # mandatory attributes that must be provided when the class is instantiated + # + !mandatory [ + "no_pm" + "uuid" + "process_type" + ] + + # + # immutable attributes cannot be modified in the object instance + # + !immutable [ + "uuid" + "type" + ] + + # + # deprecated attributes should not be added in the object instance + # + !deprecated [ + "preload_count" + ] + + # + # google-rtc-aec widget objects instantiated within the same alsaconf node must have unique + # instance attribute + # + unique "instance" + } + + num_audio_formats 2 + num_input_audio_formats 2 + num_output_audio_formats 1 + # pin0 is the data captured by DMIC and pin1 is the ref data from playback stream + Object.Base.input_audio_format { + 1 { + pin_index 0 + in_bit_depth 16 + in_valid_bit_depth 16 + out_bit_depth 16 + out_valid_bit_depth 16 + } + 2 { + pin_index 1 + in_bit_depth 16 + in_valid_bit_depth 16 + out_bit_depth 16 + out_valid_bit_depth 16 + } + } + + Object.Base.output_audio_format { + 1 { + in_bit_depth 16 + in_valid_bit_depth 16 + out_bit_depth 16 + out_valid_bit_depth 16 + } + } + + # Default attribute values for google-rtc-aec widget + # UUID: B780A0A6-269F-466F-B477-23DFA05AF758 + uuid $AEC_UUID + type "effect" + no_pm "true" + core_id 0 + cpc 5000 + is_pages 1 + num_input_pins 2 + num_output_pins 1 +} diff --git a/tools/topology/topology2/include/components/google-rtc-aec/rtc-aec-blob.conf b/tools/topology/topology2/include/components/google-rtc-aec/rtc-aec-blob.conf new file mode 100644 index 000000000000..f31ed7a0a747 --- /dev/null +++ b/tools/topology/topology2/include/components/google-rtc-aec/rtc-aec-blob.conf @@ -0,0 +1,19 @@ +# aec blob data + +Object.Base.data."google-rtc-aec_blob" { + bytes " + 0x53, 0x4f, 0x46, 0x34, 0x00, 0x00, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + 0x80, 0xbb, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x10, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, + + 0x80, 0xbb, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x10, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00" +} diff --git a/tools/topology/topology2/include/pipelines/cavs/google-rtc-aec-capture.conf b/tools/topology/topology2/include/pipelines/cavs/google-rtc-aec-capture.conf new file mode 100644 index 000000000000..58b7dfbffb04 --- /dev/null +++ b/tools/topology/topology2/include/pipelines/cavs/google-rtc-aec-capture.conf @@ -0,0 +1,125 @@ +# +# cAVS google-rtc-aec capture pipeline +# +# A google-rtc-aec capture pipeline. All attributes defined herein are namespaced +# by alsatplg to "Object.Pipeline.google-rtc-aec-capture.N.attribute_name" +# +# Usage: google-rtc-aec-capture pipeline object can be instantiated as: +# +# Object.Pipeline.google-rtc-aec-capture."N" { +# format "s16le" +# period 1000 +# time_domain "timer" +# channels 2 +# rate 48000 +# } +# +# Where N is the unique pipeline ID within the same alsaconf node. +# + + + + + + + +Class.Pipeline."google-rtc-aec-capture" { + + DefineAttribute."index" {} + + + + attributes { + !constructor [ + "index" + ] + + !immutable [ + "direction" + ] + + # + # google-rtc-aec-capture objects instantiated within the same alsaconf node must have + # unique pipeline_id attribute + # + unique "instance" + } + + Object.Widget { + pipeline."1" { + priority 0 + lp_mode 0 + } + + module-copier."1" { + period_sink_count 1 + period_source_count 1 + num_audio_formats 1 + num_input_audio_formats 1 + num_output_audio_formats 1 + + Object.Base.audio_format.1 { + in_bit_depth 32 + in_valid_bit_depth 32 + out_bit_depth 16 + out_valid_bit_depth 16 + } + } + + google-rtc-aec."1" { + Object.Control.bytes."1" { + name google-rtc-aec_blob + access [ + tlv_read + tlv_callback + ] + + Object.Base.extops."extctl" { + get 258 + put 0 + } + max 4096 + + IncludeByKey.GOOGLE_RTC_AEC_SUPPORT { + "[1]" "include/components/google-rtc-aec/rtc-aec-blob.conf" + } + } + } + + module-copier."2" { + period_sink_count 1 + period_source_count 1 + num_audio_formats 1 + num_input_audio_formats 1 + num_output_audio_formats 1 + + Object.Base.audio_format.1 { + in_bit_depth 16 + in_valid_bit_depth 16 + out_bit_depth 32 + out_valid_bit_depth 32 + } + } + } + + Object.Base { + route.1 { + source module-copier.$index.1 + sink google-rtc-aec.$index.1 + } + route.2 { + source google-rtc-aec.$index.1 + sink module-copier.$index.2 + } + } + + direction "capture" + dynamic_pipeline 1 + time_domain "timer" + channels 2 + channels_min 2 + channels_max 2 + rate 48000 + rate_min 16000 + rate_max 48000 +} diff --git a/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf b/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf new file mode 100644 index 000000000000..e7c641468193 --- /dev/null +++ b/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf @@ -0,0 +1,98 @@ +Object.Pipeline.google-rtc-aec-capture [ + { + index 18 + Object.Widget.pipeline.1 { + stream_name "DMIC0 RTC AEC" + } + + Object.Widget.google-rtc-aec.1 { + Object.Base.input_pin_binding.1 { + input_pin_binding_name "module-copier.18.1" + } + + Object.Base.input_pin_binding.2 { + input_pin_binding_name $GOOGLE_RTC_AEC_REF_SOURCE + } + } + } +] + +Object.Pipeline.host-gateway-capture[ + { + index 19 + + Object.Widget.copier.1 { + stream_name "DMIC0 AEC" + } + } +] + +Object.Pipeline.gain-capture [ + { + index 20 + + Object.Widget.copier.1 { + stream_name "DMIC0 AN" + } + + Object.Widget.gain.1 { + Object.Control.mixer.1 { + name 'AN Volume' + } + } + } +] + +Object.PCM.pcm [ + { + name "DMIC0 RTC AEC" + id 27 + direction "capture" + Object.Base.fe_dai.1 { + name "DMIC0 RTC AEC" + } + + Object.PCM.pcm_caps.1 { + name "DMIC0 AEC" + # only 32-bit capture supported now + formats 'S32_LE' + channels_min $NUM_DMICS + channels_max $NUM_DMICS + } + } + { + name "DMIC0 RTC AEC NS" + id 28 + direction "capture" + Object.Base.fe_dai.1 { + name "DMIC0 RTC AEC NS" + } + + Object.PCM.pcm_caps.1 { + name "DMIC0 AN" + # only 32-bit capture supported now + formats 'S32_LE' + channels_min $NUM_DMICS + channels_max $NUM_DMICS + } + } +] + +Object.Base.route [ + { + source $DMIC0_DAI_PIPELINE_SRC + sink module-copier.18.1 + } + { + source $GOOGLE_RTC_AEC_REF_SOURCE + sink "google-rtc-aec.18.1" + } + { + source "module-copier.18.2" + sink "copier.host.19.1" + } + { + source "module-copier.18.2" + sink "gain.20.1" + } +] diff --git a/tools/topology/topology2/sof-ace-tplg/tplg-targets.cmake b/tools/topology/topology2/sof-ace-tplg/tplg-targets.cmake index 5b0fbeddcfa3..99c54d15febe 100644 --- a/tools/topology/topology2/sof-ace-tplg/tplg-targets.cmake +++ b/tools/topology/topology2/sof-ace-tplg/tplg-targets.cmake @@ -32,7 +32,8 @@ NUM_HDMIS=0,SDW_SPK_STREAM=SDW2-Playback,SDW_SPK_IN_STREAM=SDW2-Capture,SDW_DMIC "cavs-rt5682\;sof-mtl-max98357a-rt5682\;PLATFORM=mtl,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,\ PDM1_MIC_B_ENABLE=1,DMIC0_PCM_ID=99,PREPROCESS_PLUGINS=nhlt,\ NHLT_BIN=nhlt-sof-mtl-max98357a-rt5682.bin,DEEPBUFFER_FW_DMA_MS=10,INCLUDE_ECHO_REF=true,\ -BT_NAME=SSP2-BT,BT_ID=8,BT_PCM_NAME=Bluetooth,USE_CHAIN_DMA=true,DEEPBUFFER_D0I3_COMPATIBLE=true" +BT_NAME=SSP2-BT,BT_ID=8,BT_PCM_NAME=Bluetooth,USE_CHAIN_DMA=true,DEEPBUFFER_D0I3_COMPATIBLE=true,\ +GOOGLE_RTC_AEC_SUPPORT=1" "cavs-rt5682\;sof-mtl-max98357a-rt5682-ssp2-ssp0\;PLATFORM=mtl,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,\ PDM1_MIC_B_ENABLE=1,DMIC0_PCM_ID=99,PREPROCESS_PLUGINS=nhlt,\