From aeb83eccc4d2525fbdf25f54988c694ee2b4faa0 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Thu, 12 Oct 2023 09:32:46 -0700 Subject: [PATCH] topology2: sdw-jack-generic: Replace audio_format objects Use input_output_format/output_audio_format explicitly. Additionally, this patch introduces the used of the CombineArrays feature in the topology2 compiler to generate multiple audio format objects from the attribute array combinations. Signed-off-by: Ranjani Sridharan --- .../platform/intel/sdw-jack-generic.conf | 163 +++++++++++------- 1 file changed, 102 insertions(+), 61 deletions(-) diff --git a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf index a05a441e5..1b7a44947 100644 --- a/tools/topology/topology2/platform/intel/sdw-jack-generic.conf +++ b/tools/topology/topology2/platform/intel/sdw-jack-generic.conf @@ -186,56 +186,85 @@ Object.Pipeline.host-gateway-capture [ Object.Widget.host-copier.1 { stream_name "Passthrough Capture 0" pcm_id 1 - num_input_audio_formats 9 + num_input_audio_formats 3 num_output_audio_formats 9 - Object.Base.audio_format.1 { - # 32/32 -> 16/16 bits conversion is done here - in_bit_depth 32 - in_valid_bit_depth 32 - } - # 32-bit 48KHz 1ch - Object.Base.input_audio_format.7 { - in_channels 1 - in_bit_depth 32 - in_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_MONO - in_ch_map $CHANNEL_MAP_MONO - } - Object.Base.output_audio_format.7 { - out_bit_depth 32 - out_valid_bit_depth 32 - out_channels 1 - out_ch_cfg $CHANNEL_CONFIG_MONO - out_ch_map $CHANNEL_MAP_MONO - } - # 24-bit 48KHz 1ch - Object.Base.input_audio_format.8 { - in_channels 1 - in_bit_depth 32 - in_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_MONO - in_ch_map $CHANNEL_MAP_MONO - } - Object.Base.output_audio_format.8 { - out_bit_depth 32 - out_valid_bit_depth 24 - out_channels 1 - out_ch_cfg $CHANNEL_CONFIG_MONO - out_ch_map $CHANNEL_MAP_MONO - } - # 16-bit 48KHz 1ch - Object.Base.input_audio_format.9 { - in_channels 1 - in_bit_depth 32 - in_valid_bit_depth 32 - in_ch_cfg $CHANNEL_CONFIG_MONO - in_ch_map $CHANNEL_MAP_MONO - } - Object.Base.output_audio_format.9 { - out_channels 1 - out_ch_cfg $CHANNEL_CONFIG_MONO - out_ch_map $CHANNEL_MAP_MONO - } + 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 + { + 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 ] + } + # 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 ] + } + ] } } ] @@ -253,12 +282,18 @@ Object.Widget { num_output_audio_formats 1 num_output_pins 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 + } + ] } ] @@ -279,12 +314,18 @@ IncludeByKey.PASSTHROUGH { num_input_audio_formats 1 num_output_audio_formats 1 index 11 - 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" {