From dfcad0ba5f4cd6e7a56414de62237b40de480748 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 17 Jul 2025 21:13:01 +0100 Subject: [PATCH 1/8] scripts: fw build: add option to force Zephyr SDK build Add a -z option that forces the script to use the Zephyr SDK even when proprietary compilers are installed. Signed-off-by: Liam Girdwood --- scripts/xtensa-build-zephyr.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index ae9e4267d64e..40931ba6623a 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -398,6 +398,8 @@ def parse_args(): help="Prints version of this script.") parser.add_argument("-m", "--menuconfig", required=False, action="store_true", help="Build menuconfig for target") + parser.add_argument("-z", "--zephyrsdk", required=False, action="store_true", + help="Force Build using Zephyr SDK for target") args = parser.parse_args() @@ -836,7 +838,12 @@ def build_platforms(): _dict = dataclasses.asdict(platform_configs[platform]) platform_dict = { k:v for (k,v) in _dict.items() if _dict[k] is not None } - xtensa_tools_root_dir = os.getenv("XTENSA_TOOLS_ROOT") + if args.zephyrsdk: + print("Using Zephyr SDK for building") + xtensa_tools_root_dir = None + else: + print("Using Xtensa tools for building") + xtensa_tools_root_dir = os.getenv("XTENSA_TOOLS_ROOT") # when XTENSA_TOOLS_ROOT environmental variable is set, # use user installed Xtensa tools not Zephyr SDK if "XTENSA_TOOLS_VERSION" in platform_dict and xtensa_tools_root_dir: From 05de1281862769a19d0e031462639e558a782ca2 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 17 Jul 2025 21:14:52 +0100 Subject: [PATCH 2/8] uuid: use alphabetical order for registry file. Use alphabetical module entry for the registry and spell it out so its clear. Signed-off-by: Liam Girdwood --- uuid-registry.txt | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/uuid-registry.txt b/uuid-registry.txt index ba0d989c8d5b..0fa09c051048 100644 --- a/uuid-registry.txt +++ b/uuid-registry.txt @@ -1,9 +1,10 @@ # -# Global UUID/name registry for SOF components. All IDs used in -# shipped binary artifacts must appear in this list. All names must -# be unique. All names must be legal C identifiers of at most 31 -# characters. No change to a previously distributed mapping is -# allowed, ever. +# Global UUID/name registry for SOF components in alphabetical order. +# +# All IDs used in shipped binary artifacts must appear in this list. +# All names must be unique. +# All names must be legal C identifiers of at most 31 characters. +# No change to a previously distributed mapping is allowed, ever. # # Simple format: "#" indicates a comment to end of line. Remaining # lines must be entirely empty/whitespace, or two whitespace-separated @@ -18,9 +19,9 @@ # are just using random values and won't care about the byte swap. # + ab01db67-84b0-4d2d-93d30e619680576e acp_bt_dma f8a7091c-7d2d-4410-9bb555278378d59f acp_clk -70f2d3f2-cbb6-4984-a2d80dd514b80bc2 acpdma 0ae40946-dfd2-4140-91520dd5a3eaae81 acp_dmic_dai 109c7aba-a7ba-43c3-b94259e20a6611be acp_dmic_dma dc2199ea-cdae-4d23-a413ffe442f785f2 acp_dmic_dma_common @@ -28,6 +29,7 @@ b414df09-9e31-4c59-86577afc8deba70c acp_hs 3ac07334-41ce-4447-a2c5dff0d1fa1392 acp_sp 2ef92c66-78a4-41f7-b52f5539707a9382 acp_sp_common 5871f3ca-dd92-4edb-8a94d651dd208b1e acp_sw_audio +70f2d3f2-cbb6-4984-a2d80dd514b80bc2 acpdma 30290c76-6a05-4784-8464c21f09cee87e afe_dai 4e8f16d1-e935-41f4-b99e42c57e745784 afedrv c63c4e75-8f61-4420-93191395932efa9e agent_work @@ -38,6 +40,7 @@ ea9c4bca-5b7d-48c6-9586553e27235beb ams c8ec72f6-8526-4faf-9d39a23d0b541de2 asrc 66b4402d-b468-42f2-81a7b37121863dd4 asrc4 0e398c32-5ade-ba4b-93b1c50432280ee4 basefw +2B79E4F3-4675-F649-89DF3BC194A91AEB brngup 20865bfe-b833-4ff9-b22a0482c3477497 btdai 42544c92-8e92-4e41-b67934519f1c1d28 buffer d8218443-5ff3-4a4c-b3886cfe07b956aa cadence_codec @@ -49,6 +52,7 @@ ec290e95-4a20-47eb-bbffd9c888431831 chmap e87bf747-e574-4362-bf2cc015d2859dd9 clkdrv_mt8196 de358908-c146-4411-98b430ebd002957f clkdrv_mt8365 8890ea76-0df9-44ae-87e6994f4c15e9fa clock +D406D134-C3C1-402C-8AEC6821C0C2B0E6 cold 7c42ce8b-0108-43d0-913756d660478c5f component 9ba00c83-ca12-4a83-943c1fa2e82f9dda copier 948c9ad1-806a-4131-ad6cb2bda9e35a9f crossover @@ -75,8 +79,8 @@ f6d15ad3-b122-458c-ae9b0ab0b5867aa0 dummy_dma bfc7488c-75aa-4ce8-9dbed8da08a698c2 file 93446e12-1864-4e04-afe03b1d778ffb79 fir 61bca9a8-18d0-4a18-8e7b2639219804b7 gain -c3c74249-058e-414f-82404da5f3fc2389 google_hotword bf0e1bbc-dc6a-45fe-bc902554cb137ab4 google_ctc_audio_processing +c3c74249-058e-414f-82404da5f3fc2389 google_hotword b780a0a6-269f-466f-b47723dfa05af758 google_rtc_audio_processing 8b9d100c-6d78-418f-90a3e0e805d0852b host 8f00c3bb-e835-4767-9a34b8ec1041e56b hsdai @@ -85,15 +89,15 @@ a5dacb0e-88dc-415c-a1b53e8df77f1976 idc_cmd_task b90f5a4e-5537-4375-a1df95485472ff9e idc_task 696ae2bc-2877-11eb-adc10242ac120002 igo_nr b0cdcd9e-ef8b-404f-84800f287fc9d44d iir -fa00558c-d653-4851-a03ab21f125a9524 interrupt 2f520e85-49ba-4284-90d83def24af313b intc_mt8196 +fa00558c-d653-4851-a03ab21f125a9524 interrupt be60f97d-78df-4796-a0ee435cb56b720a ipc -a814a1ca-0b83-466c-95872f35ff8d12e8 ipcgw 389c9186-5a7d-4ad1-a02ca02ecdadfb33 ipc_task 49be8ff3-71a3-4456-bb7e4723f2e5730c ipc_task_amd a3fe3bf2-39a4-4fc3-b3418a96e0a26759 ipc_task_mt818x caef4bd7-7a2e-4039-9b061f5ff9ec3899 ipc_task_mt8196 6c8f0d53-ff77-4ca1-b825c0c4e1b0d322 ipc_task_posix +a814a1ca-0b83-466c-95872f35ff8d12e8 ipcgw 1862d39a-3a84-4d64-8c91dce1dfc122db irq 6533d0eb-b785-4709-84f5347c81720189 irq_acp d2e3f730-df39-42ee-81a839bfb4d024c2 irq_mt818x @@ -120,8 +124,10 @@ ee2585f2-e7d8-43dc-90ab4224e00c3e84 modules 0d9f2256-8e4f-47b3-8448239a334f1191 multiband_drc c607ff4d-9cb6-49dc-b6787da3c63ea557 mux 64ce6e35-857a-4878-ace8e2a2f42e3069 mux4 +f36BF24B-9AAF-83f4-8677E072E8AEADB7 notification_pool 1fb15a7a-83cd-4c2e-8b324da1b2adeeaf notifier 7ae671a7-4617-4a09-bf6d9d29c998dbc1 ns +127f4eec-23fa-11f0-a4a6bf0cd6b4583b nxp_eap 376b5e44-9c82-4ec2-bc8310ea101af88f passthrough 64a794f0-55d3-4bca-9d5b7b588badd037 passthru_smart_amp 4e934adb-b0ec-4d33-a086c1022f921321 pipe @@ -158,11 +164,11 @@ dd511749-d9fa-455c-b3a713585693f1af tdfb a62de1af-5964-4e2e-b1677fdc97279a29 template_comp 37c196ae-3532-4282-8a78dd9d50cc7123 testbench 08aeb4ff-7f68-4c71-86c3c842b4262898 tester +c51dc642-a2e1-48df-a490e2748cb6363e tflmcly 04e3f894-2c5c-4f2e-8dc1694eeaab53fa tone e93326d8-0d14-4bf0-bcb9e063d3d80136 twb_sched 42f8060c-832f-4dbf-b24751e961997b34 up_down_mixer b77e677e-5ff4-4188-af14fba8bdbf8682 volume -127f4eec-23fa-11f0-a4a6bf0cd6b4583b nxp_eap 8a171323-94a3-4e1d-afe9fe5dbaa4c393 volume4 1028070e-04e8-46ab-8d8110a0116ce738 wait d944281a-afe9-4695-a043d7f62b89538e waves @@ -171,7 +177,3 @@ d944281a-afe9-4695-a043d7f62b89538e waves 5f1ec3f8-faaf-4099-903ccee98351f169 zephyr_idc 8fa1d42f-bc6f-464b-867f547af08834da zipc_task 1547fe68-de0c-11eb-84613158a1294853 zll_sched -2B79E4F3-4675-F649-89DF3BC194A91AEB brngup -D406D134-C3C1-402C-8AEC6821C0C2B0E6 cold -c51dc642-a2e1-48df-a490e2748cb6363e tflmcly -f36BF24B-9AAF-83f4-8677E072E8AEADB7 notification_pool From f05314d6d0c6cdc30ed4a9ec199f548164a15eb2 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Tue, 22 Jul 2025 21:32:19 +0100 Subject: [PATCH 3/8] build: audio: put modules in alphabetical order Put the Cmake and Kconfig module directories in alphabetical order to help convenience scripting insert new modules. Signed-off-by: Liam Girdwood --- src/audio/CMakeLists.txt | 55 +++++++++++++++-------------- src/audio/Kconfig | 75 ++++++++++++++-------------------------- 2 files changed, 55 insertions(+), 75 deletions(-) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 76625e9796b8..def85f553082 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -17,6 +17,11 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(pcm_converter) add_subdirectory(pipeline) + if(CONFIG_COMP_BASEFW_IPC4 AND NOT CONFIG_LIBRARY) + add_local_sources(sof base_fw.c) + endif() + add_local_sources_ifdef(CONFIG_IPC4_BASE_FW_INTEL sof base_fw_intel.c) + # directories and files included conditionally (alphabetical order) if(CONFIG_COMP_ARIA) add_subdirectory(aria) @@ -24,13 +29,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_ASRC) add_subdirectory(asrc) endif() - if(CONFIG_COMP_BASEFW_IPC4 AND NOT CONFIG_LIBRARY) - add_local_sources(sof base_fw.c) - endif() - add_local_sources_ifdef(CONFIG_IPC4_BASE_FW_INTEL sof base_fw_intel.c) - if(CONFIG_COMP_CHAIN_DMA) - add_local_sources(sof chain_dma.c) - endif() if(CONFIG_COMP_COPIER) add_subdirectory(copier) endif() @@ -52,19 +50,17 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_IIR) add_subdirectory(eq_iir) endif() - if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC) - add_local_sources(sof - kpb.c - ) + if(CONFIG_COMP_LEVEL_MULTIPLIER) + add_subdirectory(level_multiplier) endif() if(CONFIG_COMP_MFCC) add_subdirectory(mfcc) endif() if(CONFIG_COMP_MIXER) - add_subdirectory(mixer) + add_subdirectory(mixer) endif() if(CONFIG_COMP_MIXIN_MIXOUT) - add_subdirectory(mixin_mixout) + add_subdirectory(mixin_mixout) endif() if(CONFIG_COMP_MODULE_ADAPTER) add_subdirectory(module_adapter) @@ -90,10 +86,11 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_TDFB) add_subdirectory(tdfb) endif() - if(CONFIG_COMP_TONE) - add_local_sources(sof - tone.c - ) + if(CONFIG_COMP_TEMPLATE_COMP) + add_subdirectory(template_comp) + endif() + if(CONFIG_COMP_TENSORFLOW) + add_subdirectory(tensorflow) endif() if(CONFIG_COMP_UP_DOWN_MIXER) add_subdirectory(up_down_mixer) @@ -101,18 +98,30 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_VOLUME) add_subdirectory(volume) endif() - if(CONFIG_COMP_TENSORFLOW) - add_subdirectory(tensorflow) - endif() if(CONFIG_DTS_CODEC) add_subdirectory(codec) endif() + # end of directories and files included conditionally (alphabetical order) + add_subdirectory(google) add_subdirectory(nxp) + if(CONFIG_COMP_CHAIN_DMA) + add_local_sources(sof chain_dma.c) + endif() + if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC) + add_local_sources(sof + kpb.c + ) + endif() if(CONFIG_INTEL_ADSP_MIC_PRIVACY) add_subdirectory(mic_privacy_manager) endif() + if(CONFIG_COMP_TONE) + add_local_sources(sof + tone.c + ) + endif() if(CONFIG_ZEPHYR_NATIVE_DRIVERS) list(APPEND base_files host-zephyr.c) sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-zephyr.c) @@ -120,12 +129,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) list(APPEND base_files host-legacy.c) sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-legacy.c) endif() - if(CONFIG_COMP_TEMPLATE_COMP) - add_subdirectory(template_comp) - endif() - if(CONFIG_COMP_LEVEL_MULTIPLIER) - add_subdirectory(level_multiplier) - endif() endif() ### Common files (also used in shared library build) diff --git a/src/audio/Kconfig b/src/audio/Kconfig index 5b6d5b061198..70878817270a 100644 --- a/src/audio/Kconfig +++ b/src/audio/Kconfig @@ -2,9 +2,6 @@ menu "Audio components" -rsource "volume/Kconfig" -rsource "aria/Kconfig" - config COMP_BASEFW_IPC4 bool "BASEFW component" default y @@ -20,8 +17,6 @@ config IPC4_BASE_FW_INTEL This implements a set of additional IPC4 properties that extend the base spec. -rsource "copier/Kconfig" - config HOST_DMA_RELOAD_DELAY_ENABLE bool "Delay reloading DMA for host interfaces" default y @@ -77,8 +72,6 @@ config MODULE_MAX_CONNECTIONS Specifies the maximum number of sink and source connections a module may have to other modules. -rsource "up_down_mixer/Kconfig" - config COMP_BLOB bool "Large IPC data as compound message blobs" default y @@ -94,18 +87,12 @@ config MODULE_MAX_BLOB_SIZE Specify the maximum size of IPC4 module blob data that can be appended to each message. -rsource "src/Kconfig" - config COMP_STUBS bool "Build all selected third-party (3P) components with stubs" help Select to force all 3P blocks to link against stubs rather than their libraries. This should only be used in testing environments like fuzzers or CI. -rsource "eq_fir/Kconfig" - -rsource "eq_iir/Kconfig" - config COMP_TONE bool "Tone component" select CORDIC_FIXED @@ -113,12 +100,6 @@ config COMP_TONE Select for Tone component. Warning: This component is deprecated and will be removed from SOF v2.8. -rsource "mixer/Kconfig" - -rsource "mixin_mixout/Kconfig" - -rsource "mux/Kconfig" - config COMP_KPB bool "KPB component" default y @@ -135,28 +116,6 @@ config KPB_FORCE_COPY_TYPE_NORMAL endif # COMP_KPB -rsource "google/Kconfig" - -rsource "nxp/Kconfig" - -rsource "selector/Kconfig" - -rsource "crossover/Kconfig" - -rsource "drc/Kconfig" - -rsource "multiband_drc/Kconfig" - -rsource "dcblock/Kconfig" - -rsource "smart_amp/Kconfig" - -rsource "asrc/Kconfig" - -rsource "tdfb/Kconfig" - -rsource "tensorflow/Kconfig" - config COMP_MODULE_ADAPTER bool "Module adapter" default y @@ -168,17 +127,35 @@ config COMP_MODULE_ADAPTER "src\include\sof\audio\module_adapter\interfaces.h". It is possible to link several different codecs and use them in parallel. -rsource "module_adapter/Kconfig" - +# --- Kconfig Sources (alphabetical order) --- +rsource "aria/Kconfig" +rsource "asrc/Kconfig" +rsource "codec/Kconfig" +rsource "copier/Kconfig" +rsource "crossover/Kconfig" +rsource "dcblock/Kconfig" +rsource "drc/Kconfig" +rsource "eq_fir/Kconfig" +rsource "eq_iir/Kconfig" +rsource "google/Kconfig" rsource "igo_nr/Kconfig" - -rsource "rtnr/Kconfig" - rsource "mfcc/Kconfig" - -rsource "codec/Kconfig" - +rsource "mixer/Kconfig" +rsource "mixin_mixout/Kconfig" +rsource "module_adapter/Kconfig" +rsource "multiband_drc/Kconfig" +rsource "mux/Kconfig" +rsource "nxp/Kconfig" +rsource "rtnr/Kconfig" +rsource "selector/Kconfig" +rsource "smart_amp/Kconfig" +rsource "src/Kconfig" +rsource "tdfb/Kconfig" rsource "template_comp/Kconfig" +rsource "tensorflow/Kconfig" +rsource "up_down_mixer/Kconfig" +rsource "volume/Kconfig" +# --- End Kconfig Sources (alphabetical order) --- rsource "level_multiplier/Kconfig" From 7b45a091d394dd79e480ca7467fde0daf1eed9dd Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Tue, 22 Jul 2025 21:36:37 +0100 Subject: [PATCH 4/8] scripts: gen-uuid: emit UUIDs that are generated Make things a little easier to debug for UUID generation. Signed-off-by: Liam Girdwood --- scripts/gen-uuid-reg.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/gen-uuid-reg.py b/scripts/gen-uuid-reg.py index ddd7f06658ea..316f35315544 100755 --- a/scripts/gen-uuid-reg.py +++ b/scripts/gen-uuid-reg.py @@ -53,6 +53,7 @@ def main(): all_uuids.add(uu) all_syms.add(sym) emit_uuid_rec(uu, sym) + print(f"Added UUID {uu} with symbol {sym}") with open(sys.argv[2], "w") as f: f.write(header) From d2c4193085c28662435f9d011659f6dc170c52c3 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 3 Sep 2025 17:35:09 +0100 Subject: [PATCH 5/8] template: rename template_comp to template Make the template simpler by removing the "_comp" from filenames, API calls, Kconfig, CMakefile and macros. This simplifies usage as there was a mix of template and template_comp and makes it easier to use as a starting point for new modules. Signed-off-by: Liam Girdwood --- src/audio/CMakeLists.txt | 4 +- src/audio/Kconfig | 2 +- .../CMakeLists.txt | 6 +- src/audio/{template_comp => template}/Kconfig | 6 +- .../llext/CMakeLists.txt | 0 .../llext/llext.toml.h | 0 .../template-generic.c | 42 ++++----- .../template-ipc3.c | 26 +++--- .../template-ipc4.c | 26 +++--- .../{template_comp => template}/template.c | 90 +++++++++---------- .../{template_comp => template}/template.h | 64 ++++++------- .../template.toml} | 2 +- src/include/sof/audio/component.h | 2 +- tools/rimage/config/lnl.toml.h | 4 +- tools/rimage/config/mtl.toml.h | 4 +- tools/rimage/config/ptl.toml.h | 4 +- tools/rimage/config/wcl.toml.h | 4 +- tools/testbench/utils_ipc4.c | 2 +- uuid-registry.txt | 2 +- 19 files changed, 145 insertions(+), 145 deletions(-) rename src/audio/{template_comp => template}/CMakeLists.txt (65%) rename src/audio/{template_comp => template}/Kconfig (65%) rename src/audio/{template_comp => template}/llext/CMakeLists.txt (100%) rename src/audio/{template_comp => template}/llext/llext.toml.h (100%) rename src/audio/{template_comp => template}/template-generic.c (84%) rename src/audio/{template_comp => template}/template-ipc3.c (74%) rename src/audio/{template_comp => template}/template-ipc4.c (67%) rename src/audio/{template_comp => template}/template.c (65%) rename src/audio/{template_comp => template}/template.h (59%) rename src/audio/{template_comp/template_comp.toml => template/template.toml} (94%) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index def85f553082..c098b9267c61 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -86,8 +86,8 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_TDFB) add_subdirectory(tdfb) endif() - if(CONFIG_COMP_TEMPLATE_COMP) - add_subdirectory(template_comp) + if(CONFIG_COMP_TEMPLATE) + add_subdirectory(template) endif() if(CONFIG_COMP_TENSORFLOW) add_subdirectory(tensorflow) diff --git a/src/audio/Kconfig b/src/audio/Kconfig index 70878817270a..ce3ba346b1e5 100644 --- a/src/audio/Kconfig +++ b/src/audio/Kconfig @@ -151,7 +151,7 @@ rsource "selector/Kconfig" rsource "smart_amp/Kconfig" rsource "src/Kconfig" rsource "tdfb/Kconfig" -rsource "template_comp/Kconfig" +rsource "template/Kconfig" rsource "tensorflow/Kconfig" rsource "up_down_mixer/Kconfig" rsource "volume/Kconfig" diff --git a/src/audio/template_comp/CMakeLists.txt b/src/audio/template/CMakeLists.txt similarity index 65% rename from src/audio/template_comp/CMakeLists.txt rename to src/audio/template/CMakeLists.txt index d21be2f9ab88..5dded00e733c 100644 --- a/src/audio/template_comp/CMakeLists.txt +++ b/src/audio/template/CMakeLists.txt @@ -1,8 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause -if(CONFIG_COMP_TEMPLATE_COMP STREQUAL "m") - add_subdirectory(llext ${PROJECT_BINARY_DIR}/template_comp_llext) - add_dependencies(app template_comp) +if(CONFIG_COMP_TEMPLATE STREQUAL "m") + add_subdirectory(llext ${PROJECT_BINARY_DIR}/template_llext) + add_dependencies(app template) else() add_local_sources(sof template.c) add_local_sources(sof template-generic.c) diff --git a/src/audio/template_comp/Kconfig b/src/audio/template/Kconfig similarity index 65% rename from src/audio/template_comp/Kconfig rename to src/audio/template/Kconfig index 29d385cbbe98..907749c5fa8e 100644 --- a/src/audio/template_comp/Kconfig +++ b/src/audio/template/Kconfig @@ -1,10 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause -config COMP_TEMPLATE_COMP - tristate "Template_comp example component" +config COMP_TEMPLATE + tristate "Template example component" default y help - Select for template_comp component. Reason for existence + Select for template component. Reason for existence is to provide a minimal component example and use as placeholder in processing pipelines. As example processing it swaps or reverses the channels when the switch control diff --git a/src/audio/template_comp/llext/CMakeLists.txt b/src/audio/template/llext/CMakeLists.txt similarity index 100% rename from src/audio/template_comp/llext/CMakeLists.txt rename to src/audio/template/llext/CMakeLists.txt diff --git a/src/audio/template_comp/llext/llext.toml.h b/src/audio/template/llext/llext.toml.h similarity index 100% rename from src/audio/template_comp/llext/llext.toml.h rename to src/audio/template/llext/llext.toml.h diff --git a/src/audio/template_comp/template-generic.c b/src/audio/template/template-generic.c similarity index 84% rename from src/audio/template_comp/template-generic.c rename to src/audio/template/template-generic.c index d5f58139d201..14b68c31d9c5 100644 --- a/src/audio/template_comp/template-generic.c +++ b/src/audio/template/template-generic.c @@ -12,7 +12,7 @@ #if CONFIG_FORMAT_S16LE /** - * template_comp_s16() - Process S16_LE format. + * template_s16() - Process S16_LE format. * @mod: Pointer to module data. * @source: Source for PCM samples data. * @sink: Sink for PCM samples data. @@ -24,12 +24,12 @@ * * Return: Value zero for success, otherwise an error code. */ -static int template_comp_s16(const struct processing_module *mod, - struct sof_source *source, - struct sof_sink *sink, - uint32_t frames) +static int template_s16(const struct processing_module *mod, + struct sof_source *source, + struct sof_sink *sink, + uint32_t frames) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); int16_t const *x, *x_start, *x_end; int16_t *y, *y_start, *y_end; int x_size, y_size; @@ -98,7 +98,7 @@ static int template_comp_s16(const struct processing_module *mod, #if CONFIG_FORMAT_S32LE || CONFIG_FORMAT_S24LE /** - * template_comp_s32() - Process S32_LE or S24_4LE format. + * template_s32() - Process S32_LE or S24_4LE format. * @mod: Pointer to module data. * @source: Source for PCM samples data. * @sink: Sink for PCM samples data. @@ -111,12 +111,12 @@ static int template_comp_s16(const struct processing_module *mod, * * Return: Value zero for success, otherwise an error code. */ -static int template_comp_s32(const struct processing_module *mod, - struct sof_source *source, - struct sof_sink *sink, - uint32_t frames) +static int template_s32(const struct processing_module *mod, + struct sof_source *source, + struct sof_sink *sink, + uint32_t frames) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); int32_t const *x, *x_start, *x_end; int32_t *y, *y_start, *y_end; int x_size, y_size; @@ -186,20 +186,20 @@ static int template_comp_s32(const struct processing_module *mod, /* This struct array defines the used processing functions for * the PCM formats */ -const struct template_comp_proc_fnmap template_comp_proc_fnmap[] = { +const struct template_proc_fnmap template_proc_fnmap[] = { #if CONFIG_FORMAT_S16LE - { SOF_IPC_FRAME_S16_LE, template_comp_s16 }, + { SOF_IPC_FRAME_S16_LE, template_s16 }, #endif #if CONFIG_FORMAT_S24LE - { SOF_IPC_FRAME_S24_4LE, template_comp_s32 }, + { SOF_IPC_FRAME_S24_4LE, template_s32 }, #endif #if CONFIG_FORMAT_S32LE - { SOF_IPC_FRAME_S32_LE, template_comp_s32 }, + { SOF_IPC_FRAME_S32_LE, template_s32 }, #endif }; /** - * template_comp_find_proc_func() - Find suitable processing function. + * template_find_proc_func() - Find suitable processing function. * @src_fmt: Enum value for PCM format. * * This function finds the suitable processing function to use for @@ -207,14 +207,14 @@ const struct template_comp_proc_fnmap template_comp_proc_fnmap[] = { * * Return: Pointer to processing function for the requested PCM format. */ -template_comp_func template_comp_find_proc_func(enum sof_ipc_frame src_fmt) +template_func template_find_proc_func(enum sof_ipc_frame src_fmt) { int i; /* Find suitable processing function from map */ - for (i = 0; i < ARRAY_SIZE(template_comp_proc_fnmap); i++) - if (src_fmt == template_comp_proc_fnmap[i].frame_fmt) - return template_comp_proc_fnmap[i].template_comp_proc_func; + for (i = 0; i < ARRAY_SIZE(template_proc_fnmap); i++) + if (src_fmt == template_proc_fnmap[i].frame_fmt) + return template_proc_fnmap[i].template_proc_func; return NULL; } diff --git a/src/audio/template_comp/template-ipc3.c b/src/audio/template/template-ipc3.c similarity index 74% rename from src/audio/template_comp/template-ipc3.c rename to src/audio/template/template-ipc3.c index 757afb8bf923..30398b841bcf 100644 --- a/src/audio/template_comp/template-ipc3.c +++ b/src/audio/template/template-ipc3.c @@ -6,26 +6,26 @@ #include #include "template.h" -LOG_MODULE_DECLARE(template_comp, CONFIG_SOF_LOG_LEVEL); +LOG_MODULE_DECLARE(template, CONFIG_SOF_LOG_LEVEL); /* This function handles the real-time controls. The ALSA controls have the * param_id set to indicate the control type. The control ID, from topology, * is used to separate the controls instances of same type. In control payload * the num_elems defines to how many channels the control is applied to. */ -__cold int template_comp_set_config(struct processing_module *mod, uint32_t param_id, - enum module_cfg_fragment_position pos, - uint32_t data_offset_size, const uint8_t *fragment, - size_t fragment_size, uint8_t *response, - size_t response_size) +__cold int template_set_config(struct processing_module *mod, uint32_t param_id, + enum module_cfg_fragment_position pos, + uint32_t data_offset_size, const uint8_t *fragment, + size_t fragment_size, uint8_t *response, + size_t response_size) { struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment; - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; assert_can_be_cold(); - comp_dbg(dev, "template_comp_set_config()"); + comp_dbg(dev, "template_set_config()"); switch (cdata->cmd) { case SOF_CTRL_CMD_SWITCH: @@ -55,17 +55,17 @@ __cold int template_comp_set_config(struct processing_module *mod, uint32_t para return -EINVAL; } -__cold int template_comp_get_config(struct processing_module *mod, - uint32_t config_id, uint32_t *data_offset_size, - uint8_t *fragment, size_t fragment_size) +__cold int template_get_config(struct processing_module *mod, + uint32_t config_id, uint32_t *data_offset_size, + uint8_t *fragment, size_t fragment_size) { struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment; - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; assert_can_be_cold(); - comp_info(dev, "template_comp_get_config()"); + comp_info(dev, "template_get_config()"); switch (cdata->cmd) { case SOF_CTRL_CMD_SWITCH: diff --git a/src/audio/template_comp/template-ipc4.c b/src/audio/template/template-ipc4.c similarity index 67% rename from src/audio/template_comp/template-ipc4.c rename to src/audio/template/template-ipc4.c index e11a6695ef9d..f66015d9041c 100644 --- a/src/audio/template_comp/template-ipc4.c +++ b/src/audio/template/template-ipc4.c @@ -6,20 +6,20 @@ #include #include "template.h" -LOG_MODULE_DECLARE(template_comp, CONFIG_SOF_LOG_LEVEL); +LOG_MODULE_DECLARE(template, CONFIG_SOF_LOG_LEVEL); /* IPC4 controls handler */ -__cold int template_comp_set_config(struct processing_module *mod, - uint32_t param_id, - enum module_cfg_fragment_position pos, - uint32_t data_offset_size, - const uint8_t *fragment, - size_t fragment_size, - uint8_t *response, - size_t response_size) +__cold int template_set_config(struct processing_module *mod, + uint32_t param_id, + enum module_cfg_fragment_position pos, + uint32_t data_offset_size, + const uint8_t *fragment, + size_t fragment_size, + uint8_t *response, + size_t response_size) { struct sof_ipc4_control_msg_payload *ctl = (struct sof_ipc4_control_msg_payload *)fragment; - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; assert_can_be_cold(); @@ -51,9 +51,9 @@ __cold int template_comp_set_config(struct processing_module *mod, } /* Not used in IPC4 systems, if IPC4 only component, omit .get_configuration set */ -__cold int template_comp_get_config(struct processing_module *mod, - uint32_t config_id, uint32_t *data_offset_size, - uint8_t *fragment, size_t fragment_size) +__cold int template_get_config(struct processing_module *mod, + uint32_t config_id, uint32_t *data_offset_size, + uint8_t *fragment, size_t fragment_size) { assert_can_be_cold(); return 0; diff --git a/src/audio/template_comp/template.c b/src/audio/template/template.c similarity index 65% rename from src/audio/template_comp/template.c rename to src/audio/template/template.c index fcd3fa294d03..20911df27bb2 100644 --- a/src/audio/template_comp/template.c +++ b/src/audio/template/template.c @@ -12,18 +12,18 @@ /* UUID identifies the components. Use e.g. command uuidgen from package * uuid-runtime, add it to uuid-registry.txt in SOF top level. */ -SOF_DEFINE_REG_UUID(template_comp); +SOF_DEFINE_REG_UUID(template); /* Creates logging data for the component */ -LOG_MODULE_REGISTER(template_comp, CONFIG_SOF_LOG_LEVEL); +LOG_MODULE_REGISTER(template, CONFIG_SOF_LOG_LEVEL); /* Creates the compont trace. Traces show in trace console the component * info, warning, and error messages. */ -DECLARE_TR_CTX(template_comp_tr, SOF_UUID(template_comp_uuid), LOG_LEVEL_INFO); +DECLARE_TR_CTX(template_tr, SOF_UUID(template_uuid), LOG_LEVEL_INFO); /** - * template_comp_init() - Initialize the template component. + * template_init() - Initialize the template component. * @mod: Pointer to module data. * * This function is called when the instance is created. The @@ -32,13 +32,13 @@ DECLARE_TR_CTX(template_comp_tr, SOF_UUID(template_comp_uuid), LOG_LEVEL_INFO); * * Return: Zero if success, otherwise error code. */ -__cold static int template_comp_init(struct processing_module *mod) +__cold static int template_init(struct processing_module *mod) { struct module_data *md = &mod->priv; struct comp_dev *dev = mod->dev; - struct template_comp_comp_data *cd; + struct template_comp_data *cd; - comp_info(dev, "template_comp_init()"); + comp_info(dev, "template_init()"); cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd)); if (!cd) @@ -49,7 +49,7 @@ __cold static int template_comp_init(struct processing_module *mod) } /** - * template_comp_process() - The audio data processing function. + * template_process() - The audio data processing function. * @mod: Pointer to module data. * @sources: Pointer to audio samples data sources array. * @num_of_sources: Number of sources in the array. @@ -61,25 +61,25 @@ __cold static int template_comp_init(struct processing_module *mod) * * Return: Zero if success, otherwise error code. */ -static int template_comp_process(struct processing_module *mod, - struct sof_source **sources, - int num_of_sources, - struct sof_sink **sinks, - int num_of_sinks) +static int template_process(struct processing_module *mod, + struct sof_source **sources, + int num_of_sources, + struct sof_sink **sinks, + int num_of_sinks) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; struct sof_source *source = sources[0]; /* One input in this example */ struct sof_sink *sink = sinks[0]; /* One output in this example */ int frames = source_get_data_frames_available(source); int sink_frames = sink_get_free_frames(sink); - comp_dbg(dev, "template_comp_process()"); + comp_dbg(dev, "template_process()"); frames = MIN(frames, sink_frames); if (cd->enable) /* Process the data with the channels swap example function. */ - return cd->template_comp_func(mod, source, sink, frames); + return cd->template_func(mod, source, sink, frames); /* Just copy from source to sink. */ source_to_sink_copy(source, sink, true, frames * cd->frame_bytes); @@ -87,7 +87,7 @@ static int template_comp_process(struct processing_module *mod, } /** - * template_comp_prepare() - Prepare the component for processing. + * template_prepare() - Prepare the component for processing. * @mod: Pointer to module data. * @sources: Pointer to audio samples data sources array. * @num_of_sources: Number of sources in the array. @@ -101,16 +101,16 @@ static int template_comp_process(struct processing_module *mod, * * Return: Value zero if success, otherwise error code. */ -static int template_comp_prepare(struct processing_module *mod, - struct sof_source **sources, int num_of_sources, - struct sof_sink **sinks, int num_of_sinks) +static int template_prepare(struct processing_module *mod, + struct sof_source **sources, int num_of_sources, + struct sof_sink **sinks, int num_of_sinks) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; enum sof_ipc_frame source_format; int i; - comp_dbg(dev, "template_comp_prepare()"); + comp_dbg(dev, "template_prepare()"); /* The processing example in this component supports one input and one * output. Generally there can be more. @@ -127,8 +127,8 @@ static int template_comp_prepare(struct processing_module *mod, for (i = 0; i < cd->channels; i++) cd->channel_map[i] = cd->channels - i - 1; - cd->template_comp_func = template_comp_find_proc_func(source_format); - if (!cd->template_comp_func) { + cd->template_func = template_find_proc_func(source_format); + if (!cd->template_func) { comp_err(dev, "No processing function found for format %d.", source_format); return -EINVAL; @@ -138,7 +138,7 @@ static int template_comp_prepare(struct processing_module *mod, } /** - * template_comp_reset() - Reset the component. + * template_reset() - Reset the component. * @mod: Pointer to module data. * * The component reset is called when pipeline is stopped. The reset @@ -146,17 +146,17 @@ static int template_comp_prepare(struct processing_module *mod, * * Return: Value zero, always success. */ -static int template_comp_reset(struct processing_module *mod) +static int template_reset(struct processing_module *mod) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); - comp_dbg(mod->dev, "template_comp_reset()"); + comp_dbg(mod->dev, "template_reset()"); memset(cd, 0, sizeof(*cd)); return 0; } /** - * template_comp_free() - Free dynamic allocations. + * template_free() - Free dynamic allocations. * @mod: Pointer to module data. * * Component free is called when the pipelines are deleted. All @@ -166,46 +166,46 @@ static int template_comp_reset(struct processing_module *mod) * * Return: Value zero, always success. */ -__cold static int template_comp_free(struct processing_module *mod) +__cold static int template_free(struct processing_module *mod) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); assert_can_be_cold(); - comp_dbg(mod->dev, "template_comp_free()"); + comp_dbg(mod->dev, "template_free()"); rfree(cd); return 0; } /* This defines the module operations */ -static const struct module_interface template_comp_interface = { - .init = template_comp_init, - .prepare = template_comp_prepare, - .process = template_comp_process, - .set_configuration = template_comp_set_config, - .get_configuration = template_comp_get_config, - .reset = template_comp_reset, - .free = template_comp_free +static const struct module_interface template_interface = { + .init = template_init, + .prepare = template_prepare, + .process = template_process, + .set_configuration = template_set_config, + .get_configuration = template_get_config, + .reset = template_reset, + .free = template_free }; /* This controls build of the module. If COMP_MODULE is selected in kconfig * this is build as dynamically loadable module. */ -#if CONFIG_COMP_TEMPLATE_COMP_MODULE +#if CONFIG_COMP_TEMPLATE_MODULE #include #include #include static const struct sof_man_module_manifest mod_manifest __section(".module") __used = - SOF_LLEXT_MODULE_MANIFEST("TEMPLATE", &template_comp_interface, 1, - SOF_REG_UUID(template_comp), 40); + SOF_LLEXT_MODULE_MANIFEST("TEMPLATE", &template_interface, 1, + SOF_REG_UUID(template), 40); SOF_LLEXT_BUILDINFO; #else -DECLARE_MODULE_ADAPTER(template_comp_interface, template_comp_uuid, template_comp_tr); -SOF_MODULE_INIT(template_comp, sys_comp_module_template_comp_interface_init); +DECLARE_MODULE_ADAPTER(template_interface, template_uuid, template_tr); +SOF_MODULE_INIT(template, sys_comp_module_template_interface_init); #endif diff --git a/src/audio/template_comp/template.h b/src/audio/template/template.h similarity index 59% rename from src/audio/template_comp/template.h rename to src/audio/template/template.h index 667d95702c10..c139a492e6c0 100644 --- a/src/audio/template_comp/template.h +++ b/src/audio/template/template.h @@ -3,38 +3,38 @@ * Copyright(c) 2025 Intel Corporation. * */ -#ifndef __SOF_AUDIO_TEMPLATE_COMP_H__ -#define __SOF_AUDIO_TEMPLATE_COMP_H__ +#ifndef __SOF_AUDIO_TEMPLATE_H__ +#define __SOF_AUDIO_TEMPLATE_H__ #include #include #include /** - * struct template_comp_func - Function call pointer for process function + * struct template_func - Function call pointer for process function * @mod: Pointer to module data. * @source: Source for PCM samples data. * @sink: Sink for PCM samples data. * @frames: Number of audio data frames to process. */ -typedef int (*template_comp_func)(const struct processing_module *mod, - struct sof_source *source, - struct sof_sink *sink, - uint32_t frames); +typedef int (*template_func)(const struct processing_module *mod, + struct sof_source *source, + struct sof_sink *sink, + uint32_t frames); -/* Template_Comp component private data */ +/* Template component private data */ /** - * struct template_comp_comp_data - * @template_comp_func: Pointer to used processing function. + * struct template_comp_data + * @template_func: Pointer to used processing function. * @channels_order[]: Vector with desired sink channels order. * @source_format: Source samples format. * @frame_bytes: Number of bytes in an audio frame. * @channels: Channels count. * @enable: Control processing on/off, on - reorder channels */ -struct template_comp_comp_data { - template_comp_func template_comp_func; +struct template_comp_data { + template_func template_func; int channel_map[PLATFORM_MAX_CHANNELS]; int source_format; int frame_bytes; @@ -43,17 +43,17 @@ struct template_comp_comp_data { }; /** - * struct template_comp_proc_fnmap - processing functions for frame formats + * struct template_proc_fnmap - processing functions for frame formats * @frame_fmt: Current frame format - * @template_comp_proc_func: Function pointer for the suitable processing function + * @template_proc_func: Function pointer for the suitable processing function */ -struct template_comp_proc_fnmap { +struct template_proc_fnmap { enum sof_ipc_frame frame_fmt; - template_comp_func template_comp_proc_func; + template_func template_proc_func; }; /** - * template_comp_find_proc_func() - Find suitable processing function. + * template_find_proc_func() - Find suitable processing function. * @src_fmt: Enum value for PCM format. * * This function finds the suitable processing function to use for @@ -61,10 +61,10 @@ struct template_comp_proc_fnmap { * * Return: Pointer to processing function for the requested PCM format. */ -template_comp_func template_comp_find_proc_func(enum sof_ipc_frame src_fmt); +template_func template_find_proc_func(enum sof_ipc_frame src_fmt); /** - * template_comp_set_config() - Handle controls set + * template_set_config() - Handle controls set * @mod: Pointer to module data. * @param_id: Id to know control type, used to know ALSA control type. * @pos: Position of the fragment in the large message. @@ -81,17 +81,17 @@ template_comp_func template_comp_find_proc_func(enum sof_ipc_frame src_fmt); * * Return: Zero if success, otherwise error code. */ -int template_comp_set_config(struct processing_module *mod, - uint32_t param_id, - enum module_cfg_fragment_position pos, - uint32_t data_offset_size, - const uint8_t *fragment, - size_t fragment_size, - uint8_t *response, - size_t response_size); +int template_set_config(struct processing_module *mod, + uint32_t param_id, + enum module_cfg_fragment_position pos, + uint32_t data_offset_size, + const uint8_t *fragment, + size_t fragment_size, + uint8_t *response, + size_t response_size); /** - * template_comp_set_config() - Handle controls get + * template_set_config() - Handle controls get * @mod: Pointer to module data. * @config_id: Configuration ID. * @data_offset_size: Size of the whole configuration if it is the first or only @@ -103,8 +103,8 @@ int template_comp_set_config(struct processing_module *mod, * * Return: Zero if success, otherwise error code. */ -int template_comp_get_config(struct processing_module *mod, - uint32_t config_id, uint32_t *data_offset_size, - uint8_t *fragment, size_t fragment_size); +int template_get_config(struct processing_module *mod, + uint32_t config_id, uint32_t *data_offset_size, + uint8_t *fragment, size_t fragment_size); -#endif // __SOF_AUDIO_TEMPLATE_COMP_H__ +#endif // __SOF_AUDIO_TEMPLATE_H__ diff --git a/src/audio/template_comp/template_comp.toml b/src/audio/template/template.toml similarity index 94% rename from src/audio/template_comp/template_comp.toml rename to src/audio/template/template.toml index c4d28b125fe3..6d41f3a599f5 100644 --- a/src/audio/template_comp/template_comp.toml +++ b/src/audio/template/template.toml @@ -5,7 +5,7 @@ REM # Template component module config [[module.entry]] name = "TEMPLATE" - uuid = UUIDREG_STR_TEMPLATE_COMP + uuid = UUIDREG_STR_TEMPLATE affinity_mask = "0x1" instance_count = "40" domain_types = "0" diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 37515576e32c..860dc5e42580 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -939,7 +939,7 @@ void sys_comp_module_selector_interface_init(void); void sys_comp_module_src_interface_init(void); void sys_comp_module_src_lite_interface_init(void); void sys_comp_module_tdfb_interface_init(void); -void sys_comp_module_template_comp_interface_init(void); +void sys_comp_module_template_interface_init(void); void sys_comp_module_volume_interface_init(void); void sys_comp_module_tester_interface_init(void); diff --git a/tools/rimage/config/lnl.toml.h b/tools/rimage/config/lnl.toml.h index 030683b6ef77..0667548e1773 100644 --- a/tools/rimage/config/lnl.toml.h +++ b/tools/rimage/config/lnl.toml.h @@ -138,8 +138,8 @@ #include