From d0760654f757841d6ae47a9a9d6743d7c679cd41 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Wed, 22 May 2024 15:10:23 +0300 Subject: [PATCH 1/2] Tools: Topology2: Remove gain from DMIC host copier pipeline This change prepares for adding it instead to DMIC DAI copier pipeline. There it will control mute/unmute for all possible module copier connected other capture PCMs. The pipeline object gain-capture is replaced with simpler host-gateway-capture. The definition of DMIC0_HOST_PIPELINE_SINK need to be changed from gain to host-copier. With this patch, the typical DMIC capture path looks like: dai-copier --> eqiir --> module-copier --> host-copier Signed-off-by: Seppo Ingalsuo --- tools/topology/topology2/cavs-nocodec.conf | 2 +- tools/topology/topology2/cavs-rt5682.conf | 2 +- tools/topology/topology2/cavs-sdw.conf | 2 +- .../platform/intel/dmic-generic.conf | 84 +------------------ tools/topology/topology2/sof-hda-generic.conf | 2 +- 5 files changed, 5 insertions(+), 87 deletions(-) diff --git a/tools/topology/topology2/cavs-nocodec.conf b/tools/topology/topology2/cavs-nocodec.conf index c017252201ac..9ac0baaf1aba 100644 --- a/tools/topology/topology2/cavs-nocodec.conf +++ b/tools/topology/topology2/cavs-nocodec.conf @@ -57,7 +57,7 @@ Define { # override DMIC default definitions DMIC0_HOST_PIPELINE_ID 13 DMIC0_DAI_PIPELINE_ID 14 - DMIC0_HOST_PIPELINE_SINK 'gain.13.1' + DMIC0_HOST_PIPELINE_SINK 'host-copier.10.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.14.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.NoCodec-6.capture' DMIC0_DAI_GAIN 'eqiir.14.1' diff --git a/tools/topology/topology2/cavs-rt5682.conf b/tools/topology/topology2/cavs-rt5682.conf index 8c8c72a208be..a0a25a2aade9 100644 --- a/tools/topology/topology2/cavs-rt5682.conf +++ b/tools/topology/topology2/cavs-rt5682.conf @@ -57,7 +57,7 @@ Define { DMIC1_ID 2 DMIC0_HOST_PIPELINE_ID 13 DMIC0_DAI_PIPELINE_ID 14 - DMIC0_HOST_PIPELINE_SINK 'gain.13.1' + DMIC0_HOST_PIPELINE_SINK 'host-copier.99.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.14.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.dmic01.capture' DMIC0_DAI_GAIN 'eqiir.14.1' diff --git a/tools/topology/topology2/cavs-sdw.conf b/tools/topology/topology2/cavs-sdw.conf index 12215b7cdb17..2f53a5f8850f 100644 --- a/tools/topology/topology2/cavs-sdw.conf +++ b/tools/topology/topology2/cavs-sdw.conf @@ -56,7 +56,7 @@ Define { PDM1_MIC_B_ENABLE 1 DMIC0_HOST_PIPELINE_ID 100 DMIC0_DAI_PIPELINE_ID 101 - DMIC0_HOST_PIPELINE_SINK 'gain.100.1' + DMIC0_HOST_PIPELINE_SINK 'host-copier.10.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.101.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.dmic01.capture' DMIC0_DAI_GAIN 'eqiir.101.1' diff --git a/tools/topology/topology2/platform/intel/dmic-generic.conf b/tools/topology/topology2/platform/intel/dmic-generic.conf index 36d0cb4be6db..6af99392482c 100644 --- a/tools/topology/topology2/platform/intel/dmic-generic.conf +++ b/tools/topology/topology2/platform/intel/dmic-generic.conf @@ -73,7 +73,7 @@ IncludeByKey.PASSTHROUGH { "true" "platform/intel/dmic-wov.conf" } - Object.Pipeline.gain-capture [ + Object.Pipeline.host-gateway-capture [ { format $FORMAT index $DMIC0_HOST_PIPELINE_ID @@ -114,85 +114,7 @@ IncludeByKey.PASSTHROUGH { } ] } - Object.Widget.gain.1 { - curve_duration 500000 - num_input_audio_formats 2 - num_output_audio_formats 2 - Object.Base.input_audio_format [ - { - in_rate $DMIC0_RATE - in_bit_depth 32 - in_valid_bit_depth 32 - } - { - in_rate $DMIC0_RATE - in_channels 4 - in_bit_depth 32 - in_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - in_ch_map $CHANNEL_MAP_3_POINT_1 - } - ] - Object.Base.output_audio_format [ - { - out_rate $DMIC0_RATE - out_bit_depth 32 - out_valid_bit_depth 32 - } - { - out_rate $DMIC0_RATE - out_channels 4 - out_bit_depth 32 - out_valid_bit_depth 32 - out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - out_ch_map $CHANNEL_MAP_3_POINT_1 - } - ] - Object.Control.mixer.1 { - name 'Dmic0 Capture Volume' - } - Object.Control.mixer.2 { - name 'Dmic0 Capture Switch' - - mute_led_use 1 - mute_led_direction 1 - } - } - Object.Widget.module-copier."2" { - num_input_audio_formats 2 - num_output_audio_formats 2 - Object.Base.input_audio_format [ - { - in_rate $DMIC0_RATE - in_bit_depth 32 - in_valid_bit_depth 32 - } - { - in_rate $DMIC0_RATE - in_channels 4 - in_bit_depth 32 - in_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - in_ch_map $CHANNEL_MAP_3_POINT_1 - } - ] - Object.Base.output_audio_format [ - { - out_rate $DMIC0_RATE - out_bit_depth 32 - out_valid_bit_depth 32 - } - { - out_rate $DMIC0_RATE - out_channels 4 - out_bit_depth 32 - out_valid_bit_depth 32 - out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 - out_ch_map $CHANNEL_MAP_3_POINT_1 - } - ] - } Object.Widget.pipeline."1" { core $DMIC_CORE_ID } @@ -361,10 +283,6 @@ IncludeByKey.PASSTHROUGH { source $DMIC0_DAI_PIPELINE_SRC sink $DMIC0_HOST_PIPELINE_SINK } - { - source "gain.$DMIC0_HOST_PIPELINE_ID.1" - sink "host-copier.$DMIC0_PCM_ID.capture" - } ] } "true" { diff --git a/tools/topology/topology2/sof-hda-generic.conf b/tools/topology/topology2/sof-hda-generic.conf index 16b39440bf58..a2581a62b170 100644 --- a/tools/topology/topology2/sof-hda-generic.conf +++ b/tools/topology/topology2/sof-hda-generic.conf @@ -46,7 +46,7 @@ Define { PLATFORM "none" NUM_DMICS 0 # doesn't it need to define DMIC0_HOST_PIPELINE_SINK and DMIC0_DAI_PIPELINE_SRC? - DMIC0_HOST_PIPELINE_SINK 'gain.11.1' + DMIC0_HOST_PIPELINE_SINK 'host-copier.6.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.12.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.dmic01.capture' DMIC0_DAI_GAIN 'eqiir.12.1' From e00ebc3f99b8f406e966a0395905259afcf35698 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Wed, 22 May 2024 16:22:10 +0300 Subject: [PATCH 2/2] Tools: Topology2: Move in DMIC capture gain from host to dai pipeline This change adds volume and switch "Dmic0" into dai-copier pipeline. It ensures that all capture from DMIC follows the mute key control even if some other processing and PCMs are added to module copier. The patch adds a new pipeline class dai-copier-eqiir-gain-module-copier-capture. It is similar as replaced dai-copier-eqiir-module-copier-capture but adds the gain component. The confusing DMIC0_DAI_GAIN (set to eqiir) is removed from all top level topologies (nocodec, rt5682, sdw, hda). After this a typical DMIC0 pipeline looks like: dai-copier --> eqiir --> gain --> module-copier --> host-copier Signed-off-by: Seppo Ingalsuo --- tools/topology/topology2/cavs-nocodec.conf | 3 +- tools/topology/topology2/cavs-rt5682.conf | 3 +- tools/topology/topology2/cavs-sdw.conf | 3 +- ...pier-eqiir-gain-module-copier-capture.conf | 204 ++++++++++++++++++ .../platform/intel/dmic-generic.conf | 55 ++++- tools/topology/topology2/sof-hda-generic.conf | 3 +- 6 files changed, 261 insertions(+), 10 deletions(-) create mode 100644 tools/topology/topology2/include/pipelines/cavs/dai-copier-eqiir-gain-module-copier-capture.conf diff --git a/tools/topology/topology2/cavs-nocodec.conf b/tools/topology/topology2/cavs-nocodec.conf index 9ac0baaf1aba..a81b7de39ad7 100644 --- a/tools/topology/topology2/cavs-nocodec.conf +++ b/tools/topology/topology2/cavs-nocodec.conf @@ -23,7 +23,7 @@ - + @@ -60,7 +60,6 @@ Define { DMIC0_HOST_PIPELINE_SINK 'host-copier.10.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.14.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.NoCodec-6.capture' - DMIC0_DAI_GAIN 'eqiir.14.1' DMIC0_NAME 'NoCodec-6' DMIC1_NAME 'NoCodec-7' DMIC0_PCM_CAPS 'Gain Capture 13' diff --git a/tools/topology/topology2/cavs-rt5682.conf b/tools/topology/topology2/cavs-rt5682.conf index a0a25a2aade9..6dea47f0c198 100644 --- a/tools/topology/topology2/cavs-rt5682.conf +++ b/tools/topology/topology2/cavs-rt5682.conf @@ -21,7 +21,7 @@ - + @@ -60,7 +60,6 @@ Define { DMIC0_HOST_PIPELINE_SINK 'host-copier.99.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.14.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.dmic01.capture' - DMIC0_DAI_GAIN 'eqiir.14.1' DMIC0_NAME 'dmic01' DMIC0_PCM_CAPS 'Gain Capture 13' # override BE link ids diff --git a/tools/topology/topology2/cavs-sdw.conf b/tools/topology/topology2/cavs-sdw.conf index 2f53a5f8850f..4f3e3f7a065c 100644 --- a/tools/topology/topology2/cavs-sdw.conf +++ b/tools/topology/topology2/cavs-sdw.conf @@ -13,7 +13,7 @@ - + @@ -59,7 +59,6 @@ Define { DMIC0_HOST_PIPELINE_SINK 'host-copier.10.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.101.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.dmic01.capture' - DMIC0_DAI_GAIN 'eqiir.101.1' DMIC0_NAME 'dmic01' DMIC0_ID 4 DMIC1_ID 5 diff --git a/tools/topology/topology2/include/pipelines/cavs/dai-copier-eqiir-gain-module-copier-capture.conf b/tools/topology/topology2/include/pipelines/cavs/dai-copier-eqiir-gain-module-copier-capture.conf new file mode 100644 index 000000000000..9a66d6b32f29 --- /dev/null +++ b/tools/topology/topology2/include/pipelines/cavs/dai-copier-eqiir-gain-module-copier-capture.conf @@ -0,0 +1,204 @@ +# +# BE capture pipeline: dai-copier-eqiir-gain-module-copier-capture +# +# All attributes defined herein are namespaced +# by alsatplg to "Object.Pipeline.dai-copier-eqiir-gain-module-copier-capture.N.attribute_name" +# +# Usage: dai-copier-eqiir-gain-module-copier-capture pipeline object can be instantiated as: +# +# Object.Pipeline.dai-copier-eqiir-gain-module-copier-capture."N" { +# period 1000 +# time_domain "timer" +# } +# +# Where N is the unique pipeline ID within the same alsaconf node. +# + + + + + + + + +Class.Pipeline."dai-copier-eqiir-gain-module-copier-capture" { + + + + attributes { + !constructor [ + "index" + ] + + !immutable [ + "direction" + ] + + # + # dai-copier-eqiir-gain-module-copier-capture objects instantiated + # within the same alsaconf node must have unique pipeline_id + # attribute + # + unique "instance" + } + + Object.Widget { + dai-copier."1" { + type dai_out + num_input_audio_formats 2 + num_output_audio_formats 2 + num_output_pins 1 + + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + { + in_channels 4 + in_bit_depth 32 + in_valid_bit_depth 32 + in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + in_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + { + out_channels 4 + out_bit_depth 32 + out_valid_bit_depth 32 + out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + out_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + } + + eqiir."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 + } + { + in_channels 4 + in_bit_depth 32 + in_valid_bit_depth 32 + in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + in_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + { + out_channels 4 + out_bit_depth 32 + out_valid_bit_depth 32 + out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + out_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + + Object.Control.bytes."1" { + IncludeByKey.DMIC0_DAI_EQIIR { + "passthrough" "include/components/eqiir/passthrough.conf" + "highpass_40hz_0db" "include/components/eqiir/highpass_40hz_0db_48khz.conf" + "highpass_40hz_20db" "include/components/eqiir/highpass_40hz_20db_48khz.conf" + } + } + } + + gain."1" { + num_input_audio_formats 2 + num_input_pins 1 + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + { + 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 + } + ] + + num_output_audio_formats 2 + num_output_pins 1 + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + { + 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 + } + ] + } + + module-copier."2" { + num_input_audio_formats 2 + num_output_audio_formats 2 + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + { + in_channels 4 + in_bit_depth 32 + in_valid_bit_depth 32 + in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + in_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + { + out_channels 4 + out_bit_depth 32 + out_valid_bit_depth 32 + out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + out_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + } + + pipeline."1" { + priority 0 + lp_mode 0 + } + } + + Object.Base { + route.1 { + source gain.$index.1 + sink module-copier.$index.2 + } + } + + direction "capture" + dynamic_pipeline 1 + time_domain "timer" +} diff --git a/tools/topology/topology2/platform/intel/dmic-generic.conf b/tools/topology/topology2/platform/intel/dmic-generic.conf index 6af99392482c..6dc43079d7d2 100644 --- a/tools/topology/topology2/platform/intel/dmic-generic.conf +++ b/tools/topology/topology2/platform/intel/dmic-generic.conf @@ -121,7 +121,7 @@ IncludeByKey.PASSTHROUGH { } ] - Object.Pipeline.dai-copier-eqiir-module-copier-capture [ + Object.Pipeline.dai-copier-eqiir-gain-module-copier-capture [ { index $DMIC0_DAI_PIPELINE_ID core_id $DMIC_CORE_ID @@ -268,6 +268,53 @@ IncludeByKey.PASSTHROUGH { } ] } + + Object.Widget.gain.1 { + curve_duration 500000 + num_input_audio_formats 2 + num_output_audio_formats 2 + Object.Base.input_audio_format [ + { + in_rate $DMIC0_RATE + in_bit_depth 32 + in_valid_bit_depth 32 + } + { + in_rate $DMIC0_RATE + in_channels 4 + in_bit_depth 32 + in_valid_bit_depth 32 + in_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + in_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + Object.Base.output_audio_format [ + { + out_rate $DMIC0_RATE + out_bit_depth 32 + out_valid_bit_depth 32 + } + { + out_rate $DMIC0_RATE + out_channels 4 + out_bit_depth 32 + out_valid_bit_depth 32 + out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 + out_ch_map $CHANNEL_MAP_3_POINT_1 + } + ] + Object.Control.mixer.1 { + name 'Dmic0 Capture Volume' + } + Object.Control.mixer.2 { + name 'Dmic0 Capture Switch' + + mute_led_use 1 + mute_led_direction 1 + } + } + + Object.Widget.pipeline."1" { core $DMIC_CORE_ID priority $DMIC_PIPELINE_PRIORITY @@ -277,7 +324,11 @@ IncludeByKey.PASSTHROUGH { Object.Base.route [ { source $DMIC0_DAI_COPIER - sink $DMIC0_DAI_GAIN + sink eqiir.$DMIC0_DAI_PIPELINE_ID.1 + } + { + source eqiir.$DMIC0_DAI_PIPELINE_ID.1 + sink gain.$DMIC0_DAI_PIPELINE_ID.1 } { source $DMIC0_DAI_PIPELINE_SRC diff --git a/tools/topology/topology2/sof-hda-generic.conf b/tools/topology/topology2/sof-hda-generic.conf index a2581a62b170..c95b1668a097 100644 --- a/tools/topology/topology2/sof-hda-generic.conf +++ b/tools/topology/topology2/sof-hda-generic.conf @@ -20,7 +20,7 @@ - + @@ -49,7 +49,6 @@ Define { DMIC0_HOST_PIPELINE_SINK 'host-copier.6.capture' DMIC0_DAI_PIPELINE_SRC 'module-copier.12.2' DMIC0_DAI_COPIER 'dai-copier.DMIC.dmic01.capture' - DMIC0_DAI_GAIN 'eqiir.12.1' DMIC0_DAI_EQIIR "highpass_40hz_20db" DMIC0_PCM_CAPS 'Gain Capture 11' }