From 8c872074e590f6f54e7983073f5bd3f5e6e4223e Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 5 Oct 2022 16:41:17 -0700 Subject: [PATCH] topology2: cavs: Add chained DMA support for HDMI pipelines Add a new pipeline chain-dma-playback.conf for chained DMA playback and use it for HDMI depending on the HDMI_CONFIG. Signed-off-by: Ranjani Sridharan --- tools/topology/topology2/cavs/CMakeLists.txt | 21 +++-- .../topology2/cavs/cavs-passthrough-hdmi.conf | 9 +- .../platform/intel/hdmi-chain-dma-4th.conf | 33 +++++++ .../cavs/platform/intel/hdmi-chain-dma.conf | 94 +++++++++++++++++++ .../topology2/include/common/tokens.conf | 1 + .../include/components/pipeline.conf | 12 +++ .../pipelines/cavs/chain-dma-playback.conf | 73 ++++++++++++++ .../include/pipelines/pipeline-common.conf | 11 +++ 8 files changed, 244 insertions(+), 10 deletions(-) create mode 100644 tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma-4th.conf create mode 100644 tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma.conf create mode 100644 tools/topology/topology2/include/pipelines/cavs/chain-dma-playback.conf diff --git a/tools/topology/topology2/cavs/CMakeLists.txt b/tools/topology/topology2/cavs/CMakeLists.txt index 61ae8379bc92..5fadc0a1f327 100644 --- a/tools/topology/topology2/cavs/CMakeLists.txt +++ b/tools/topology/topology2/cavs/CMakeLists.txt @@ -3,26 +3,31 @@ # Array of "input-file-name;output-file-name;comma separated pre-processor variables" set(TPLGS # CAVS HDMI only topology with passthrough pipelines -"cavs-passthrough-hdmi\;cavs-passthrough-hdmi" +"cavs-passthrough-hdmi\;cavs-passthrough-hdmi\;HDMI_CONFIG=chaindma" # CAVS HDA topology with mixer-based pipelines for HDA and passthrough pipelines for HDMI -"cavs-passthrough-hdmi\;cavs-mixin-mixout-hda\;HDA_CONFIG=mix" +"cavs-passthrough-hdmi\;cavs-mixin-mixout-hda\;HDA_CONFIG=mix,HDMI_CONFIG=chaindma" # If the alsatplg plugins for NHLT are not available, the NHLT blobs will not be added to the # topologies below. # CNL: CAVS HDA topology with mixer-based pipelines for HDA and passthrough pipelines for HDMI "cavs-passthrough-hdmi\;cavs-mixin-mixout-hda-2ch-cnl\;\ -HDA_CONFIG=mix,NUM_DMICS=2,PLATFORM=cnl,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin" +HDA_CONFIG=mix,NUM_DMICS=2,PLATFORM=cnl,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin,\ +HDMI_CONFIG=chaindma" "cavs-passthrough-hdmi\;cavs-mixin-mixout-hda-4ch-cnl\;\ HDA_CONFIG=mix,NUM_DMICS=4,PLATFORM=cnl,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\ -PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin" +PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin,HDMI_CONFIG=chaindma" # TGL: CAVS HDA topology with mixer-based pipelines for HDA and passthrough pipelines for HDMI +"cavs-passthrough-hdmi\;cavs-mixin-mixout-hda-tgl\;\ +HDA_CONFIG=mix,HDMI_CONFIG=chaindma,PLATFORM=tgl" "cavs-passthrough-hdmi\;cavs-mixin-mixout-hda-2ch-tgl\;\ -HDA_CONFIG=mix,NUM_DMICS=2,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin" +HDA_CONFIG=mix,NUM_DMICS=2,PLATFORM=tgl,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin,\ +HDMI_CONFIG=chaindma" "cavs-passthrough-hdmi\;cavs-mixin-mixout-hda-4ch-tgl\;\ -HDA_CONFIG=mix,NUM_DMICS=4,PLATFORM=cnl,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\ -PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin" +HDA_CONFIG=mix,NUM_DMICS=4,PLATFORM=tgl,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\ +PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt.bin,HDMI_CONFIG=chaindma" # MTL: CAVS HDA topology with mixer-based pipelines for HDA and passthrough pipelines for HDMI "cavs-passthrough-hdmi\;cavs-mixin-mixout-hda-4ch-mtl\;PLATFORM=mtl,\ -HDA_CONFIG=mix,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-mtl-hda-mix.bin" +HDA_CONFIG=mix,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,PREPROCESS_PLUGINS=nhlt,\ +NHLT_BIN=nhlt-mtl-hda-mix.bin,HDMI_CONFIG=chaindma" # CAVS SDW topology with passthrough pipelines "cavs-sdw\;cavs-sdw" diff --git a/tools/topology/topology2/cavs/cavs-passthrough-hdmi.conf b/tools/topology/topology2/cavs/cavs-passthrough-hdmi.conf index 9fc0b295b1d3..28e9e81ebb04 100644 --- a/tools/topology/topology2/cavs/cavs-passthrough-hdmi.conf +++ b/tools/topology/topology2/cavs/cavs-passthrough-hdmi.conf @@ -16,6 +16,7 @@ + @@ -34,6 +35,7 @@ Define { HDA_CONFIG "none" PLATFORM "none" NUM_DMICS 0 + HDMI_CONFIG "generic" } # override defaults with platform-specific config @@ -59,8 +61,11 @@ Define { HDMI3_ID 3 } -# always include HDMI config - +# include HDMI config +IncludeByKey.HDMI_CONFIG { + "generic" "platform/intel/hdmi-generic.conf" + "chaindma" "platform/intel/hdmi-chain-dma.conf" +} Object.Widget.virtual { codec0_in { diff --git a/tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma-4th.conf b/tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma-4th.conf new file mode 100644 index 000000000000..225c551f0d68 --- /dev/null +++ b/tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma-4th.conf @@ -0,0 +1,33 @@ +Object.Dai { + HDA.7 { + name iDisp4 + id $HDMI4_ID + default_hw_conf_id 3 + Object.Base.hw_config.HDA6 {} + direction playback + } +} +Object.Pipeline { + chain-dma-playback.23 { + Object.Widget.copier.1 { + stream_name $HDMI1_PCM_CAPS + } + Object.Widget.copier.2 { + stream_name $HDMI4_PCM_CAPS + } + + index $HDMI4_HOST_PIPELINE_ID + } +} +Object.PCM { + pcm.8 { + name HDMI4 + id 8 + Object.Base.fe_dai.HDMI4 {} + Object.PCM.pcm_caps.playback { + name $HDMI4_PCM_CAPS + formats 'S32_LE,S24_LE,S16_LE' + } + direction playback + } +} diff --git a/tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma.conf b/tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma.conf new file mode 100644 index 000000000000..f30f1da87bda --- /dev/null +++ b/tools/topology/topology2/cavs/platform/intel/hdmi-chain-dma.conf @@ -0,0 +1,94 @@ +Object.Dai { + HDA.4 { + name iDisp1 + id $HDMI1_ID + default_hw_conf_id 1 + Object.Base.hw_config.HDA4 {} + direction playback + } + HDA.5 { + name iDisp2 + id $HDMI2_ID + default_hw_conf_id 2 + Object.Base.hw_config.HDA5 {} + direction playback + } + HDA.6 { + name iDisp3 + id $HDMI3_ID + default_hw_conf_id 3 + Object.Base.hw_config.HDA6 {} + direction playback + } +} +Object.Pipeline { + chain-dma-playback.20 { + Object.Widget.copier.1 { + stream_name $HDMI1_PCM_CAPS + } + Object.Widget.copier.2 { + stream_name "iDisp1" + } + + index $HDMI1_HOST_PIPELINE_ID + } + chain-dma-playback.21 { + Object.Widget.copier.1 { + stream_name $HDMI2_PCM_CAPS + } + + Object.Widget.copier.2 { + stream_name "iDisp2" + } + + index $HDMI2_HOST_PIPELINE_ID + } + chain-dma-playback.22 { + Object.Widget.copier.1 { + stream_name $HDMI3_PCM_CAPS + } + Object.Widget.copier.2 { + stream_name "iDisp3" + } + + index $HDMI3_HOST_PIPELINE_ID + } +} +Object.PCM { + pcm.5 { + name HDMI1 + id 5 + Object.Base.fe_dai.HDMI1 {} + Object.PCM.pcm_caps.playback { + name $HDMI1_PCM_CAPS + formats 'S32_LE,S24_LE,S16_LE' + } + direction playback + } + pcm.6 { + name HDMI2 + id 6 + Object.Base.fe_dai.HDMI2 {} + Object.PCM.pcm_caps.playback { + name $HDMI2_PCM_CAPS + formats 'S32_LE,S24_LE,S16_LE' + } + direction playback + } + pcm.7 { + name HDMI3 + id 7 + Object.Base.fe_dai.HDMI3 {} + Object.PCM.pcm_caps.playback { + name $HDMI3_PCM_CAPS + formats 'S32_LE,S24_LE,S16_LE' + } + direction playback + } +} + +# include 4th HDMI config if needed. +IncludeByKey.NUM_HDMIS { +"4" "platform/intel/hdmi-chain-dma-4th.conf" +} + diff --git a/tools/topology/topology2/include/common/tokens.conf b/tools/topology/topology2/include/common/tokens.conf index 33975a3bca20..6b122f8fe5c1 100644 --- a/tools/topology/topology2/include/common/tokens.conf +++ b/tools/topology/topology2/include/common/tokens.conf @@ -69,6 +69,7 @@ Object.Base.VendorToken { dynamic_pipeline 206 # ABI 4.0 onwards lp_mode 207 + use_chain_dma 209 } "sof_tkn_intel_ssp" { diff --git a/tools/topology/topology2/include/components/pipeline.conf b/tools/topology/topology2/include/components/pipeline.conf index e9789cd9874e..c3878684cd0a 100644 --- a/tools/topology/topology2/include/components/pipeline.conf +++ b/tools/topology/topology2/include/components/pipeline.conf @@ -95,6 +95,18 @@ Class.Widget."pipeline" { } } + # Skip setting up the pipeline in the DSP in the case of chained DMA mode + DefineAttribute."use_chain_dma" { + type "string" + token_ref "sof_tkn_scheduler.bool" + constraints { + !valid_values [ + "true" + "false" + ] + } + } + attributes { # pipeline widget name will be constructed as pipeline.1, pipeline.2 etc !constructor [ diff --git a/tools/topology/topology2/include/pipelines/cavs/chain-dma-playback.conf b/tools/topology/topology2/include/pipelines/cavs/chain-dma-playback.conf new file mode 100644 index 000000000000..d7d0b80ec05d --- /dev/null +++ b/tools/topology/topology2/include/pipelines/cavs/chain-dma-playback.conf @@ -0,0 +1,73 @@ +# +# CAVS chained DMA playback pipeline +# +# A chain DMA pipeline. All attributes defined herein are namespaced +# by alsatplg to "Object.Pipeline.passthrough-playback.N.attribute_name" +# +# Usage: chain-dma-playback pipeline object can be instantiated as: +# +# Object.Pipeline.chain-dma-playback."N" {} +# +# Where N is the unique instance ID within the same alsaconf node. +# + + + + + +Class.Pipeline."chain-dma-playback" { + + DefineAttribute."index" {} + + + + attributes { + !constructor [ + "index" + ] + + !immutable [ + "direction" + ] + + # + # passthrough-playback objects instantiated within the same alsaconf node must have + # unique pipeline_id attribute + # + unique "instance" + } + + Object.Widget { + copier."1" { + copier_type "host" + node_type $HDA_HOST_OUTPUT_CLASS + type "aif_in" + num_audio_formats 1 + # 1 audio format added for driver compatibility during topology parsing. + Object.Base.audio_format.1 {} + } + copier."2" { + type dai_in + dai_type "HDA" + copier_type "HDA" + node_type $HDA_LINK_OUTPUT_CLASS + num_audio_formats 1 + # 1 audio format added for driver compatibility during topology parsing. + Object.Base.audio_format.1 {} + } + + pipeline."1" { + use_chain_dma "true" + } + } + + Object.Base { + route."1" { + source "copier.host..1" + sink "copier.HDA..2" + } + } + + direction "playback" + dynamic_pipeline 1 +} diff --git a/tools/topology/topology2/include/pipelines/pipeline-common.conf b/tools/topology/topology2/include/pipelines/pipeline-common.conf index 4f72090fd66b..3de2b4bb436a 100644 --- a/tools/topology/topology2/include/pipelines/pipeline-common.conf +++ b/tools/topology/topology2/include/pipelines/pipeline-common.conf @@ -79,3 +79,14 @@ DefineAttribute."time_domain" { # flag to indicate if the pipeline is dynamic DefineAttribute."dynamic_pipeline" {} + +# Skip setting up the pipeline in the DSP in the case of chained DMA mode +DefineAttribute."use_chain_dma" { + type "string" + constraints { + !valid_values [ + "true" + "false" + ] + } +}