From b130f853a8d3a5c46661f69c0b65d3d7943abbcc Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 12:25:21 +0100 Subject: [PATCH 01/37] zephyr: move primary_core_init() to POST_KERNEL Zephyr has an elaborate subsystem initialisation framework. Use it for primary_core_init() instead of calling it from main(). This prepares for a migration of module initialisation to that framework too. Signed-off-by: Guennadi Liakhovetski --- src/include/sof/schedule/task.h | 1 + src/init/init.c | 14 +++++++++++++- zephyr/wrapper.c | 17 ++++++++++------- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/include/sof/schedule/task.h b/src/include/sof/schedule/task.h index 7d828d9f6627..df9040fa0100 100644 --- a/src/include/sof/schedule/task.h +++ b/src/include/sof/schedule/task.h @@ -122,5 +122,6 @@ void task_main_init(void); void task_main_free(void); int task_main_start(struct sof *sof); +int start_complete(void); #endif /* __SOF_SCHEDULE_TASK_H__ */ diff --git a/src/init/init.c b/src/init/init.c index 844c9c4735ea..9c1669398556 100644 --- a/src/init/init.c +++ b/src/init/init.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -315,6 +316,17 @@ int sof_main(int argc, char *argv[]) { trace_point(TRACE_BOOT_START); - return primary_core_init(argc, argv, &sof); + return start_complete(); } + +struct device; + +static int sof_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + return primary_core_init(0, NULL, &sof); +} + +SYS_INIT(sof_init, POST_KERNEL, 99); #endif diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index ba03fa05ab5b..b45016c9496c 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -258,8 +258,6 @@ int task_main_start(struct sof *sof) { _smex_placeholder = smex_placeholder_f(); - int ret; - /* init default audio components */ sys_comp_init(sof); @@ -269,6 +267,14 @@ int task_main_start(struct sof *sof) /* host is mandatory */ sys_comp_host_init(); + /* init pipeline position offsets */ + pipeline_posn_init(sof); + + return 0; +} + +int start_complete(void) +{ if (IS_ENABLED(CONFIG_COMP_VOLUME)) { #if CONFIG_COMP_LEGACY_INTERFACE sys_comp_volume_init(); @@ -388,8 +394,6 @@ int task_main_start(struct sof *sof) if (IS_ENABLED(CONFIG_PROBE)) sys_comp_probe_init(); #endif - /* init pipeline position offsets */ - pipeline_posn_init(sof); /* init chain dma manager*/ if (IS_ENABLED(CONFIG_COMP_CHAIN_DMA)) @@ -410,10 +414,9 @@ int task_main_start(struct sof *sof) pm_policy_state_lock_get(PM_STATE_RUNTIME_IDLE, PM_ALL_SUBSTATES); pm_policy_state_lock_get(PM_STATE_SOFT_OFF, PM_ALL_SUBSTATES); #endif - /* let host know DSP boot is complete */ - ret = platform_boot_complete(0); - return ret; + /* let host know DSP boot is complete */ + return platform_boot_complete(0); } /* From af98b12788f116b6532e81d80464584ebd9df79e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 13:59:07 +0100 Subject: [PATCH 02/37] zephyr: add a macro for module initialisation This macro integrates SOF modules into Zephyr initialisation framework. SOF module initialisation functions use DECLARE_MODULE_ADAPTER() or DECLARE_MODULE() to register with the SOF native initialisation scheme, now the same initialisation functions can be used with the new SOF_MODULE_INIT() macro to integrate them into the Zephyr initialisation flow. Signed-off-by: Guennadi Liakhovetski --- xtos/include/rtos/init.h | 11 +++++++++++ zephyr/include/rtos/init.h | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 xtos/include/rtos/init.h create mode 100644 zephyr/include/rtos/init.h diff --git a/xtos/include/rtos/init.h b/xtos/include/rtos/init.h new file mode 100644 index 000000000000..ebe2ffafc062 --- /dev/null +++ b/xtos/include/rtos/init.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright(c) 2023 Intel Corporation. All rights reserved. + */ + +#ifndef __XTOS_RTOS_INIT_H__ +#define __XTOS_RTOS_INIT_H__ + +#define SOF_MODULE_INIT(name, init) + +#endif /* __XTOS_RTOS_INIT_H__ */ diff --git a/zephyr/include/rtos/init.h b/zephyr/include/rtos/init.h new file mode 100644 index 000000000000..f80b97ab6ffa --- /dev/null +++ b/zephyr/include/rtos/init.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright(c) 2023 Intel Corporation. All rights reserved. + */ + +#ifndef __ZEPHYR_RTOS_INIT_H__ +#define __ZEPHYR_RTOS_INIT_H__ + +#include + +#define SOF_MODULE_INIT(name, init) \ +static int zephyr_##name##_init(const struct device *dev) \ +{ \ + ARG_UNUSED(dev); \ + init(); \ + return 0; \ +} \ +SYS_INIT(zephyr_##name##_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY) + +#endif /* __ZEPHYR_RTOS_INIT_H__ */ From c750068bdf71060ee42ad07a85468447c53215ff Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 14:06:51 +0100 Subject: [PATCH 03/37] volume: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register volume with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module/volume/volume.c | 4 ++++ zephyr/wrapper.c | 17 ----------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/audio/module_adapter/module/volume/volume.c b/src/audio/module_adapter/module/volume/volume.c index 3d6a7a688d9c..629797dbaf25 100644 --- a/src/audio/module_adapter/module/volume/volume.c +++ b/src/audio/module_adapter/module/volume/volume.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1542,6 +1543,7 @@ UT_STATIC void sys_comp_volume_init(void) } DECLARE_MODULE(sys_comp_volume_init); +SOF_MODULE_INIT(volume, sys_comp_volume_init); #else static struct module_interface volume_interface = { .init = volume_init, @@ -1554,6 +1556,7 @@ static struct module_interface volume_interface = { }; DECLARE_MODULE_ADAPTER(volume_interface, volume_uuid, volume_tr); +SOF_MODULE_INIT(volume, sys_comp_module_volume_interface_init); #if CONFIG_COMP_GAIN static struct module_interface gain_interface = { @@ -1567,5 +1570,6 @@ static struct module_interface gain_interface = { }; DECLARE_MODULE_ADAPTER(gain_interface, gain_uuid, gain_tr); +SOF_MODULE_INIT(gain, sys_comp_module_gain_interface_init); #endif #endif diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index b45016c9496c..bb5323d7ab2b 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -212,12 +212,6 @@ void sys_comp_basefw_init(void); void sys_comp_copier_init(void); void sys_comp_module_cadence_interface_init(void); void sys_comp_module_passthrough_interface_init(void); -#if CONFIG_COMP_LEGACY_INTERFACE -void sys_comp_volume_init(void); -#else -void sys_comp_module_volume_interface_init(void); -#endif -void sys_comp_module_gain_interface_init(void); void sys_comp_module_mixin_interface_init(void); void sys_comp_aria_init(void); void sys_comp_crossover_init(void); @@ -275,17 +269,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_VOLUME)) { -#if CONFIG_COMP_LEGACY_INTERFACE - sys_comp_volume_init(); -#else - sys_comp_module_volume_interface_init(); -#endif - - if (IS_ENABLED(CONFIG_IPC_MAJOR_4)) - sys_comp_module_gain_interface_init(); - } - if (IS_ENABLED(CONFIG_COMP_MIXER)) { #if CONFIG_IPC_MAJOR_3 sys_comp_module_mixer_interface_init(); From 379d6b8174dde26d7ca0fecaa1793db5e7431065 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 14:25:17 +0100 Subject: [PATCH 04/37] mixer: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register mixer, mixin and mixout with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/mixer/mixer.c | 2 ++ src/audio/mixin_mixout/mixin_mixout.c | 3 +++ zephyr/wrapper.c | 15 --------------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/audio/mixer/mixer.c b/src/audio/mixer/mixer.c index 7bb97a2c7a3e..e4f88afcd30a 100644 --- a/src/audio/mixer/mixer.c +++ b/src/audio/mixer/mixer.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -230,3 +231,4 @@ static struct module_interface mixer_interface = { }; DECLARE_MODULE_ADAPTER(mixer_interface, mixer_uuid, mixer_tr); +SOF_MODULE_INIT(mixer, sys_comp_module_mixer_interface_init); diff --git a/src/audio/mixin_mixout/mixin_mixout.c b/src/audio/mixin_mixout/mixin_mixout.c index ff3578bd3f3a..c56724f2e9a0 100644 --- a/src/audio/mixin_mixout/mixin_mixout.c +++ b/src/audio/mixin_mixout/mixin_mixout.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -918,6 +919,7 @@ static struct module_interface mixin_interface = { }; DECLARE_MODULE_ADAPTER(mixin_interface, mixin_uuid, mixin_tr); +SOF_MODULE_INIT(mixin, sys_comp_module_mixin_interface_init); static struct module_interface mixout_interface = { .init = mixout_init, @@ -928,3 +930,4 @@ static struct module_interface mixout_interface = { }; DECLARE_MODULE_ADAPTER(mixout_interface, mixout_uuid, mixout_tr); +SOF_MODULE_INIT(mixout, sys_comp_module_mixout_interface_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index bb5323d7ab2b..0d89623db649 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -183,11 +183,6 @@ static void sys_module_init(void) */ void sys_comp_host_init(void); -#if CONFIG_IPC_MAJOR_3 -void sys_comp_module_mixer_interface_init(void); -#else -void sys_comp_module_mixout_interface_init(void); -#endif void sys_comp_dai_init(void); void sys_comp_src_init(void); void sys_comp_mux_init(void); @@ -212,7 +207,6 @@ void sys_comp_basefw_init(void); void sys_comp_copier_init(void); void sys_comp_module_cadence_interface_init(void); void sys_comp_module_passthrough_interface_init(void); -void sys_comp_module_mixin_interface_init(void); void sys_comp_aria_init(void); void sys_comp_crossover_init(void); void sys_comp_drc_init(void); @@ -269,15 +263,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_MIXER)) { -#if CONFIG_IPC_MAJOR_3 - sys_comp_module_mixer_interface_init(); -#else - sys_comp_module_mixout_interface_init(); - sys_comp_module_mixin_interface_init(); -#endif - } - if (IS_ENABLED(CONFIG_COMP_DAI)) sys_comp_dai_init(); From b5e3709485928717df6bfc29083a8b43f297c7c4 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 14:37:51 +0100 Subject: [PATCH 05/37] dai: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register dai with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/dai-legacy.c | 2 ++ src/audio/dai-zephyr.c | 2 ++ zephyr/wrapper.c | 4 ---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/dai-legacy.c b/src/audio/dai-legacy.c index 2bea706278f2..c6a95d4f751e 100644 --- a/src/audio/dai-legacy.c +++ b/src/audio/dai-legacy.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1117,3 +1118,4 @@ UT_STATIC void sys_comp_dai_init(void) } DECLARE_MODULE(sys_comp_dai_init); +SOF_MODULE_INIT(dai, sys_comp_dai_init); diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index 10f9600b8bbc..c78d93c56670 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -1459,3 +1460,4 @@ UT_STATIC void sys_comp_dai_init(void) } DECLARE_MODULE(sys_comp_dai_init); +SOF_MODULE_INIT(dai, sys_comp_dai_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 0d89623db649..676c3ce716c2 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -183,7 +183,6 @@ static void sys_module_init(void) */ void sys_comp_host_init(void); -void sys_comp_dai_init(void); void sys_comp_src_init(void); void sys_comp_mux_init(void); void sys_comp_chain_dma_init(void); @@ -263,9 +262,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_DAI)) - sys_comp_dai_init(); - if (IS_ENABLED(CONFIG_COMP_SRC)) { #if CONFIG_IPC_MAJOR_3 sys_comp_src_init(); From 1c505af929b2311f2e21b65789126d569f08d31b Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 14:59:33 +0100 Subject: [PATCH 06/37] src: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register src with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/src/src.c | 3 +++ zephyr/wrapper.c | 11 ----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/audio/src/src.c b/src/audio/src/src.c index 7fe20b6520e6..3ee80cadba77 100644 --- a/src/audio/src/src.c +++ b/src/audio/src/src.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1044,6 +1045,7 @@ static struct module_interface src_interface = { }; DECLARE_MODULE_ADAPTER(src_interface, src_uuid, src_tr); +SOF_MODULE_INIT(src, sys_comp_module_src_interface_init); #elif CONFIG_IPC_MAJOR_3 static struct comp_dev *src_new(const struct comp_driver *drv, @@ -1255,6 +1257,7 @@ UT_STATIC void sys_comp_src_init(void) } DECLARE_MODULE(sys_comp_src_init); +SOF_MODULE_INIT(src, sys_comp_src_init); #else #error "No or invalid IPC MAJOR version selected." #endif diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 676c3ce716c2..53cc396614f1 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -183,14 +183,11 @@ static void sys_module_init(void) */ void sys_comp_host_init(void); -void sys_comp_src_init(void); void sys_comp_mux_init(void); void sys_comp_chain_dma_init(void); #if CONFIG_IPC_MAJOR_3 -void sys_comp_src_init(void); void sys_comp_selector_init(void); #else -void sys_comp_module_src_interface_init(void); void sys_comp_module_selector_interface_init(void); #endif void sys_comp_switch_init(void); @@ -262,14 +259,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_SRC)) { -#if CONFIG_IPC_MAJOR_3 - sys_comp_src_init(); -#else - sys_comp_module_src_interface_init(); -#endif - } - if (IS_ENABLED(CONFIG_COMP_SEL)) #if CONFIG_IPC_MAJOR_3 sys_comp_selector_init(); From 0ab9ea82c451346ea23eeb82d5326f486f6f967b Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 15:40:39 +0100 Subject: [PATCH 07/37] chain-dma: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register chain-dma with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/chain_dma.c | 2 ++ zephyr/wrapper.c | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/audio/chain_dma.c b/src/audio/chain_dma.c index f815b7c6b4f0..f6728e5ec3bc 100644 --- a/src/audio/chain_dma.c +++ b/src/audio/chain_dma.c @@ -23,6 +23,7 @@ #include #include #include +#include static const struct comp_driver comp_chain_dma; static const uint32_t max_chain_number = DAI_NUM_HDA_OUT + DAI_NUM_HDA_IN; @@ -653,3 +654,4 @@ UT_STATIC void sys_comp_chain_dma_init(void) } DECLARE_MODULE(sys_comp_chain_dma_init); +SOF_MODULE_INIT(chain_dma, sys_comp_chain_dma_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 53cc396614f1..e1c86316180d 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -184,7 +184,6 @@ static void sys_module_init(void) void sys_comp_host_init(void); void sys_comp_mux_init(void); -void sys_comp_chain_dma_init(void); #if CONFIG_IPC_MAJOR_3 void sys_comp_selector_init(void); #else @@ -348,10 +347,6 @@ int start_complete(void) sys_comp_probe_init(); #endif - /* init chain dma manager*/ - if (IS_ENABLED(CONFIG_COMP_CHAIN_DMA)) - sys_comp_chain_dma_init(); - #if defined(CONFIG_IMX) #define SOF_IPC_QUEUED_DOMAIN SOF_SCHEDULE_LL_DMA #else From 71ec0b422d9458a3cf188b1823f8ad531106db60 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 15:08:55 +0100 Subject: [PATCH 08/37] selector: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register selector with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/selector/selector.c | 3 +++ zephyr/wrapper.c | 11 ----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/audio/selector/selector.c b/src/audio/selector/selector.c index 3fa168ff7ef3..59be98a28427 100644 --- a/src/audio/selector/selector.c +++ b/src/audio/selector/selector.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -571,6 +572,7 @@ UT_STATIC void sys_comp_selector_init(void) } DECLARE_MODULE(sys_comp_selector_init); +SOF_MODULE_INIT(selector, sys_comp_selector_init); #else static void build_config(struct comp_data *cd, struct module_config *cfg) { @@ -957,4 +959,5 @@ static struct module_interface selector_interface = { }; DECLARE_MODULE_ADAPTER(selector_interface, selector_uuid, selector_tr); +SOF_MODULE_INIT(selector, sys_comp_module_selector_interface_init); #endif diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index e1c86316180d..53119283d76a 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -184,11 +184,6 @@ static void sys_module_init(void) void sys_comp_host_init(void); void sys_comp_mux_init(void); -#if CONFIG_IPC_MAJOR_3 -void sys_comp_selector_init(void); -#else -void sys_comp_module_selector_interface_init(void); -#endif void sys_comp_switch_init(void); void sys_comp_tone_init(void); void sys_comp_module_eq_fir_interface_init(void); @@ -258,12 +253,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_SEL)) -#if CONFIG_IPC_MAJOR_3 - sys_comp_selector_init(); -#else - sys_comp_module_selector_interface_init(); -#endif if (IS_ENABLED(CONFIG_COMP_SWITCH)) sys_comp_switch_init(); From a63ed1bdb14f5d5acef781e69df4e9de6a851002 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 15:19:50 +0100 Subject: [PATCH 09/37] switch: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register switch with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/switch.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/switch.c b/src/audio/switch.c index 447e59f52fc4..10cb6a7e1460 100644 --- a/src/audio/switch.c +++ b/src/audio/switch.c @@ -13,6 +13,7 @@ #include #include #include +#include static const struct comp_driver comp_switch; @@ -94,3 +95,4 @@ UT_STATIC void sys_comp_switch_init(void) } DECLARE_MODULE(sys_comp_switch_init); +SOF_MODULE_INIT(switch, sys_comp_switch_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 53119283d76a..cf2d5862ea96 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -184,7 +184,6 @@ static void sys_module_init(void) void sys_comp_host_init(void); void sys_comp_mux_init(void); -void sys_comp_switch_init(void); void sys_comp_tone_init(void); void sys_comp_module_eq_fir_interface_init(void); void sys_comp_keyword_init(void); @@ -253,9 +252,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_SWITCH)) - sys_comp_switch_init(); - if (IS_ENABLED(CONFIG_COMP_TONE)) sys_comp_tone_init(); From 8080a729811bddf9cdb4092a9c7f46dd6d48db29 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 15:25:13 +0100 Subject: [PATCH 10/37] tone: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register tone with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/tone.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/tone.c b/src/audio/tone.c index 21b52e0b7cec..9ec639a00d01 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -745,3 +746,4 @@ UT_STATIC void sys_comp_tone_init(void) } DECLARE_MODULE(sys_comp_tone_init); +SOF_MODULE_INIT(tone, sys_comp_tone_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index cf2d5862ea96..5bfeb911b964 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -184,7 +184,6 @@ static void sys_module_init(void) void sys_comp_host_init(void); void sys_comp_mux_init(void); -void sys_comp_tone_init(void); void sys_comp_module_eq_fir_interface_init(void); void sys_comp_keyword_init(void); void sys_comp_asrc_init(void); @@ -252,9 +251,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_TONE)) - sys_comp_tone_init(); - if (IS_ENABLED(CONFIG_COMP_FIR)) sys_comp_module_eq_fir_interface_init(); From 04130ea58aa2c4b617f71bfb7ecc9c0e6dc4974f Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 15:44:09 +0100 Subject: [PATCH 11/37] eq-fir: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register eq-fir with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/eq_fir/eq_fir.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/eq_fir/eq_fir.c b/src/audio/eq_fir/eq_fir.c index 56aa252c6785..37d88ce662f3 100644 --- a/src/audio/eq_fir/eq_fir.c +++ b/src/audio/eq_fir/eq_fir.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -544,3 +545,4 @@ static struct module_interface eq_fir_interface = { }; DECLARE_MODULE_ADAPTER(eq_fir_interface, eq_fir_uuid, eq_fir_tr); +SOF_MODULE_INIT(eq_fir, sys_comp_module_eq_fir_interface_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 5bfeb911b964..7ab3245b1184 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -184,7 +184,6 @@ static void sys_module_init(void) void sys_comp_host_init(void); void sys_comp_mux_init(void); -void sys_comp_module_eq_fir_interface_init(void); void sys_comp_keyword_init(void); void sys_comp_asrc_init(void); void sys_comp_dcblock_init(void); @@ -251,9 +250,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_FIR)) - sys_comp_module_eq_fir_interface_init(); - if (IS_ENABLED(CONFIG_COMP_IIR)) sys_comp_eq_iir_init(); From 41deb550f3545488b035de44ec3eb588cb401244 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 15:51:27 +0100 Subject: [PATCH 12/37] eq-iir: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register eq-iir with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/eq_iir/eq_iir.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/eq_iir/eq_iir.c b/src/audio/eq_iir/eq_iir.c index 2ce92315ce57..2677f32d94eb 100644 --- a/src/audio/eq_iir/eq_iir.c +++ b/src/audio/eq_iir/eq_iir.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -993,3 +994,4 @@ UT_STATIC void sys_comp_eq_iir_init(void) } DECLARE_MODULE(sys_comp_eq_iir_init); +SOF_MODULE_INIT(eq_iir, sys_comp_eq_iir_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 7ab3245b1184..818184b92972 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -187,7 +187,6 @@ void sys_comp_mux_init(void); void sys_comp_keyword_init(void); void sys_comp_asrc_init(void); void sys_comp_dcblock_init(void); -void sys_comp_eq_iir_init(void); void sys_comp_kpb_init(void); void sys_comp_smart_amp_init(void); void sys_comp_basefw_init(void); @@ -250,9 +249,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_IIR)) - sys_comp_eq_iir_init(); - if (IS_ENABLED(CONFIG_SAMPLE_KEYPHRASE)) sys_comp_keyword_init(); From 244c02ad227c9377e3db39217de70fc162faea0d Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 16:03:40 +0100 Subject: [PATCH 13/37] keyword: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register keyword with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/samples/audio/detect_test.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/samples/audio/detect_test.c b/src/samples/audio/detect_test.c index 33dfd3106ac4..ac6fad55750b 100644 --- a/src/samples/audio/detect_test.c +++ b/src/samples/audio/detect_test.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1021,3 +1022,4 @@ UT_STATIC void sys_comp_keyword_init(void) } DECLARE_MODULE(sys_comp_keyword_init); +SOF_MODULE_INIT(keyword, sys_comp_keyword_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 818184b92972..44e3a41a6f20 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -184,7 +184,6 @@ static void sys_module_init(void) void sys_comp_host_init(void); void sys_comp_mux_init(void); -void sys_comp_keyword_init(void); void sys_comp_asrc_init(void); void sys_comp_dcblock_init(void); void sys_comp_kpb_init(void); @@ -249,9 +248,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_SAMPLE_KEYPHRASE)) - sys_comp_keyword_init(); - if (IS_ENABLED(CONFIG_COMP_KPB)) sys_comp_kpb_init(); From b3e3eaacbaa02feb70c00ed8987c01aa8375976d Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 16:09:56 +0100 Subject: [PATCH 14/37] host: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register host with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/host-legacy.c | 2 ++ src/audio/host-zephyr.c | 2 ++ zephyr/wrapper.c | 4 ---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/host-legacy.c b/src/audio/host-legacy.c index 788941aa2b9f..c5c01ebf762a 100644 --- a/src/audio/host-legacy.c +++ b/src/audio/host-legacy.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1101,3 +1102,4 @@ UT_STATIC void sys_comp_host_init(void) } DECLARE_MODULE(sys_comp_host_init); +SOF_MODULE_INIT(host, sys_comp_host_init); diff --git a/src/audio/host-zephyr.c b/src/audio/host-zephyr.c index 34ea724b00aa..b15e1d4b6a59 100644 --- a/src/audio/host-zephyr.c +++ b/src/audio/host-zephyr.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1174,3 +1175,4 @@ UT_STATIC void sys_comp_host_init(void) } DECLARE_MODULE(sys_comp_host_init); +SOF_MODULE_INIT(host, sys_comp_host_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 44e3a41a6f20..79e4cdf3bbf2 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_host_init(void); void sys_comp_mux_init(void); void sys_comp_asrc_init(void); void sys_comp_dcblock_init(void); @@ -237,9 +236,6 @@ int task_main_start(struct sof *sof) /* init self-registered modules */ sys_module_init(); - /* host is mandatory */ - sys_comp_host_init(); - /* init pipeline position offsets */ pipeline_posn_init(sof); From eb589e76226859af5f6812940c4286b6be5eeb33 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 16:18:12 +0100 Subject: [PATCH 15/37] kpb: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register kpb with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/kpb.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/kpb.c b/src/audio/kpb.c index 00f12d338d44..7639b58f3704 100644 --- a/src/audio/kpb.c +++ b/src/audio/kpb.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1886,3 +1887,4 @@ UT_STATIC void sys_comp_kpb_init(void) } DECLARE_MODULE(sys_comp_kpb_init); +SOF_MODULE_INIT(kpb, sys_comp_kpb_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 79e4cdf3bbf2..40687b2ec09c 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -185,7 +185,6 @@ static void sys_module_init(void) void sys_comp_mux_init(void); void sys_comp_asrc_init(void); void sys_comp_dcblock_init(void); -void sys_comp_kpb_init(void); void sys_comp_smart_amp_init(void); void sys_comp_basefw_init(void); void sys_comp_copier_init(void); @@ -244,9 +243,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_KPB)) - sys_comp_kpb_init(); - if (IS_ENABLED(CONFIG_SAMPLE_SMART_AMP) || IS_ENABLED(CONFIG_MAXIM_DSM)) sys_comp_smart_amp_init(); From f325b9c0a4423b8b0e8814e8efc481247439364d Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 16:21:45 +0100 Subject: [PATCH 16/37] smart-amp: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register smart-amp with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/smart_amp/smart_amp.c | 2 ++ zephyr/wrapper.c | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/audio/smart_amp/smart_amp.c b/src/audio/smart_amp/smart_amp.c index ee9a885bfdf7..bc15b350a392 100644 --- a/src/audio/smart_amp/smart_amp.c +++ b/src/audio/smart_amp/smart_amp.c @@ -4,6 +4,7 @@ // // Author: Ryan Lee +#include #include #include #include @@ -782,3 +783,4 @@ UT_STATIC void sys_comp_smart_amp_init(void) } DECLARE_MODULE(sys_comp_smart_amp_init); +SOF_MODULE_INIT(smart_amp, sys_comp_smart_amp_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 40687b2ec09c..3c98f0bf2519 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -185,7 +185,6 @@ static void sys_module_init(void) void sys_comp_mux_init(void); void sys_comp_asrc_init(void); void sys_comp_dcblock_init(void); -void sys_comp_smart_amp_init(void); void sys_comp_basefw_init(void); void sys_comp_copier_init(void); void sys_comp_module_cadence_interface_init(void); @@ -243,10 +242,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_SAMPLE_SMART_AMP) || - IS_ENABLED(CONFIG_MAXIM_DSM)) - sys_comp_smart_amp_init(); - if (IS_ENABLED(CONFIG_COMP_ASRC)) sys_comp_asrc_init(); From cef87564b8a6780ad2bc82651eb4e9ab5c6454f6 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 16:26:07 +0100 Subject: [PATCH 17/37] asrc: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register asrc with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/asrc/asrc.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/asrc/asrc.c b/src/audio/asrc/asrc.c index c50acc3e79a1..0f006dcdd02e 100644 --- a/src/audio/asrc/asrc.c +++ b/src/audio/asrc/asrc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1106,3 +1107,4 @@ UT_STATIC void sys_comp_asrc_init(void) } DECLARE_MODULE(sys_comp_asrc_init); +SOF_MODULE_INIT(asrc, sys_comp_asrc_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 3c98f0bf2519..2e33852ddc91 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -183,7 +183,6 @@ static void sys_module_init(void) */ void sys_comp_mux_init(void); -void sys_comp_asrc_init(void); void sys_comp_dcblock_init(void); void sys_comp_basefw_init(void); void sys_comp_copier_init(void); @@ -242,9 +241,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_ASRC)) - sys_comp_asrc_init(); - if (IS_ENABLED(CONFIG_COMP_DCBLOCK)) sys_comp_dcblock_init(); From fbe6cc6a478a7aaf4c5d7b94b93e6c3f9c8bd535 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 16:33:00 +0100 Subject: [PATCH 18/37] dcblock: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register dcblock with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/dcblock/dcblock.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/dcblock/dcblock.c b/src/audio/dcblock/dcblock.c index 15538796ca1d..38908fc9d6c2 100644 --- a/src/audio/dcblock/dcblock.c +++ b/src/audio/dcblock/dcblock.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -431,3 +432,4 @@ UT_STATIC void sys_comp_dcblock_init(void) } DECLARE_MODULE(sys_comp_dcblock_init); +SOF_MODULE_INIT(dcblock, sys_comp_dcblock_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 2e33852ddc91..4c58a2d0f077 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -183,7 +183,6 @@ static void sys_module_init(void) */ void sys_comp_mux_init(void); -void sys_comp_dcblock_init(void); void sys_comp_basefw_init(void); void sys_comp_copier_init(void); void sys_comp_module_cadence_interface_init(void); @@ -241,9 +240,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_DCBLOCK)) - sys_comp_dcblock_init(); - if (IS_ENABLED(CONFIG_COMP_MUX)) sys_comp_mux_init(); From 6a1b71399ac4271236e5b24adb5654d522a88119 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 Jan 2023 16:42:44 +0100 Subject: [PATCH 19/37] mux: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register mux with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/mux/mux.c | 4 ++-- zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/audio/mux/mux.c b/src/audio/mux/mux.c index 5d00425d73af..fe5f2eb95f7d 100644 --- a/src/audio/mux/mux.c +++ b/src/audio/mux/mux.c @@ -5,8 +5,6 @@ // Author: Liam Girdwood // Artur Kloniecki - - #if CONFIG_COMP_MUX #include @@ -15,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1012,5 +1011,6 @@ UT_STATIC void sys_comp_mux_init(void) } DECLARE_MODULE(sys_comp_mux_init); +SOF_MODULE_INIT(mux, sys_comp_mux_init); #endif /* CONFIG_COMP_MUX */ diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 4c58a2d0f077..aa82b3dc27e3 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_mux_init(void); void sys_comp_basefw_init(void); void sys_comp_copier_init(void); void sys_comp_module_cadence_interface_init(void); @@ -240,9 +239,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_MUX)) - sys_comp_mux_init(); - if (IS_ENABLED(CONFIG_COMP_BASEFW_IPC4)) sys_comp_basefw_init(); From 1c5eda44d33aa56e0f92ec2bc77e4087976970a8 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 12:52:44 +0100 Subject: [PATCH 20/37] basefw: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register basefw with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/base_fw.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/base_fw.c b/src/audio/base_fw.c index be7f6a03d0c0..0531e7a60b68 100644 --- a/src/audio/base_fw.c +++ b/src/audio/base_fw.c @@ -10,6 +10,7 @@ #include #include #include +#include #if CONFIG_ACE_V1X_ART_COUNTER || CONFIG_ACE_V1X_RTC_COUNTER #include @@ -495,3 +496,4 @@ UT_STATIC void sys_comp_basefw_init(void) } DECLARE_MODULE(sys_comp_basefw_init); +SOF_MODULE_INIT(basefw, sys_comp_basefw_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index aa82b3dc27e3..91c96dccbdbf 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_basefw_init(void); void sys_comp_copier_init(void); void sys_comp_module_cadence_interface_init(void); void sys_comp_module_passthrough_interface_init(void); @@ -239,9 +238,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_BASEFW_IPC4)) - sys_comp_basefw_init(); - if (IS_ENABLED(CONFIG_COMP_COPIER)) sys_comp_copier_init(); From 4f0a474ea41542ed37c029b1cf74f36c978d5b1e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 12:54:48 +0100 Subject: [PATCH 21/37] copier: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register copier with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/copier/copier.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/copier/copier.c b/src/audio/copier/copier.c index 17deceb5e081..e239aa5503d8 100644 --- a/src/audio/copier/copier.c +++ b/src/audio/copier/copier.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1565,3 +1566,4 @@ UT_STATIC void sys_comp_copier_init(void) } DECLARE_MODULE(sys_comp_copier_init); +SOF_MODULE_INIT(copier, sys_comp_copier_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 91c96dccbdbf..030613f4213f 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_copier_init(void); void sys_comp_module_cadence_interface_init(void); void sys_comp_module_passthrough_interface_init(void); void sys_comp_aria_init(void); @@ -238,9 +237,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_COPIER)) - sys_comp_copier_init(); - if (IS_ENABLED(CONFIG_CADENCE_CODEC)) sys_comp_module_cadence_interface_init(); From ab185799e97bcbfe6da3bbc67f89b595605eb397 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 12:57:30 +0100 Subject: [PATCH 22/37] cadence: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register cadence with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module/cadence.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/module_adapter/module/cadence.c b/src/audio/module_adapter/module/cadence.c index f2c092b1d429..d3e4259eaa7e 100644 --- a/src/audio/module_adapter/module/cadence.c +++ b/src/audio/module_adapter/module/cadence.c @@ -14,6 +14,7 @@ #include #include #include +#include /* d8218443-5ff3-4a4c-b388-6cfe07b956aa */ DECLARE_SOF_RT_UUID("cadence_codec", cadence_uuid, 0xd8218443, 0x5ff3, 0x4a4c, @@ -749,3 +750,4 @@ static struct module_interface cadence_interface = { }; DECLARE_MODULE_ADAPTER(cadence_interface, cadence_uuid, cadence_tr); +SOF_MODULE_INIT(cadence, sys_comp_module_cadence_interface_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 030613f4213f..9c0747354406 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_module_cadence_interface_init(void); void sys_comp_module_passthrough_interface_init(void); void sys_comp_aria_init(void); void sys_comp_crossover_init(void); @@ -237,9 +236,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_CADENCE_CODEC)) - sys_comp_module_cadence_interface_init(); - if (IS_ENABLED(CONFIG_PASSTHROUGH_CODEC)) sys_comp_module_passthrough_interface_init(); From c6c3735c56d8d558f15e3bee56303ee1ad59e232 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 13:04:56 +0100 Subject: [PATCH 23/37] passthrough: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register passthrough with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module/passthrough.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/module_adapter/module/passthrough.c b/src/audio/module_adapter/module/passthrough.c index 79ea8c9c6852..05d22eba5598 100644 --- a/src/audio/module_adapter/module/passthrough.c +++ b/src/audio/module_adapter/module/passthrough.c @@ -7,6 +7,7 @@ // Passthrough codec implementation to demonstrate Codec Adapter API #include +#include /* 376b5e44-9c82-4ec2-bc83-10ea101afa8f */ DECLARE_SOF_RT_UUID("passthrough_codec", passthrough_uuid, 0x376b5e44, 0x9c82, 0x4ec2, @@ -122,3 +123,4 @@ static struct module_interface passthrough_interface = { }; DECLARE_MODULE_ADAPTER(passthrough_interface, passthrough_uuid, passthrough_tr); +SOF_MODULE_INIT(passthrough, sys_comp_module_passthrough_interface_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 9c0747354406..13bd9ab1e783 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_module_passthrough_interface_init(void); void sys_comp_aria_init(void); void sys_comp_crossover_init(void); void sys_comp_drc_init(void); @@ -236,9 +235,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_PASSTHROUGH_CODEC)) - sys_comp_module_passthrough_interface_init(); - if (IS_ENABLED(CONFIG_COMP_ARIA)) sys_comp_aria_init(); From 01ea2dc5e69176ba438721545d27a298dc737a84 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 13:57:55 +0100 Subject: [PATCH 24/37] aria: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register aria with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/aria/aria.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/aria/aria.c b/src/audio/aria/aria.c index 52e3620c4f37..78d569912491 100644 --- a/src/audio/aria/aria.c +++ b/src/audio/aria/aria.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -378,3 +379,4 @@ UT_STATIC void sys_comp_aria_init(void) } DECLARE_MODULE(sys_comp_aria_init); +SOF_MODULE_INIT(aria, sys_comp_aria_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 13bd9ab1e783..235116c3dac0 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_aria_init(void); void sys_comp_crossover_init(void); void sys_comp_drc_init(void); void sys_comp_multiband_drc_init(void); @@ -235,9 +234,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_ARIA)) - sys_comp_aria_init(); - if (IS_ENABLED(CONFIG_COMP_CROSSOVER)) sys_comp_crossover_init(); From dadc152d22e86934a14724237d7e3bff918a417d Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:02:46 +0100 Subject: [PATCH 25/37] crossover: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register crossover with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/crossover/crossover.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/crossover/crossover.c b/src/audio/crossover/crossover.c index 7cc2d52c2f35..128499f8496d 100644 --- a/src/audio/crossover/crossover.c +++ b/src/audio/crossover/crossover.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -852,3 +853,4 @@ UT_STATIC void sys_comp_crossover_init(void) } DECLARE_MODULE(sys_comp_crossover_init); +SOF_MODULE_INIT(crossover, sys_comp_crossover_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 235116c3dac0..540a939a8d91 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_crossover_init(void); void sys_comp_drc_init(void); void sys_comp_multiband_drc_init(void); void sys_comp_google_rtc_audio_processing_init(void); @@ -234,9 +233,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_CROSSOVER)) - sys_comp_crossover_init(); - if (IS_ENABLED(CONFIG_COMP_DRC)) sys_comp_drc_init(); From 351c54bc3b6c08c74ceb0aa85156447599b4b60e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:04:52 +0100 Subject: [PATCH 26/37] drc: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register drc with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/drc/drc.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/drc/drc.c b/src/audio/drc/drc.c index e6fb651ca17a..3aafa2bf3a13 100644 --- a/src/audio/drc/drc.c +++ b/src/audio/drc/drc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -486,3 +487,4 @@ UT_STATIC void sys_comp_drc_init(void) } DECLARE_MODULE(sys_comp_drc_init); +SOF_MODULE_INIT(drc, sys_comp_drc_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 540a939a8d91..0bf2215c01ca 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_drc_init(void); void sys_comp_multiband_drc_init(void); void sys_comp_google_rtc_audio_processing_init(void); void sys_comp_igo_nr_init(void); @@ -233,9 +232,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_DRC)) - sys_comp_drc_init(); - if (IS_ENABLED(CONFIG_COMP_MULTIBAND_DRC)) sys_comp_multiband_drc_init(); From b5fb4a6d0faa3c36e43b431c007bda67737ad356 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:07:21 +0100 Subject: [PATCH 27/37] multiband-drc: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register multiband-drc with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/multiband_drc/multiband_drc.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/multiband_drc/multiband_drc.c b/src/audio/multiband_drc/multiband_drc.c index edadf4f6219a..44918957cbe1 100644 --- a/src/audio/multiband_drc/multiband_drc.c +++ b/src/audio/multiband_drc/multiband_drc.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -643,3 +644,4 @@ UT_STATIC void sys_comp_multiband_drc_init(void) } DECLARE_MODULE(sys_comp_multiband_drc_init); +SOF_MODULE_INIT(multiband_drc, sys_comp_multiband_drc_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 0bf2215c01ca..b4ddba852ea2 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_multiband_drc_init(void); void sys_comp_google_rtc_audio_processing_init(void); void sys_comp_igo_nr_init(void); void sys_comp_rtnr_init(void); @@ -232,9 +231,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_MULTIBAND_DRC)) - sys_comp_multiband_drc_init(); - if (IS_ENABLED(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING)) sys_comp_google_rtc_audio_processing_init(); From ed41ed9419dd5c3c5596fd98ab012b1623b845f9 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:11:27 +0100 Subject: [PATCH 28/37] google-rtc: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register google-rtc with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/google/google_rtc_audio_processing.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/google/google_rtc_audio_processing.c b/src/audio/google/google_rtc_audio_processing.c index a88a1b070da2..f7fdb4b9f6fe 100644 --- a/src/audio/google/google_rtc_audio_processing.c +++ b/src/audio/google/google_rtc_audio_processing.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -690,3 +691,4 @@ UT_STATIC void sys_comp_google_rtc_audio_processing_init(void) } DECLARE_MODULE(sys_comp_google_rtc_audio_processing_init); +SOF_MODULE_INIT(google_rtc_audio_processing, sys_comp_google_rtc_audio_processing_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index b4ddba852ea2..751c6e2c15c1 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_google_rtc_audio_processing_init(void); void sys_comp_igo_nr_init(void); void sys_comp_rtnr_init(void); void sys_comp_module_up_down_mixer_interface_init(void); @@ -231,9 +230,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING)) - sys_comp_google_rtc_audio_processing_init(); - if (IS_ENABLED(CONFIG_COMP_IGO_NR)) sys_comp_igo_nr_init(); From 7b15828eacea487ebc3cf1ae11886ecb441ad141 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:14:27 +0100 Subject: [PATCH 29/37] igo-nr: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register igo-nr with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/igo_nr/igo_nr.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/igo_nr/igo_nr.c b/src/audio/igo_nr/igo_nr.c index 73f44b171280..bf2b63dc9852 100755 --- a/src/audio/igo_nr/igo_nr.c +++ b/src/audio/igo_nr/igo_nr.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -853,3 +854,4 @@ UT_STATIC void sys_comp_igo_nr_init(void) } DECLARE_MODULE(sys_comp_igo_nr_init); +SOF_MODULE_INIT(igo_nr, sys_comp_igo_nr_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 751c6e2c15c1..f877d17c66d5 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_igo_nr_init(void); void sys_comp_rtnr_init(void); void sys_comp_module_up_down_mixer_interface_init(void); void sys_comp_tdfb_init(void); @@ -230,9 +229,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_IGO_NR)) - sys_comp_igo_nr_init(); - if (IS_ENABLED(CONFIG_COMP_RTNR)) sys_comp_rtnr_init(); From 8a638cac355512a9ce164e0273e942cebc2ef22f Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:16:34 +0100 Subject: [PATCH 30/37] rtnr: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register rtnr with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/rtnr/rtnr.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/rtnr/rtnr.c b/src/audio/rtnr/rtnr.c index 1c61125a1f5d..4b49f7c1a891 100644 --- a/src/audio/rtnr/rtnr.c +++ b/src/audio/rtnr/rtnr.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -938,3 +939,4 @@ UT_STATIC void sys_comp_rtnr_init(void) DECLARE_MODULE(sys_comp_rtnr_init); +SOF_MODULE_INIT(rtnr, sys_comp_rtnr_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index f877d17c66d5..1b897663d3e3 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_rtnr_init(void); void sys_comp_module_up_down_mixer_interface_init(void); void sys_comp_tdfb_init(void); void sys_comp_ghd_init(void); @@ -229,9 +228,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_RTNR)) - sys_comp_rtnr_init(); - if (IS_ENABLED(CONFIG_COMP_UP_DOWN_MIXER)) sys_comp_module_up_down_mixer_interface_init(); From a3d522f28fdd6119d94dd563bf415811ac6da537 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:18:13 +0100 Subject: [PATCH 31/37] up-down-mixer: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register up-down-mixer with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/up_down_mixer/up_down_mixer.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/up_down_mixer/up_down_mixer.c b/src/audio/up_down_mixer/up_down_mixer.c index 5766d558c86d..e90e7729b7a2 100644 --- a/src/audio/up_down_mixer/up_down_mixer.c +++ b/src/audio/up_down_mixer/up_down_mixer.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -463,3 +464,4 @@ static struct module_interface up_down_mixer_interface = { }; DECLARE_MODULE_ADAPTER(up_down_mixer_interface, up_down_mixer_comp_uuid, up_down_mixer_comp_tr); +SOF_MODULE_INIT(up_down_mixer, sys_comp_module_up_down_mixer_interface_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 1b897663d3e3..884cf8721342 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_module_up_down_mixer_interface_init(void); void sys_comp_tdfb_init(void); void sys_comp_ghd_init(void); void sys_comp_module_dts_interface_init(void); @@ -228,9 +227,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_UP_DOWN_MIXER)) - sys_comp_module_up_down_mixer_interface_init(); - if (IS_ENABLED(CONFIG_COMP_TDFB)) sys_comp_tdfb_init(); From 64748f08f32e525fedbde2f5bb54ba8c290ea8f9 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:19:54 +0100 Subject: [PATCH 32/37] tdfb: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register tdfb with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/tdfb/tdfb.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/tdfb/tdfb.c b/src/audio/tdfb/tdfb.c index eb6cf1aebbcc..d27e1b050670 100644 --- a/src/audio/tdfb/tdfb.c +++ b/src/audio/tdfb/tdfb.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -905,3 +906,4 @@ UT_STATIC void sys_comp_tdfb_init(void) } DECLARE_MODULE(sys_comp_tdfb_init); +SOF_MODULE_INIT(tdfb, sys_comp_tdfb_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 884cf8721342..dfb16eed10ae 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_tdfb_init(void); void sys_comp_ghd_init(void); void sys_comp_module_dts_interface_init(void); void sys_comp_module_waves_interface_init(void); @@ -227,9 +226,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_TDFB)) - sys_comp_tdfb_init(); - if (IS_ENABLED(CONFIG_COMP_GOOGLE_HOTWORD_DETECT)) sys_comp_ghd_init(); From 2326b394e7b14991ca8f25b901e2cde04f6ef43a Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:27:30 +0100 Subject: [PATCH 33/37] google-hotword: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register google-hotword with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/google/google_hotword_detect.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/google/google_hotword_detect.c b/src/audio/google/google_hotword_detect.c index c5664c1e45be..1713453a3314 100644 --- a/src/audio/google/google_hotword_detect.c +++ b/src/audio/google/google_hotword_detect.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -484,3 +485,4 @@ UT_STATIC void sys_comp_ghd_init(void) } DECLARE_MODULE(sys_comp_ghd_init); +SOF_MODULE_INIT(ghd, sys_comp_ghd_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index dfb16eed10ae..5f97b6539da9 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_ghd_init(void); void sys_comp_module_dts_interface_init(void); void sys_comp_module_waves_interface_init(void); #if CONFIG_IPC_MAJOR_4 @@ -226,9 +225,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_COMP_GOOGLE_HOTWORD_DETECT)) - sys_comp_ghd_init(); - if (IS_ENABLED(CONFIG_DTS_CODEC)) sys_comp_module_dts_interface_init(); From ae21eb3fabb4f9ee57db390290881f08fb2f7282 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:30:00 +0100 Subject: [PATCH 34/37] dts: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register dts with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module/dts.c | 2 ++ zephyr/wrapper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio/module_adapter/module/dts.c b/src/audio/module_adapter/module/dts.c index 6167220cef09..28840c342918 100644 --- a/src/audio/module_adapter/module/dts.c +++ b/src/audio/module_adapter/module/dts.c @@ -5,6 +5,7 @@ // Author: Mark Barton #include "sof/audio/module_adapter/module/generic.h" +#include #include "DtsSofInterface.h" @@ -462,3 +463,4 @@ static struct module_interface dts_interface = { }; DECLARE_MODULE_ADAPTER(dts_interface, dts_uuid, dts_tr); +SOF_MODULE_INIT(dts, sys_comp_module_dts_interface_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 5f97b6539da9..4ec50097829c 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_module_dts_interface_init(void); void sys_comp_module_waves_interface_init(void); #if CONFIG_IPC_MAJOR_4 void sys_comp_probe_init(void); @@ -225,9 +224,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_DTS_CODEC)) - sys_comp_module_dts_interface_init(); - if (IS_ENABLED(CONFIG_WAVES_CODEC)) sys_comp_module_waves_interface_init(); #if CONFIG_IPC_MAJOR_4 From 50b482728f0b6c7c253c484960a31a9b001d2a58 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:32:34 +0100 Subject: [PATCH 35/37] waves: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register waves with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module/waves.c | 2 ++ zephyr/wrapper.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/audio/module_adapter/module/waves.c b/src/audio/module_adapter/module/waves.c index 46d3ac93b31c..c57cd50a2989 100644 --- a/src/audio/module_adapter/module/waves.c +++ b/src/audio/module_adapter/module/waves.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "MaxxEffect/MaxxEffect.h" #include "MaxxEffect/MaxxStream.h" @@ -889,3 +890,4 @@ static struct module_interface waves_interface = { }; DECLARE_MODULE_ADAPTER(waves_interface, waves_uuid, waves_tr); +SOF_MODULE_INIT(waves, sys_comp_module_waves_interface_init); diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 4ec50097829c..8794dd16a8f1 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -182,7 +182,6 @@ static void sys_module_init(void) * constructors directly atm. */ -void sys_comp_module_waves_interface_init(void); #if CONFIG_IPC_MAJOR_4 void sys_comp_probe_init(void); #endif @@ -224,8 +223,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { - if (IS_ENABLED(CONFIG_WAVES_CODEC)) - sys_comp_module_waves_interface_init(); #if CONFIG_IPC_MAJOR_4 if (IS_ENABLED(CONFIG_PROBE)) sys_comp_probe_init(); From aa1816f043c36d71822b31122c97374a0feb776e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:36:48 +0100 Subject: [PATCH 36/37] probe: convert to Zephyr native initialisation Use SOF_MODULE_INIT() to register probe with the Zephyr initialisation framework. Signed-off-by: Guennadi Liakhovetski --- src/probe/probe.c | 2 ++ zephyr/wrapper.c | 15 --------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/probe/probe.c b/src/probe/probe.c index 5289936ab230..177624959533 100644 --- a/src/probe/probe.c +++ b/src/probe/probe.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1442,4 +1443,5 @@ UT_STATIC void sys_comp_probe_init(void) } DECLARE_MODULE(sys_comp_probe_init); +SOF_MODULE_INIT(probe, sys_comp_probe_init); #endif diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 8794dd16a8f1..695d128a6326 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -176,16 +176,6 @@ static void sys_module_init(void) #endif } -/* - * TODO: all the audio processing components/modules constructor should be - * linked to the module_init section, but this is not happening. Just call - * constructors directly atm. - */ - -#if CONFIG_IPC_MAJOR_4 -void sys_comp_probe_init(void); -#endif - /* Zephyr redefines log_message() and mtrace_printf() which leaves * totally empty the .static_log_entries ELF sections for the * sof-logger. This makes smex fail. Define at least one such section to @@ -223,11 +213,6 @@ int task_main_start(struct sof *sof) int start_complete(void) { -#if CONFIG_IPC_MAJOR_4 - if (IS_ENABLED(CONFIG_PROBE)) - sys_comp_probe_init(); -#endif - #if defined(CONFIG_IMX) #define SOF_IPC_QUEUED_DOMAIN SOF_SCHEDULE_LL_DMA #else From 4bb3ec84d64ee99820d59fecf4e721b57258b35e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 25 Jan 2023 14:43:03 +0100 Subject: [PATCH 37/37] zephyr: remove unused module initialisation All SOF modules are now initialised using native Zephyr APIs, no need any more in a dedicated ELF section. TODO: remove from linker scripts once this is merged. Signed-off-by: Guennadi Liakhovetski --- zephyr/wrapper.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 695d128a6326..be4c312c8934 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -153,29 +153,6 @@ unsigned int _xtos_ints_off(unsigned int mask) return 0; } -/* - * Audio components. - * - * Integrated except for linkage so symbols are "used" here until linker - * support is ready in Zephyr. TODO: fix component linkage in Zephyr. - */ - -/* TODO: this is not yet working with Zephyr - section has been created but - * no symbols are being loaded into ELF file. - */ -extern intptr_t _module_init_start; -extern intptr_t _module_init_end; - -static void sys_module_init(void) -{ -#if !CONFIG_LIBRARY - intptr_t *module_init = (intptr_t *)(&_module_init_start); - - for (; module_init < (intptr_t *)&_module_init_end; ++module_init) - ((void(*)(void))(*module_init))(); -#endif -} - /* Zephyr redefines log_message() and mtrace_printf() which leaves * totally empty the .static_log_entries ELF sections for the * sof-logger. This makes smex fail. Define at least one such section to @@ -202,9 +179,6 @@ int task_main_start(struct sof *sof) /* init default audio components */ sys_comp_init(sof); - /* init self-registered modules */ - sys_module_init(); - /* init pipeline position offsets */ pipeline_posn_init(sof);