From e43f40590523b133f85d813667eca66e6141860a Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Thu, 26 Nov 2026 14:26:06 +0800 Subject: [PATCH 1/2] topology2: sof-hda-generic: allow single-function topologies Allow sof-hda-generic.conf to build a topology that has only one of the HDA, HDMI, DMIC, HDMI-IN and BT functions, the way cavs-sdw.conf is used for the sof-sdca-* topologies. The functions are already switched by HDA_CONFIG, NUM_HDMIS, NUM_DMICS, HDMI_IN_CAPTURE and ADD_BT, but some parts were not tied to them: - The virtual widgets were always included. Move the codec widgets to platform/intel/hda-codec-widgets.conf, included with the HDA_CONFIG selection, and include the iDisp widgets with the HDMI function. - The TDFB class was only available through the HDA confs, so a DMIC only topology could not use enhanced capture. Include it when HDA_CONFIG is none. Document the macros in README.md. Topologies with HDA_CONFIG=none, such as sof-hda-generic-idisp, no longer carry the HDA codec virtual widgets. The others are unchanged. Signed-off-by: Bard Liao --- tools/topology/topology2/README.md | 13 ++ .../platform/intel/hda-codec-widgets.conf | 64 +++++++ tools/topology/topology2/sof-hda-generic.conf | 161 +++++++----------- 3 files changed, 139 insertions(+), 99 deletions(-) create mode 100644 tools/topology/topology2/platform/intel/hda-codec-widgets.conf diff --git a/tools/topology/topology2/README.md b/tools/topology/topology2/README.md index 7148397f1d10..e33819b08940 100644 --- a/tools/topology/topology2/README.md +++ b/tools/topology/topology2/README.md @@ -453,6 +453,19 @@ ACPI when selecting and loading the corresponding topology. Function topologies are intended to be reusable across devices that provide the same function. Please do not add any customized feature in the function topology. +`sof-hda-generic.conf` builds the HDA function topologies the same way `cavs-sdw.conf` builds the +`sof-sdca-*` ones: one conf, and macros that enable a single function and disable the others. + +| Function | Enable | Disable | +|---|---|---| +| HDA codec | `HDA_CONFIG=mix` (or `efx`, `src`, `dax`, `passthrough`) | `HDA_CONFIG=none` (default) | +| HDMI/DP (iDisp) | `NUM_HDMIS=3` (default) | `NUM_HDMIS=0` | +| PCH DMIC | `NUM_DMICS=1..4` | `NUM_DMICS=0` (default) | +| HDMI-IN (SSP) | `HDMI_IN_CAPTURE=true` | `HDMI_IN_CAPTURE=false` (default) | +| Bluetooth (SSP) | `ADD_BT=true` | `ADD_BT=false` (default) | + +The virtual widgets follow their function, so a disabled function leaves none behind. + ### Registering CMake Targets Production topologies are registered in `production/tplg-targets-*.cmake` files. Each diff --git a/tools/topology/topology2/platform/intel/hda-codec-widgets.conf b/tools/topology/topology2/platform/intel/hda-codec-widgets.conf new file mode 100644 index 000000000000..f3beb507dfe6 --- /dev/null +++ b/tools/topology/topology2/platform/intel/hda-codec-widgets.conf @@ -0,0 +1,64 @@ +# Virtual widgets of the HDA codec DAPM widgets, used by the HDA function +# of sof-hda-generic.conf +Object.Widget.virtual [ + { + name 'codec0_in' + type input + index 1 + } + { + name 'codec1_in' + type input + index 2 + } + { + name 'codec0_out' + type output + index 3 + } + { + name 'codec1_out' + type output + index 4 + } + { + name 'codec2_in' + type input + index 5 + } + { + name 'codec2_out' + type output + index 6 + } + { + name 'Analog CPU Playback' + type out_drv + index 3 + } + { + name 'Digital CPU Playback' + type out_drv + index 4 + } + { + name 'Alt Analog CPU Playback' + type out_drv + index 5 + } + { + name 'Analog CPU Capture' + type input + index 6 + } + { + name 'Digital CPU Capture' + type input + index 7 + } + { + name 'Alt Analog CPU Capture' + type input + index 8 + } +] diff --git a/tools/topology/topology2/sof-hda-generic.conf b/tools/topology/topology2/sof-hda-generic.conf index 968d46373b84..b5d89897c95a 100644 --- a/tools/topology/topology2/sof-hda-generic.conf +++ b/tools/topology/topology2/sof-hda-generic.conf @@ -57,6 +57,7 @@ + Define { HDA_CONFIG "none" @@ -84,11 +85,31 @@ IncludeByKey.ADD_BT { # include HDA config if needed. IncludeByKey.HDA_CONFIG { - "mix" "cavs-mixin-mixout-hda.conf" - "efx" "cavs-mixin-mixout-efx-hda.conf" - "src" "cavs-src-mixin-mixout-hda.conf" - "dax" "cavs-mixin-mixout-dax-hda.conf" - "passthrough" "cavs-passthrough-hda.conf" + # Without the HDA function the HDA confs do not bring in the TDFB class + # that the DMIC function uses + "none" { + + } + "mix" { + + + } + "efx" { + + + } + "src" { + + + } + "dax" { + + + } + "passthrough" { + + + } } # include DMIC config if needed. @@ -108,102 +129,44 @@ Define { } IncludeByKey.NUM_HDMIS { -"[3-4]" "platform/intel/hdmi-generic.conf" + "[3-4]" { + + # iDisp widgets, present only when the HDMI function is enabled + Object.Widget.virtual [ + { + name 'iDisp1_out' + type output + index 7 + } + { + name 'iDisp2_out' + type output + index 8 + } + { + name 'iDisp3_out' + type output + index 9 + } + { + name 'iDisp3 Tx' + type out_drv + index 0 + } + { + name 'iDisp2 Tx' + type out_drv + index 1 + } + { + name 'iDisp1 Tx' + type out_drv + index 2 + } + ] + } } IncludeByKey.HDMI_IN_CAPTURE { "true" "platform/intel/hdmi-in-capture.conf" } - -Object.Widget.virtual [ - { - name 'codec0_in' - type input - index 1 - } - { - name 'codec1_in' - type input - index 2 - } - { - name 'codec0_out' - type output - index 3 - } - { - name 'codec1_out' - type output - index 4 - } - { - name 'codec2_in' - type input - index 5 - } - { - name 'codec2_out' - type output - index 6 - } - { - name 'iDisp1_out' - type output - index 7 - } - { - name 'iDisp2_out' - type output - index 8 - } - { - name 'iDisp3_out' - type output - index 9 - } - { - name 'iDisp3 Tx' - type out_drv - index 0 - } - { - name 'iDisp2 Tx' - type out_drv - index 1 - } - { - name 'iDisp1 Tx' - type out_drv - index 2 - } - { - name 'Analog CPU Playback' - type out_drv - index 3 - } - { - name 'Digital CPU Playback' - type out_drv - index 4 - } - { - name 'Alt Analog CPU Playback' - type out_drv - index 5 - } - { - name 'Analog CPU Capture' - type input - index 6 - } - { - name 'Digital CPU Capture' - type input - index 7 - } - { - name 'Alt Analog CPU Capture' - type input - index 8 - } -] From a890225edc718cd6c5fab15aeccc0172917d477f Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Thu, 26 Nov 2026 14:26:06 +0800 Subject: [PATCH 2/2] topology2: sof-hda-generic: add per-function topology targets Add per-function targets that enable a single function of sof-hda-generic.conf and disable the others, named the way sof_hda_get_tplg_files() requests them in Linux, for all the platforms since MTL: - sof-hda-id4 and sof-hdmi-pcm3-id1. The HDA codec and HDMI topologies have no NHLT blob and don't depend on the platform, so their names have no platform and all platforms share them. - sof--dmic-{2ch,4ch}-id6, sof--ssp2-bt-id8 and sof--ssp6-hdmiin-id14 for MTL, LNL, PTL and NVL (sof-ptl-ssp2-bt-id8 is already built from cavs-sdw). NVL uses the PTL configuration, like in cavs-sdw.conf. - ARL and WCL use links to the MTL and PTL ones. HDMI-IN uses SSP1 and SSP2 with BE ids 13 and 14, like sof-hda-generic-ace3-hdmi-in-port12. Linux names the topology after the SSP mask (0x6) and the id of the second HDMI-IN link. Linux falls back to the monolithic topology when any of the function topologies is missing, so a platform needs all of them. They are loaded next to each other, so their PCM and pipeline IDs must not collide. The DMIC targets use pipelines 100/101 like cavs-sdw, BT uses 200-203 and the BT Deepbuffer (PCM 36) 204 like sof-ptl-ssp2-bt-id8, and HDMI-IN uses 210-213. Signed-off-by: Bard Liao --- tools/topology/topology2/README.md | 6 +- .../production/tplg-targets-hda-generic.cmake | 129 ++++++++++++++++++ tools/topology/topology2/sof-hda-generic.conf | 1 + 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/tools/topology/topology2/README.md b/tools/topology/topology2/README.md index e33819b08940..216bf57ba092 100644 --- a/tools/topology/topology2/README.md +++ b/tools/topology/topology2/README.md @@ -464,7 +464,11 @@ Please do not add any customized feature in the function topology. | HDMI-IN (SSP) | `HDMI_IN_CAPTURE=true` | `HDMI_IN_CAPTURE=false` (default) | | Bluetooth (SSP) | `ADD_BT=true` | `ADD_BT=false` (default) | -The virtual widgets follow their function, so a disabled function leaves none behind. +The virtual widgets follow their function, so a disabled function leaves none behind. The +function topologies are the `sof---id` targets (see `sof_hda_get_tplg_files()`; +the HDA codec and HDMI ones have no NHLT blob and no ``) in +`production/tplg-targets-hda-generic.cmake`. They are loaded next to each other, so choose +non-overlapping PCM and pipeline IDs for each of them. ### Registering CMake Targets diff --git a/tools/topology/topology2/production/tplg-targets-hda-generic.cmake b/tools/topology/topology2/production/tplg-targets-hda-generic.cmake index 72872d110a4d..160356aefef6 100644 --- a/tools/topology/topology2/production/tplg-targets-hda-generic.cmake +++ b/tools/topology/topology2/production/tplg-targets-hda-generic.cmake @@ -123,4 +123,133 @@ EFX_DMIC0_TDFB_PARAMS=line4_pass,EFX_DMIC0_DRC_PARAMS=dmic_default" PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-hda-generic-ace3-2ch-dax.bin,\ DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line2_generic_pm10deg,\ EFX_DMIC0_DRC_PARAMS=dmic_default,DOLBY_DAX_CORE_ID=1" + +# Platform independent function topologies, shared by all platforms. The HDA +# codec and HDMI topologies have no NHLT blob, so sof_hda_get_tplg_files() in +# the Linux kernel requests them without a platform in the name. +"sof-hda-generic\;sof-hda-id4\;HDA_CONFIG=mix,NUM_HDMIS=0,\ +HDA_MIC_ENHANCED_CAPTURE=true,EFX_HDA_MIC_TDFB_PARAMS=line2_pass,\ +EFX_HDA_MIC_DRC_PARAMS=passthrough" + +"sof-hda-generic\;sof-hdmi-pcm3-id1\;PLATFORM=ptl" + +# Function topologies, ACE1, named the way sof_hda_get_tplg_files() in the Linux +# kernel requests them. Each one enables a single function of +# sof-hda-generic.conf and disables the others (HDA_CONFIG=none, NUM_DMICS=0, +# NUM_HDMIS=0, HDMI_IN_CAPTURE=false, ADD_BT=false), the way the sof-sdca-* +# topologies do with cavs-sdw.conf. They are loaded next to each other, so +# their PCM and pipeline IDs must not collide. +"sof-hda-generic\;sof-mtl-dmic-2ch-id6\;PLATFORM=mtl,NUM_HDMIS=0,NUM_DMICS=2,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line2_generic_pm10deg,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-mtl-dmic-4ch-id6\;PLATFORM=mtl,NUM_HDMIS=0,NUM_DMICS=4,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line4_pass,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-mtl-ssp6-hdmiin-id14\;PLATFORM=mtl,NUM_HDMIS=0,\ +HDMI_IN_CAPTURE=true,HDMI_IN_1_INDEX=1,HDMI_IN_2_INDEX=2,HDMI_IN_1_NAME=SSP1-HDMI,\ +HDMI_IN_1_ID=13,HDMI_IN_2_ID=14,\ +HDMI_IN_1_CP_HOST_PIPELINE_ID=210,HDMI_IN_1_CP_DAI_PIPELINE_ID=211,\ +HDMI_IN_2_CP_HOST_PIPELINE_ID=212,HDMI_IN_2_CP_DAI_PIPELINE_ID=213,\ +HDMI_IN_1_PCM_ID=7,HDMI_IN_2_PCM_ID=8" + +"sof-hda-generic\;sof-mtl-ssp2-bt-id8\;PLATFORM=mtl,NUM_HDMIS=0,ADD_BT=true,BT_DEEP_BUFFER=true,\ +BT_PCM_ID=20,BT_ID=8,BT_PCM_NAME=Bluetooth,\ +BT_PB_HOST_PIPELINE_ID=200,BT_PB_DAI_PIPELINE_ID=201,BT_CP_HOST_PIPELINE_ID=202,BT_CP_DAI_PIPELINE_ID=203" + +# Function topologies, ACE3, named the way sof_hda_get_tplg_files() in the Linux +# kernel requests them. Each one enables a single function of +# sof-hda-generic.conf and disables the others (HDA_CONFIG=none, NUM_DMICS=0, +# NUM_HDMIS=0, HDMI_IN_CAPTURE=false, ADD_BT=false), the way the sof-sdca-* +# topologies do with cavs-sdw.conf. They are loaded next to each other, so +# their PCM and pipeline IDs must not collide. +"sof-hda-generic\;sof-ptl-dmic-2ch-id6\;PLATFORM=ptl,NUM_HDMIS=0,NUM_DMICS=2,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line2_generic_pm10deg,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-ptl-dmic-4ch-id6\;PLATFORM=ptl,NUM_HDMIS=0,NUM_DMICS=4,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line4_pass,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-ptl-ssp6-hdmiin-id14\;PLATFORM=ptl,NUM_HDMIS=0,\ +HDMI_IN_CAPTURE=true,HDMI_IN_1_INDEX=1,HDMI_IN_2_INDEX=2,HDMI_IN_1_NAME=SSP1-HDMI,\ +HDMI_IN_1_ID=13,HDMI_IN_2_ID=14,\ +HDMI_IN_1_CP_HOST_PIPELINE_ID=210,HDMI_IN_1_CP_DAI_PIPELINE_ID=211,\ +HDMI_IN_2_CP_HOST_PIPELINE_ID=212,HDMI_IN_2_CP_DAI_PIPELINE_ID=213,\ +HDMI_IN_1_PCM_ID=7,HDMI_IN_2_PCM_ID=8" + +# Function topologies, ACE2 (LNL), named the way sof_hda_get_tplg_files() in the Linux +# kernel requests them. See the ACE1 ones above. +"sof-hda-generic\;sof-lnl-dmic-2ch-id6\;PLATFORM=lnl,NUM_HDMIS=0,NUM_DMICS=2,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line2_generic_pm10deg,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-lnl-dmic-4ch-id6\;PLATFORM=lnl,NUM_HDMIS=0,NUM_DMICS=4,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line4_pass,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-lnl-ssp2-bt-id8\;PLATFORM=lnl,NUM_HDMIS=0,ADD_BT=true,BT_DEEP_BUFFER=true,\ +BT_PCM_ID=20,BT_ID=8,BT_PCM_NAME=Bluetooth,\ +BT_PB_HOST_PIPELINE_ID=200,BT_PB_DAI_PIPELINE_ID=201,BT_CP_HOST_PIPELINE_ID=202,BT_CP_DAI_PIPELINE_ID=203" + +"sof-hda-generic\;sof-lnl-ssp6-hdmiin-id14\;PLATFORM=lnl,NUM_HDMIS=0,\ +HDMI_IN_CAPTURE=true,HDMI_IN_1_INDEX=1,HDMI_IN_2_INDEX=2,HDMI_IN_1_NAME=SSP1-HDMI,\ +HDMI_IN_1_ID=13,HDMI_IN_2_ID=14,\ +HDMI_IN_1_CP_HOST_PIPELINE_ID=210,HDMI_IN_1_CP_DAI_PIPELINE_ID=211,\ +HDMI_IN_2_CP_HOST_PIPELINE_ID=212,HDMI_IN_2_CP_DAI_PIPELINE_ID=213,\ +HDMI_IN_1_PCM_ID=7,HDMI_IN_2_PCM_ID=8" + +# Function topologies, ACE4 (NVL), named the way sof_hda_get_tplg_files() in the Linux +# kernel requests them. See the ACE1 ones above. +"sof-hda-generic\;sof-nvl-dmic-2ch-id6\;PLATFORM=nvl,NUM_HDMIS=0,NUM_DMICS=2,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line2_generic_pm10deg,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-nvl-dmic-4ch-id6\;PLATFORM=nvl,NUM_HDMIS=0,NUM_DMICS=4,\ +DMIC0_HOST_PIPELINE_ID=100,DMIC0_DAI_PIPELINE_ID=101,\ +DMIC0_DAI_PIPELINE_SRC=module-copier.101.2,\ +PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\ +DMIC0_ENHANCED_CAPTURE=true,EFX_DMIC0_TDFB_PARAMS=line4_pass,\ +EFX_DMIC0_DRC_PARAMS=dmic_default" + +"sof-hda-generic\;sof-nvl-ssp2-bt-id8\;PLATFORM=nvl,NUM_HDMIS=0,ADD_BT=true,BT_DEEP_BUFFER=true,\ +BT_PCM_ID=20,BT_ID=8,BT_PCM_NAME=Bluetooth,\ +BT_PB_HOST_PIPELINE_ID=200,BT_PB_DAI_PIPELINE_ID=201,BT_CP_HOST_PIPELINE_ID=202,BT_CP_DAI_PIPELINE_ID=203" + +"sof-hda-generic\;sof-nvl-ssp6-hdmiin-id14\;PLATFORM=nvl,NUM_HDMIS=0,\ +HDMI_IN_CAPTURE=true,HDMI_IN_1_INDEX=1,HDMI_IN_2_INDEX=2,HDMI_IN_1_NAME=SSP1-HDMI,\ +HDMI_IN_1_ID=13,HDMI_IN_2_ID=14,\ +HDMI_IN_1_CP_HOST_PIPELINE_ID=210,HDMI_IN_1_CP_DAI_PIPELINE_ID=211,\ +HDMI_IN_2_CP_HOST_PIPELINE_ID=212,HDMI_IN_2_CP_DAI_PIPELINE_ID=213,\ +HDMI_IN_1_PCM_ID=7,HDMI_IN_2_PCM_ID=8" +) + +list(APPEND SYMLINKS +# ARL and WCL use the MTL and PTL HDA function topologies +"sof-arl-dmic-2ch-id6\;sof-mtl-dmic-2ch-id6" +"sof-arl-dmic-4ch-id6\;sof-mtl-dmic-4ch-id6" +"sof-arl-ssp2-bt-id8\;sof-mtl-ssp2-bt-id8" +"sof-arl-ssp6-hdmiin-id14\;sof-mtl-ssp6-hdmiin-id14" +"sof-wcl-dmic-2ch-id6\;sof-ptl-dmic-2ch-id6" +"sof-wcl-dmic-4ch-id6\;sof-ptl-dmic-4ch-id6" +"sof-wcl-ssp2-bt-id8\;sof-ptl-ssp2-bt-id8" +"sof-wcl-ssp6-hdmiin-id14\;sof-ptl-ssp6-hdmiin-id14" ) diff --git a/tools/topology/topology2/sof-hda-generic.conf b/tools/topology/topology2/sof-hda-generic.conf index b5d89897c95a..45276e496922 100644 --- a/tools/topology/topology2/sof-hda-generic.conf +++ b/tools/topology/topology2/sof-hda-generic.conf @@ -77,6 +77,7 @@ IncludeByKey.PLATFORM { "mtl" "platform/intel/mtl.conf" "lnl" "platform/intel/lnl.conf" "ptl" "platform/intel/ptl.conf" + "nvl" "platform/intel/ptl.conf" # Note: Assume same configuration as PTL } IncludeByKey.ADD_BT {