From 3738de123180a4a4955f2fc60e3e228c5faef2e6 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Wed, 24 Jul 2024 16:55:20 +0200 Subject: [PATCH 1/3] topology2: remove audio_format We need to use input_audio_format and output_audio_format. Signed-off-by: Pierre-Louis Bossart --- .../include/common/audio_format.conf | 237 ------------------ .../include/pipelines/cavs/dai-kpb-be.conf | 3 +- .../cavs/google-rtc-aec-capture.conf | 3 +- .../mixout-gain-alh-dai-copier-playback.conf | 1 - ...ut-gain-eqiir-dts-dai-copier-playback.conf | 51 ++-- .../cavs/mixout-gain-host-copier-capture.conf | 3 +- .../cavs/src-gain-mixin-playback.conf | 1 - .../include/pipelines/gain-capture.conf | 3 +- 8 files changed, 44 insertions(+), 258 deletions(-) delete mode 100644 tools/topology/topology2/include/common/audio_format.conf diff --git a/tools/topology/topology2/include/common/audio_format.conf b/tools/topology/topology2/include/common/audio_format.conf deleted file mode 100644 index d572f3c00085..000000000000 --- a/tools/topology/topology2/include/common/audio_format.conf +++ /dev/null @@ -1,237 +0,0 @@ -## \struct audio_format -## \brief Class definition for audio format object -## -## audio_format objects can be instantiated as: -## -## Object.Base.audio_format."0" { -## in_rate 48000 -## in_sample_container_size 16 -## in_valid_bit_depth 16 -## in_interleaving_style "interleaved" -## out_rate 48000 -## out_sample_container_size 16 -## out_valid_bit_depth 16 -## out_interleaving_style "interleaved" -## } -## - -Class.Base."audio_format" { - - DefineAttribute."instance" { - } - - ## input sampling rate - DefineAttribute."in_rate" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - # #input bit depth - DefineAttribute."in_bit_depth" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## input valid bit depth - DefineAttribute."in_valid_bit_depth" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## input channel count - DefineAttribute."in_channels" { - # Token set reference name - token_ref "cavs_audio_format.word" - constraints { - min 1 - max 8 - } - } - - ## input channel map - DefineAttribute."in_ch_map" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## input channel config - DefineAttribute."in_ch_cfg" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## input interleaving style - DefineAttribute."in_interleaving_style" { - type "string" - # Token set reference name - token_ref "cavs_audio_format.word" - constraints { - !valid_values [ - "interleaved" - "non-interleaved" - ] - !tuple_values [ - 0 - 1 - ] - } - } - - ## input format config - DefineAttribute."in_fmt_cfg" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## output sampling rate - DefineAttribute."out_rate" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## Input sample_type. - ## Valid values for sample type are defined in common_definitions.conf. - DefineAttribute."in_sample_type" { - type string - # Token set reference name - token_ref "cavs_audio_format.word" - constraints { - !valid_values [ - $SAMPLE_TYPE_MSB_INTEGER - $SAMPLE_TYPE_LSB_INTEGER - $SAMPLE_TYPE_SIGNED_INTEGER - $SAMPLE_TYPE_UNSIGNED_INTEGER - $SAMPLE_TYPE_FLOAT - ] - } - } - - ## output bit depth - DefineAttribute."out_bit_depth" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## output valid bit depth - DefineAttribute."out_valid_bit_depth" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## output channel count - DefineAttribute."out_channels" { - # Token set reference name - token_ref "cavs_audio_format.word" - constraints { - min 1 - max 8 - } - } - - ## output channel map - DefineAttribute."out_ch_map" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## output channel config - DefineAttribute."out_ch_cfg" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - ## output interleaving style - DefineAttribute."out_interleaving_style" { - type "string" - # Token set reference name - token_ref "cavs_audio_format.word" - constraints { - !valid_values [ - "interleaved" - "non-interleaved" - ] - !tuple_values [ - 0 - 1 - ] - } - } - - ## output format config - DefineAttribute."out_fmt_cfg" { - # Token set reference name - token_ref "cavs_audio_format.word" - } - - # - ## input buffer size - # - DefineAttribute."ibs" { - # Token set reference name and type - token_ref "cavs_audio_format.word" - } - - # - ## output buffer size - # - DefineAttribute."obs" { - # Token set reference name and type - token_ref "cavs_audio_format.word" - } - - ## Output sample_type. - ## Valid values for sample type are defined in common_definitions.conf. - DefineAttribute."out_sample_type" { - type string - # Token set reference name - token_ref "cavs_audio_format.word" - constraints { - !valid_values [ - $SAMPLE_TYPE_MSB_INTEGER - $SAMPLE_TYPE_LSB_INTEGER - $SAMPLE_TYPE_SIGNED_INTEGER - $SAMPLE_TYPE_UNSIGNED_INTEGER - $SAMPLE_TYPE_FLOAT - ] - } - } - - - attributes { - !constructor [ - "instance" - ] - - # - # audio_format objects instantiated within the same alsaconf node must have unique - # instance attribute values - # - unique "instance" - } - - in_rate 48000 - in_bit_depth 16 - in_valid_bit_depth 16 - in_channels 2 - in_interleaving_style "interleaved" - in_sample_type $SAMPLE_TYPE_LSB_INTEGER - out_rate 48000 - out_bit_depth 16 - out_valid_bit_depth 16 - out_channels 2 - out_interleaving_style "interleaved" - out_sample_type $SAMPLE_TYPE_LSB_INTEGER - in_ch_cfg $CHANNEL_CONFIG_STEREO - in_ch_map $CHANNEL_MAP_STEREO - out_ch_cfg $CHANNEL_CONFIG_STEREO - out_ch_map $CHANNEL_MAP_STEREO - - # math expression for computing input/output fmt_cfg - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256)) | ($in_sample_type * 65536)]" - out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256)) | ($out_sample_type * 65536)]" - - # math expression for computing input/put buffer sizes - # for 11.025 22.05, 44.1, 88.2 and 176.4khz, we need to round it to ceiling value - ibs "$[($in_channels * ($[($in_rate + 999)] / 1000)) * ($in_bit_depth / 8)]" - obs "$[($out_channels * ($[($out_rate + 999)] / 1000)) * ($out_bit_depth / 8)]" -} diff --git a/tools/topology/topology2/include/pipelines/cavs/dai-kpb-be.conf b/tools/topology/topology2/include/pipelines/cavs/dai-kpb-be.conf index 0c3a5823aced..91ca50a62bed 100644 --- a/tools/topology/topology2/include/pipelines/cavs/dai-kpb-be.conf +++ b/tools/topology/topology2/include/pipelines/cavs/dai-kpb-be.conf @@ -15,7 +15,8 @@ # Where N is the unique pipeline ID within the same alsaconf node. # - + + 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 cf83b5215b5e..936d45c28c96 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 @@ -17,7 +17,8 @@ - + + diff --git a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-alh-dai-copier-playback.conf b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-alh-dai-copier-playback.conf index b06ad1d0639b..9483629c4ad3 100644 --- a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-alh-dai-copier-playback.conf +++ b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-alh-dai-copier-playback.conf @@ -13,7 +13,6 @@ # Where N is the unique pipeline ID within the same alsaconf node. # - diff --git a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-eqiir-dts-dai-copier-playback.conf b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-eqiir-dts-dai-copier-playback.conf index 078b65799eda..87b9002f8eb2 100644 --- a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-eqiir-dts-dai-copier-playback.conf +++ b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-eqiir-dts-dai-copier-playback.conf @@ -14,7 +14,8 @@ # Where N is the unique pipeline ID within the same alsaconf node. # - + + @@ -54,10 +55,14 @@ Class.Pipeline."mixout-gain-eqiir-dts-dai-copier-playback" { num_input_pins 1 # copier only supports one format based on mixin/mixout requirements: 32-bit 48KHz 2ch - Object.Base.audio_format [ + Object.Base.input_audio_format [ { in_bit_depth 32 in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { out_bit_depth 32 out_valid_bit_depth 32 } @@ -68,10 +73,14 @@ Class.Pipeline."mixout-gain-eqiir-dts-dai-copier-playback" { num_output_audio_formats 1 # 32-bit 48KHz 2ch - Object.Base.audio_format [ + Object.Base.input_audio_format [ { in_bit_depth 32 in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { out_bit_depth 32 out_valid_bit_depth 32 } @@ -81,12 +90,18 @@ Class.Pipeline."mixout-gain-eqiir-dts-dai-copier-playback" { 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 32 - out_valid_bit_depth 32 - } + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + ] Object.Control.bytes."1" { @@ -96,12 +111,18 @@ Class.Pipeline."mixout-gain-eqiir-dts-dai-copier-playback" { 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 32 - out_valid_bit_depth 32 - } + Object.Base.input_audio_format [ + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] + Object.Base.output_audio_format [ + { + out_bit_depth 32 + out_valid_bit_depth 32 + } + ] } pipeline."1" { diff --git a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-host-copier-capture.conf b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-host-copier-capture.conf index 3a34a311029f..ab18e5b48fda 100644 --- a/tools/topology/topology2/include/pipelines/cavs/mixout-gain-host-copier-capture.conf +++ b/tools/topology/topology2/include/pipelines/cavs/mixout-gain-host-copier-capture.conf @@ -14,7 +14,8 @@ # Where N is the unique pipeline ID within the same alsaconf node. # - + + diff --git a/tools/topology/topology2/include/pipelines/cavs/src-gain-mixin-playback.conf b/tools/topology/topology2/include/pipelines/cavs/src-gain-mixin-playback.conf index 5d1fc1a45789..45f9e3d130c1 100644 --- a/tools/topology/topology2/include/pipelines/cavs/src-gain-mixin-playback.conf +++ b/tools/topology/topology2/include/pipelines/cavs/src-gain-mixin-playback.conf @@ -15,7 +15,6 @@ # - diff --git a/tools/topology/topology2/include/pipelines/gain-capture.conf b/tools/topology/topology2/include/pipelines/gain-capture.conf index 66e2d7df6c6b..1255e02026fb 100644 --- a/tools/topology/topology2/include/pipelines/gain-capture.conf +++ b/tools/topology/topology2/include/pipelines/gain-capture.conf @@ -15,7 +15,8 @@ # Where N is the unique pipeline ID within the same alsaconf node. # - + + From 61595d037c5ee98c37a5974627a8e43c111b03a2 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Wed, 24 Jul 2024 17:38:42 +0200 Subject: [PATCH 2/3] topology2: revisit use of SAMPLE_TYPE_MSB_INTEGER and SDW_LINK_VALID_BITS These two variables should only be used on the link side. It makes no sense to use them on the host-facing side of the DAI copier. FIXME: do we need to use 3 formats for the ALH copiers, in most cases there's really a need for a 32-bit format only? Signed-off-by: Pierre-Louis Bossart --- .../platform/intel/sdw-amp-generic.conf | 31 ++++++++++--------- .../platform/intel/sdw-dmic-generic.conf | 2 -- .../platform/intel/sdw-jack-generic.conf | 25 +++++++++------ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/tools/topology/topology2/platform/intel/sdw-amp-generic.conf b/tools/topology/topology2/platform/intel/sdw-amp-generic.conf index 88b015c97ec6..d2daf7f7127a 100644 --- a/tools/topology/topology2/platform/intel/sdw-amp-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-amp-generic.conf @@ -54,6 +54,21 @@ IncludeByKey.PASSTHROUGH { Object.Widget.alh-copier.1 { stream_name $SDW_SPK_STREAM node_type $ALH_LINK_OUTPUT_CLASS + num_input_audio_formats 3 + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + } + { + in_bit_depth 32 + in_valid_bit_depth 24 + } + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] num_output_audio_formats 1 Object.Base.output_audio_format [ { @@ -121,28 +136,22 @@ IncludeByKey.PASSTHROUGH { stream_name $SDW_SPK_STREAM node_type $ALH_LINK_OUTPUT_CLASS num_input_pins 1 - num_input_audio_formats 3 direction playback type dai_in index 21 + num_input_audio_formats 3 Object.Base.input_audio_format [ { in_bit_depth 16 in_valid_bit_depth 16 - in_sample_type $SAMPLE_TYPE_MSB_INTEGER - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]" } { in_bit_depth 32 in_valid_bit_depth 24 - in_sample_type $SAMPLE_TYPE_MSB_INTEGER - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]" } { in_bit_depth 32 in_valid_bit_depth 32 - in_sample_type $SAMPLE_TYPE_MSB_INTEGER - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]" } ] num_output_audio_formats 1 @@ -191,8 +200,6 @@ IncludeByKey.NUM_SDW_AMP_LINKS { { in_bit_depth 32 in_valid_bit_depth 32 - in_sample_type $SAMPLE_TYPE_MSB_INTEGER - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]" } ] Object.Base.output_audio_format [ @@ -232,8 +239,6 @@ IncludeByKey.NUM_SDW_AMP_LINKS { { out_bit_depth 32 out_valid_bit_depth 32 - out_sample_type $SAMPLE_TYPE_MSB_INTEGER - out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]" } ] } @@ -401,8 +406,6 @@ IncludeByKey.SDW_AMP_FEEDBACK { out_valid_bit_depth 32 out_ch_cfg $CHANNEL_CONFIG_3_POINT_1 out_ch_map $CHANNEL_MAP_3_POINT_1 - out_sample_type $SAMPLE_TYPE_MSB_INTEGER - out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]" } ] } @@ -420,8 +423,6 @@ IncludeByKey.SDW_AMP_FEEDBACK { { out_bit_depth 32 out_valid_bit_depth 32 - out_sample_type $SAMPLE_TYPE_MSB_INTEGER - out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]" } ] } diff --git a/tools/topology/topology2/platform/intel/sdw-dmic-generic.conf b/tools/topology/topology2/platform/intel/sdw-dmic-generic.conf index 3b962ecad62b..3b20365e0d7b 100644 --- a/tools/topology/topology2/platform/intel/sdw-dmic-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-dmic-generic.conf @@ -61,8 +61,6 @@ Object.Widget { { out_bit_depth 32 out_valid_bit_depth 32 - out_sample_type $SAMPLE_TYPE_MSB_INTEGER - out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]" } ] } diff --git a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf index 4a79db184a88..dc4fe7206dd0 100644 --- a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf @@ -75,6 +75,21 @@ IncludeByKey.PASSTHROUGH { Object.Widget.alh-copier.1 { stream_name $SDW_JACK_OUT_STREAM node_type $ALH_LINK_OUTPUT_CLASS + num_input_audio_formats 3 + Object.Base.input_audio_format [ + { + in_bit_depth 16 + in_valid_bit_depth 16 + } + { + in_bit_depth 32 + in_valid_bit_depth 24 + } + { + in_bit_depth 32 + in_valid_bit_depth 32 + } + ] num_output_audio_formats 1 Object.Base.output_audio_format [ { @@ -140,29 +155,23 @@ IncludeByKey.PASSTHROUGH { { stream_name $SDW_JACK_OUT_STREAM node_type $ALH_LINK_OUTPUT_CLASS - num_input_audio_formats 3 index 1 type dai_in direction playback num_input_pins 1 + num_input_audio_formats 3 Object.Base.input_audio_format [ { in_bit_depth 16 in_valid_bit_depth 16 - in_sample_type $SAMPLE_TYPE_MSB_INTEGER - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]" } { in_bit_depth 32 in_valid_bit_depth 24 - in_sample_type $SAMPLE_TYPE_MSB_INTEGER - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]" } { in_bit_depth 32 in_valid_bit_depth 32 - in_sample_type $SAMPLE_TYPE_MSB_INTEGER - in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]" } ] num_output_audio_formats 1 @@ -303,8 +312,6 @@ Object.Widget { { out_bit_depth 32 out_valid_bit_depth 32 - out_sample_type $SAMPLE_TYPE_MSB_INTEGER - out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]" } ] } From f7b3101a4d7a0148f107229749a82550b82f78d1 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Wed, 24 Jul 2024 17:44:31 +0200 Subject: [PATCH 3/3] topology2: sdw-jack-generic: simplify capture formats The ALH copier only supports 32bits stereo on capture. All the additional formatls on the host copiers make no sense, and we also don't need to generate 4ch on the host side. It looks like the addition of the 1ch support was also problematic since the link always operates with 2ch. Signed-off-by: Pierre-Louis Bossart --- .../platform/intel/sdw-jack-generic.conf | 75 +++---------------- 1 file changed, 9 insertions(+), 66 deletions(-) diff --git a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf index dc4fe7206dd0..81777135f361 100644 --- a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf @@ -204,83 +204,26 @@ Object.Pipeline.host-gateway-capture [ Object.Widget.host-copier.1 { stream_name "Passthrough Capture 0" pcm_id 1 - num_input_audio_formats 3 - num_output_audio_formats 9 + num_input_audio_formats 1 Object.Base.input_audio_format [ - # 32-bit 48KHz 2ch - { - in_bit_depth 32 - in_valid_bit_depth 32 - } - # 32-bit 48KHz 4ch { 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 - } - # 32-bit 48KHz 1ch - { - in_channels 1 - in_bit_depth 32 - in_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_MONO - in_ch_map $CHANNEL_MAP_MONO } ] - - CombineArrays.Object.Base.output_audio_format [ - # array of 2ch formats with range of out valid bit depths - { - out_bit_depth [ 32 ] - out_valid_bit_depth [ - 24 - 32 - ] - } - # array of 4ch formats with range of out valid bit depths - { - out_bit_depth [ 32 ] - out_valid_bit_depth [ - 24 - 32 - ] - out_channels [ 4 ] - out_ch_cfg [ $CHANNEL_CONFIG_3_POINT_1 ] - out_ch_map [ $CHANNEL_MAP_3_POINT_1 ] - } - # array of 1ch formats with range of out valid bit depths - { - out_bit_depth [ 32 ] - out_valid_bit_depth [ - 24 - 32 - ] - out_channels [ 1 ] - out_ch_cfg [ $CHANNEL_CONFIG_MONO ] - out_ch_map [ $CHANNEL_MAP_MONO ] - } - # 16-bit 2ch + num_output_audio_formats 3 + Object.Base.output_audio_format [ { - out_bit_depth [ 16 ] - out_valid_bit_depth [ 16 ] + out_bit_depth 16 + out_valid_bit_depth 16 } - # 16-bit 4ch { - 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 ] + out_bit_depth 32 + out_valid_bit_depth 24 } - # 16-bit 1ch { - out_channels [ 1 ] - out_bit_depth [ 16 ] - out_valid_bit_depth [ 16 ] - out_ch_cfg [ $CHANNEL_CONFIG_MONO ] - out_ch_map [ $CHANNEL_MAP_MONO ] + out_bit_depth 32 + out_valid_bit_depth 32 } ] }