diff --git a/tools/topology/topology2/include/components/google-rtc-aec.conf b/tools/topology/topology2/include/components/google-rtc-aec.conf index 063807923d8d..3eab1c997764 100644 --- a/tools/topology/topology2/include/components/google-rtc-aec.conf +++ b/tools/topology/topology2/include/components/google-rtc-aec.conf @@ -98,9 +98,12 @@ Class.Widget."google-rtc-aec" { unique "instance" } - num_input_audio_formats 3 - num_output_audio_formats 2 - # pin0 is the data captured by DMIC and pin1 is the ref data from playback stream + 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. + # The module has multiple input pins, each pin must have a single format since the + # formats of the pins cannot be selected at runtime. The format of pin0 must match + # the output format. Override the pin0 and output formats for other channel counts. Object.Base.input_audio_format [ # 2ch 16-bit on Pin 0 { @@ -109,16 +112,6 @@ Class.Widget."google-rtc-aec" { in_valid_bit_depth 16 ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $BUFFER_PERIOD_MS ]" } - # 4ch 16-bit on Pin 0 - { - input_pin_index 0 - in_bit_depth 16 - in_valid_bit_depth 16 - in_channels 4 - in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - in_ch_map $CHANNEL_MAP_3_POINT_1 - ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $BUFFER_PERIOD_MS]" - } # 2ch 16-bit on Pin 1 { input_pin_index 1 @@ -135,16 +128,6 @@ Class.Widget."google-rtc-aec" { obs "$[(($out_channels * ($[($out_rate + 999)] / 1000)) * ($out_bit_depth / 8)) * $BUFFER_PERIOD_MS]" } - # 4ch 16-bit - { - out_bit_depth 16 - out_valid_bit_depth 16 - out_channels 4 - out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - out_ch_map $CHANNEL_MAP_3_POINT_1 - obs "$[(($out_channels * ($[($out_rate + 999)] / 1000)) * ($out_bit_depth / 8)) * $BUFFER_PERIOD_MS]" - - } ] # Default attribute values for google-rtc-aec widget 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 index 936d45c28c96..f01527f5b682 100644 --- a/tools/topology/topology2/include/pipelines/cavs/google-rtc-aec-capture.conf +++ b/tools/topology/topology2/include/pipelines/cavs/google-rtc-aec-capture.conf @@ -48,43 +48,12 @@ Class.Pipeline."google-rtc-aec-capture" { lp_mode 0 } + # The audio formats of module-copier.1 must be set by the pipeline object to + # match the single pin0 input format of the google-rtc-aec. module-copier."1" { period_sink_count 1 period_source_count 1 - num_audio_formats 1 - num_input_audio_formats 2 - num_output_audio_formats 2 - - Object.Base.input_audio_format [ - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - # 4ch 32-bit on Pin 0 - { - input_pin_index 0 - in_bit_depth 32 - in_valid_bit_depth 32 - in_channels 4 - in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - in_ch_map $CHANNEL_MAP_3_POINT_1 - } - ] - Object.Base.output_audio_format [ - { - out_bit_depth 16 - out_valid_bit_depth 16 - } - { - out_bit_depth 16 - out_valid_bit_depth 16 - out_channels 4 - out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - out_ch_map $CHANNEL_MAP_3_POINT_1 - } - - ] - } + } module-copier."2" { period_sink_count 1 diff --git a/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf b/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf index 57e9bcfa34da..90ee75a527ad 100644 --- a/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf +++ b/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf @@ -9,8 +9,83 @@ Object.Pipeline.google-rtc-aec-capture [ priority $GOOGLE_AEC_PIPELINE_PRIORITY } + # The DMIC path must use the same single format at the input of the + # google-rtc-aec as the module is configured with for its pin0. + Object.Widget.module-copier.1 { + num_input_audio_formats 1 + num_output_audio_formats 1 + IncludeByKey.NUM_DMICS { + "2" { + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + } + ] + } + "4" { + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + in_channels 4 + in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + in_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + out_channels 4 + out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + out_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + } + } + } + Object.Widget.google-rtc-aec.1 { core_id $GOOGLE_AEC_DP_CORE_ID + IncludeByKey.NUM_DMICS { + "4" { + # 4ch 16-bit on pin0 and as output, 2ch 16-bit on pin1 + Object.Base.input_audio_format [ + { + input_pin_index 0 + in_bit_depth 16 + in_valid_bit_depth 16 + in_channels 4 + in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + in_ch_map $CHANNEL_MAP_3_POINT_1 + ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $BUFFER_PERIOD_MS]" + } + { + input_pin_index 1 + in_bit_depth 16 + in_valid_bit_depth 16 + ibs "$[(($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)) * $BUFFER_PERIOD_MS]" + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 16 + out_valid_bit_depth 16 + out_channels 4 + out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + out_ch_map $CHANNEL_MAP_3_POINT_1 + obs "$[(($out_channels * ($[($out_rate + 999)] / 1000)) * ($out_bit_depth / 8)) * $BUFFER_PERIOD_MS]" + } + ] + } + } Object.Base.input_pin_binding.1 { input_pin_binding_name "module-copier.18.1" }