Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,26 @@ struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
if (!mod)
return NULL;

module_set_private_data(mod, mod_priv);
list_init(&mod->raw_data_buffers_list);
#if CONFIG_USERSPACE
mod->user_ctx = user_ctx;
#endif /* CONFIG_USERSPACE */

struct comp_dev *dev = mod->dev;

#if CONFIG_ZEPHYR_DP_SCHEDULER
/* create a task for DP processing */
if (config->proc_domain == COMP_PROCESSING_DOMAIN_DP) {
/* All data allocated, create a thread */
pipeline_comp_dp_task_init(dev);
ret = pipeline_comp_dp_task_init(dev);
if (ret) {
comp_cl_err(drv, "DP task creation failed with error %d.", ret);
goto err;
}
}
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */

module_set_private_data(mod, mod_priv);
list_init(&mod->raw_data_buffers_list);
#if CONFIG_USERSPACE
mod->user_ctx = user_ctx;
#endif /* CONFIG_USERSPACE */

dst = &mod->priv.cfg;
/*
* NOTE: dst->ext_data points to stack variable and contains
Expand Down Expand Up @@ -330,10 +334,6 @@ struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
schedule_task_free(dev->task);
#endif
module_adapter_mem_free(mod);
#if CONFIG_IPC_MAJOR_4
dst->ext_data = NULL;
#endif

return NULL;
}

Expand Down
10 changes: 6 additions & 4 deletions src/schedule/zephyr_dp_schedule_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ int scheduler_dp_task_init(struct task **task,
/* success, fill the structures */
pdata->p_stack = p_stack;
pdata->mod = mod;
*task = &task_memory->task;

/* create a zephyr thread for the task */
pdata->thread_id = k_thread_create(pdata->thread, (__sparse_force void *)p_stack,
stack_size, dp_thread_fn, *task, NULL, NULL,
CONFIG_DP_THREAD_PRIORITY, (*task)->flags, K_FOREVER);
stack_size, dp_thread_fn, &task_memory->task, NULL, NULL,
CONFIG_DP_THREAD_PRIORITY, task_memory->task.flags,
K_FOREVER);

k_thread_access_grant(pdata->thread_id, pdata->event);
scheduler_dp_grant(pdata->thread_id, cpu_get_id());
Expand All @@ -280,7 +280,7 @@ int scheduler_dp_task_init(struct task **task,
}

#ifdef CONFIG_USERSPACE
if ((*task)->flags & K_USER) {
if (task_memory->task.flags & K_USER) {
ret = user_memory_init_shared(pdata->thread_id, pdata->mod);
if (ret < 0) {
tr_err(&dp_tr, "user_memory_init_shared() failed");
Expand All @@ -293,6 +293,8 @@ int scheduler_dp_task_init(struct task **task,
k_event_init(pdata->event);
k_thread_start(pdata->thread_id);

/* success, fill output parameter */
*task = &task_memory->task;
return 0;

e_thread:
Expand Down