Skip to content

Commit

Permalink
Audio: Mux: Handle correctly mux/demux mode
Browse files Browse the repository at this point in the history
Since with module adapter the component type from init IPC
is no more SOF_COMP_MUX or SOF_COMP_DEMUX but
SOF_COMP_MODULE_ADAPTER, the mux mode check needs to be change.
The type is set in init() based on which init function was
used.

All checks for dev->ipc_config.type are changed to check of
cd->comp_type. The set of type in mux_ipc4.c is removed.

Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu authored and lgirdwood committed Oct 1, 2024
1 parent 64bd786 commit 421a6df
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/audio/mux/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool mux_mix_check(struct sof_mux_config *cfg)
return false;
}

static int mux_demux_common_init(struct processing_module *mod)
static int mux_demux_common_init(struct processing_module *mod, enum sof_comp_type type)
{
struct module_data *module_data = &mod->priv;
struct comp_dev *dev = mod->dev;
Expand Down Expand Up @@ -116,6 +116,7 @@ static int mux_demux_common_init(struct processing_module *mod)

mod->verify_params_flags = BUFF_PARAMS_CHANNELS;
mod->no_pause = true;
cd->comp_type = type;
return 0;

err_init:
Expand All @@ -130,14 +131,14 @@ static int mux_init(struct processing_module *mod)
{
mod->max_sources = MUX_MAX_STREAMS;

return mux_demux_common_init(mod);
return mux_demux_common_init(mod, SOF_COMP_MUX);
}

static int demux_init(struct processing_module *mod)
{
mod->max_sinks = MUX_MAX_STREAMS;

return mux_demux_common_init(mod);
return mux_demux_common_init(mod, SOF_COMP_DEMUX);
}

static int mux_free(struct processing_module *mod)
Expand Down Expand Up @@ -386,7 +387,7 @@ static int mux_prepare(struct processing_module *mod,
if (ret < 0)
return ret;

if (dev->ipc_config.type == SOF_COMP_MUX)
if (cd->comp_type == SOF_COMP_MUX)
cd->mux = mux_get_processing_function(mod);
else
cd->demux = demux_get_processing_function(mod);
Expand Down
1 change: 1 addition & 0 deletions src/audio/mux/mux.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ struct comp_data {
struct mux_look_up lookup[MUX_MAX_STREAMS];
struct mux_look_up active_lookup;
struct comp_data_blob_handler *model_handler;
enum sof_comp_type comp_type;
struct sof_mux_config config; /* Keep last due to flexible array member in end */
};

Expand Down
6 changes: 3 additions & 3 deletions src/audio/mux/mux_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int mux_set_values(struct processing_module *mod)
}
}

if (dev->ipc_config.type == SOF_COMP_MUX) {
if (cd->comp_type == SOF_COMP_MUX) {
if (mux_mix_check(cfg))
comp_err(dev, "mux_set_values(): mux component is not able to mix channels");
}
Expand All @@ -81,13 +81,13 @@ static int mux_set_values(struct processing_module *mod)

cd->config.num_streams = cfg->num_streams;

if (dev->ipc_config.type == SOF_COMP_MUX)
if (cd->comp_type == SOF_COMP_MUX)
mux_prepare_look_up_table(mod);
else
demux_prepare_look_up_table(mod);

if (dev->state > COMP_STATE_INIT) {
if (dev->ipc_config.type == SOF_COMP_MUX)
if (cd->comp_type == SOF_COMP_MUX)
cd->mux = mux_get_processing_function(mod);
else
cd->demux = demux_get_processing_function(mod);
Expand Down
1 change: 0 additions & 1 deletion src/audio/mux/mux_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static int build_config(struct processing_module *mod)
int mask = 1;
int i;

dev->ipc_config.type = SOF_COMP_MUX;
cd->config.num_streams = MUX_MAX_STREAMS;

/* clear masks */
Expand Down

0 comments on commit 421a6df

Please sign in to comment.