component: pass sof context to sys_comp_init()

Passes sof context pointer to sys_comp_init() function.
It will be needed in order to add comp_driver_list to
sof context.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2020-01-17 11:21:11 +01:00 committed by Liam Girdwood
parent abae50b549
commit 47917c1f3d
8 changed files with 16 additions and 7 deletions

View File

@ -10,6 +10,7 @@
#include <sof/drivers/interrupt.h> #include <sof/drivers/interrupt.h>
#include <sof/lib/alloc.h> #include <sof/lib/alloc.h>
#include <sof/list.h> #include <sof/list.h>
#include <sof/sof.h>
#include <sof/string.h> #include <sof/string.h>
#include <ipc/topology.h> #include <ipc/topology.h>
#include <errno.h> #include <errno.h>
@ -188,7 +189,7 @@ int comp_set_state(struct comp_dev *dev, int cmd)
return ret; return ret;
} }
void sys_comp_init(void) void sys_comp_init(struct sof *sof)
{ {
list_init(&cd.list); list_init(&cd.list);
} }

View File

@ -35,6 +35,7 @@
#include <stdint.h> #include <stdint.h>
struct comp_dev; struct comp_dev;
struct sof;
struct sof_ipc_dai_config; struct sof_ipc_dai_config;
struct sof_ipc_stream_posn; struct sof_ipc_stream_posn;
struct dai_hw_params; struct dai_hw_params;
@ -561,7 +562,7 @@ static inline int comp_set_attribute(struct comp_dev *dev, uint32_t type,
* Allocates and initializes audio component list. * Allocates and initializes audio component list.
* To be called once at boot time. * To be called once at boot time.
*/ */
void sys_comp_init(void); void sys_comp_init(struct sof *sof);
/** @}*/ /** @}*/

View File

@ -93,7 +93,7 @@ int task_main_start(struct sof *sof)
int ret; int ret;
/* init default audio components */ /* init default audio components */
sys_comp_init(); sys_comp_init(sof);
/* init self-registered modules */ /* init self-registered modules */
sys_module_init(); sys_module_init();

View File

@ -82,7 +82,7 @@ static uint8_t masks[][MUX_MAX_STREAMS][PLATFORM_MAX_CHANNELS] = {
static int setup_group(void **state) static int setup_group(void **state)
{ {
sys_comp_init(); sys_comp_init(sof_get());
sys_comp_mux_init(); sys_comp_mux_init();
return 0; return 0;

View File

@ -18,6 +18,8 @@
TRACE_IMPL() TRACE_IMPL()
static struct sof sof;
void rfree(void *ptr) void rfree(void *ptr)
{ {
free(ptr); free(ptr);
@ -51,3 +53,8 @@ void __panic(uint32_t p, char *filename, uint32_t linenum)
abort(); abort();
} }
struct sof *sof_get(void)
{
return &sof;
}

View File

@ -94,7 +94,7 @@ static uint8_t masks[][MUX_MAX_STREAMS][PLATFORM_MAX_CHANNELS] = {
static int setup_group(void **state) static int setup_group(void **state)
{ {
sys_comp_init(); sys_comp_init(sof_get());
sys_comp_mux_init(); sys_comp_mux_init();
return 0; return 0;

View File

@ -22,7 +22,7 @@ struct test_data {
static int setup_group(void **state) static int setup_group(void **state)
{ {
sys_comp_init(); sys_comp_init(sof_get());
sys_comp_mux_init(); sys_comp_mux_init();
return 0; return 0;

View File

@ -27,7 +27,7 @@
int tb_pipeline_setup(struct sof *sof) int tb_pipeline_setup(struct sof *sof)
{ {
/* init components */ /* init components */
sys_comp_init(); sys_comp_init(sof);
/* init IPC */ /* init IPC */
if (ipc_init(sof) < 0) { if (ipc_init(sof) < 0) {