From b148f23b7d81085da08fde8d62f12afdcb204a23 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Fri, 25 Aug 2023 14:58:29 -0700 Subject: [PATCH 1/3] topology2: speaker-echo-ref: Remove the echo ref PCM The echo-ref pipeline ie the DAI capture pipeline involving the speaker codec is already part of the list of pipelines that gets set up and triggered when the DMIC capture starts. Therefore, there's no need for the echo-ref PCM to explicitly start the reference capture. So, remove it and connect the codec DAI to the google-rts-aec module directly. Signed-off-by: Ranjani Sridharan --- tools/topology/topology2/cavs-rt5682.conf | 2 - .../intel/google-rtc-aec-reference.conf | 4 +- .../platform/intel/speaker-echo-ref.conf | 67 +++++-------------- 3 files changed, 17 insertions(+), 56 deletions(-) diff --git a/tools/topology/topology2/cavs-rt5682.conf b/tools/topology/topology2/cavs-rt5682.conf index 8c13b2131cac..40b670b4f4c3 100644 --- a/tools/topology/topology2/cavs-rt5682.conf +++ b/tools/topology/topology2/cavs-rt5682.conf @@ -87,7 +87,6 @@ Define { INCLUDE_ECHO_REF false ECHO_REF_HOST_PIPELINE_ID 7 ECHO_REF_DAI_PIPELINE_ID 8 - ECHO_REF_COPIER_MODULE 'module-copier.8.2' ECHO_REF_PCM_ID 29 ECHO_REF_CORE_ID 0 # override BT default definitions @@ -96,7 +95,6 @@ Define { BT_PB_DAI_PIPELINE_SRC "copier.host.9.1" BT_PB_PIPELINE_STREAM_NAME "dai-copier.SSP.10.1" GOOGLE_RTC_AEC_SUPPORT 0 - GOOGLE_RTC_AEC_REF_SOURCE 'module-copier.8.2' GOOGLE_AEC_CORE_ID 0 HEADSET_PCM_NAME "Headset" SPEAKER_PCM_NAME "Speakers" 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 b2e9a88ec1e9..bf605a4fee0e 100644 --- a/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf +++ b/tools/topology/topology2/platform/intel/google-rtc-aec-reference.conf @@ -14,7 +14,7 @@ Object.Pipeline.google-rtc-aec-capture [ } Object.Base.input_pin_binding.2 { - input_pin_binding_name $GOOGLE_RTC_AEC_REF_SOURCE + input_pin_binding_name "dai-copier.SSP.$SPEAKER_CODEC_NAME.capture" } } } @@ -97,7 +97,7 @@ Object.Base.route [ sink module-copier.18.1 } { - source $GOOGLE_RTC_AEC_REF_SOURCE + source "dai-copier.SSP.$SPEAKER_CODEC_NAME.capture" sink "google-rtc-aec.18.1" } { diff --git a/tools/topology/topology2/platform/intel/speaker-echo-ref.conf b/tools/topology/topology2/platform/intel/speaker-echo-ref.conf index 2ff5f3e22e5e..b5a029fc154e 100644 --- a/tools/topology/topology2/platform/intel/speaker-echo-ref.conf +++ b/tools/topology/topology2/platform/intel/speaker-echo-ref.conf @@ -1,25 +1,5 @@ -Define { - ECHO_REF_STREAM_NAME "Echo reference" -} - Object.Pipeline { - host-gateway-capture [ - { - index $ECHO_REF_HOST_PIPELINE_ID - core_id $ECHO_REF_CORE_ID - - Object.Widget.host-copier.1 { - core_id $ECHO_REF_CORE_ID - stream_name $ECHO_REF_STREAM_NAME - pcm_id $ECHO_REF_PCM_ID - } - Object.Widget.pipeline."1" { - core $ECHO_REF_CORE_ID - } - } - ] - - dai-copier-be [ + io-gateway-capture [ { index $ECHO_REF_DAI_PIPELINE_ID core_id $ECHO_REF_CORE_ID @@ -33,12 +13,20 @@ Object.Pipeline { copier_type "SSP" stream_name $SPEAKER_CODEC_NAME node_type $I2S_LINK_INPUT_CLASS - Object.Base.audio_format.1 { - in_bit_depth 32 - in_valid_bit_depth 32 - out_bit_depth 32 - out_valid_bit_depth 32 - } + num_input_audio_formats 1 + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + num_output_audio_formats 1 + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + ] } Object.Widget.pipeline."1" { core $ECHO_REF_CORE_ID @@ -46,28 +34,3 @@ Object.Pipeline { } ] } - -Object.PCM.pcm [ - { - name "EchoRef" - id $ECHO_REF_PCM_ID - direction "capture" - Object.Base.fe_dai.1 {} - - Object.PCM.pcm_caps.1 { - name $ECHO_REF_STREAM_NAME - formats 'S16_LE,S24_LE,S32_LE' - } - } -] - -Object.Base.route [ - { - source "dai-copier.SSP.$SPEAKER_CODEC_NAME.capture" - sink $ECHO_REF_COPIER_MODULE - } - { - source $ECHO_REF_COPIER_MODULE - sink "host-copier.$ECHO_REF_PCM_ID.capture" - } -] From b9eb831a80ca4266ad61ba2ceddf997771a69c22 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Thu, 31 Aug 2023 10:19:58 -0700 Subject: [PATCH 2/3] topology2: google-rtc-aec: Add 4ch audio formats The DMIC capture path should support both 4ch and 2ch audio formats. Also, since the Google AEC module only support 16-bit input format, modify the output of the refeence capture DAI accordingly. Signed-off-by: Ranjani Sridharan --- .../include/components/google-rtc-aec.conf | 42 ++++++---- .../cavs/google-rtc-aec-capture.conf | 82 ++++++++++++++----- .../platform/intel/speaker-echo-ref.conf | 4 +- 3 files changed, 92 insertions(+), 36 deletions(-) diff --git a/tools/topology/topology2/include/components/google-rtc-aec.conf b/tools/topology/topology2/include/components/google-rtc-aec.conf index e2df7a9dbeac..2d6ed613b469 100644 --- a/tools/topology/topology2/include/components/google-rtc-aec.conf +++ b/tools/topology/topology2/include/components/google-rtc-aec.conf @@ -87,35 +87,47 @@ Class.Widget."google-rtc-aec" { unique "instance" } - num_audio_formats 2 - num_input_audio_formats 2 - num_output_audio_formats 1 + 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 - Object.Base.input_audio_format { - 1 { + Object.Base.input_audio_format [ + # 2ch 16-bit on Pin 0 + { input_pin_index 0 in_bit_depth 16 in_valid_bit_depth 16 - out_bit_depth 16 - out_valid_bit_depth 16 } - 2 { + # 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 + } + # 2ch 16-bit on Pin 1 + { input_pin_index 1 in_bit_depth 16 in_valid_bit_depth 16 + } + ] + + Object.Base.output_audio_format [ + { out_bit_depth 16 out_valid_bit_depth 16 } - } - - Object.Base.output_audio_format { - 1 { - in_bit_depth 16 - in_valid_bit_depth 16 + # 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 } - } + ] # Default attribute values for google-rtc-aec widget # UUID: B780A0A6-269F-466F-B477-23DFA05AF758 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 6699ff23bbd0..8597ffbeac83 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 @@ -55,15 +55,38 @@ Class.Pipeline."google-rtc-aec-capture" { 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 - } + 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 + } + + ] } google-rtc-aec."1" { @@ -89,16 +112,37 @@ Class.Pipeline."google-rtc-aec-capture" { 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 - } + num_input_audio_formats 2 + num_output_audio_formats 2 + + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + } + { + 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 + } + ] + Object.Base.output_audio_format [ + # 2ch 32-bit + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + # 4ch 32-bit + { + out_bit_depth 32 + out_valid_bit_depth 32 + out_channels 4 + out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + out_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] } } diff --git a/tools/topology/topology2/platform/intel/speaker-echo-ref.conf b/tools/topology/topology2/platform/intel/speaker-echo-ref.conf index b5a029fc154e..733b9e51e993 100644 --- a/tools/topology/topology2/platform/intel/speaker-echo-ref.conf +++ b/tools/topology/topology2/platform/intel/speaker-echo-ref.conf @@ -23,8 +23,8 @@ Object.Pipeline { num_output_audio_formats 1 Object.Base.output_audio_format [ { - out_bit_depth 32 - out_valid_bit_depth 32 + out_bit_depth 16 + out_valid_bit_depth 16 } ] } From c7c0e42b64ee4c820ffa4c046350690d23944cc6 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Fri, 8 Sep 2023 08:00:00 -0700 Subject: [PATCH 3/3] topology2: google-rtc-aec: Remove byte control The blob contains the input/output audio formats but these are already passed during module init based on hw_params. So no need to have the byte control for it. Signed-off-by: Ranjani Sridharan --- .../google-rtc-aec/rtc-aec-blob.conf | 19 ------------------ .../cavs/google-rtc-aec-capture.conf | 20 ------------------- 2 files changed, 39 deletions(-) delete mode 100644 tools/topology/topology2/include/components/google-rtc-aec/rtc-aec-blob.conf 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 deleted file mode 100644 index f31ed7a0a747..000000000000 --- a/tools/topology/topology2/include/components/google-rtc-aec/rtc-aec-blob.conf +++ /dev/null @@ -1,19 +0,0 @@ -# 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 index 8597ffbeac83..09c3810279b0 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 @@ -89,26 +89,6 @@ Class.Pipeline."google-rtc-aec-capture" { ] } - 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