@@ -39,6 +39,9 @@ struct smart_amp_data {
3939 uint32_t out_channels ;
4040};
4141
42+ /* When building as a loadable module, we need .bss to avoid rimage errors */
43+ static int keep_bss __attribute__((used ));
44+
4245static int smart_amp_init (struct processing_module * mod )
4346{
4447 struct smart_amp_data * sad ;
@@ -49,7 +52,13 @@ static int smart_amp_init(struct processing_module *mod)
4952 int ret ;
5053 const struct ipc4_base_module_extended_cfg * base_cfg = mod_data -> cfg .init_data ;
5154
55+ if (!base_cfg ) {
56+ comp_err (dev , "smart_amp_init(): no module configuration" );
57+ return - EINVAL ;
58+ }
59+
5260 comp_dbg (dev , "smart_amp_init()" );
61+
5362 sad = rzalloc (SOF_MEM_ZONE_RUNTIME , 0 , SOF_MEM_CAPS_RAM , sizeof (* sad ));
5463 if (!sad )
5564 return - ENOMEM ;
@@ -393,3 +402,36 @@ DECLARE_MODULE_ADAPTER(smart_amp_test_interface, smart_amp_test_comp_uuid, smart
393402 * "sys_comp_module_<smart_amp_test_interface>_init()" (and a lot more)
394403 */
395404SOF_MODULE_INIT (smart_amp_test , sys_comp_module_smart_amp_test_interface_init );
405+
406+ #ifdef MAJOR_IADSP_API_VERSION
407+
408+ #include <rimage/sof/user/manifest.h>
409+ #include <module/module/api_ver.h>
410+
411+ static const void * loadable_module_main (void * mod_cfg , void * parent_ppl , void * * mod_ptr )
412+ {
413+ return & smart_amp_test_interface ;
414+ }
415+
416+ static const struct sof_man_module_manifest main_manifest __section (".module" ) __attribute__((used )) = {
417+ .module = {
418+ .name = "SMATEST" ,
419+ .uuid = {0x1E , 0x96 , 0x7A , 0x16 , 0xE4 , 0x8A , 0xEA , 0x11 ,
420+ 0x89 , 0xF1 , 0x00 , 0x0C , 0x29 , 0xCE , 0x16 , 0x35 },
421+ .entry_point = (uint32_t )loadable_module_main ,
422+ .type = {
423+ .load_type = SOF_MAN_MOD_TYPE_LLEXT ,
424+ .domain_ll = 1 ,
425+ },
426+ .affinity_mask = 1 ,
427+ }
428+ };
429+
430+ static const struct sof_module_api_build_info buildinfo __section (".mod_buildinfo" ) __attribute__((used )) = {
431+ .format = SOF_MODULE_API_BUILD_INFO_FORMAT ,
432+ .api_version_number = {
433+ .fields .major = SOF_MODULE_API_MAJOR_VERSION ,
434+ },
435+ };
436+
437+ #endif
0 commit comments