Commit 05ade472 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: SOF: ipc4-topology: Add support for core_id for pipelines

Token SOF_TKN_SCHED_CORE in topology file can specify the target core for
the pipeline, if it is missing it is going to be 0 (as it is right now).

Firmware will double-check all information retrieved by topology and
report errors if required. This will allow policy and changes in
topologies without a need for a synchronized kernel change.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230307123556.31328-3-peter.ujfalusi@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 11f45690
...@@ -24,7 +24,9 @@ static DEFINE_IDA(pipeline_ida); ...@@ -24,7 +24,9 @@ static DEFINE_IDA(pipeline_ida);
static const struct sof_topology_token ipc4_sched_tokens[] = { static const struct sof_topology_token ipc4_sched_tokens[] = {
{SOF_TKN_SCHED_LP_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, {SOF_TKN_SCHED_LP_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc4_pipeline, lp_mode)} offsetof(struct sof_ipc4_pipeline, lp_mode)},
{SOF_TKN_SCHED_CORE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc4_pipeline, core_id)},
}; };
static const struct sof_topology_token pipeline_tokens[] = { static const struct sof_topology_token pipeline_tokens[] = {
...@@ -629,6 +631,8 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget) ...@@ -629,6 +631,8 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
goto err; goto err;
} }
swidget->core = pipeline->core_id;
/* parse one set of pipeline tokens */ /* parse one set of pipeline tokens */
ret = sof_update_ipc_object(scomp, swidget, SOF_PIPELINE_TOKENS, swidget->tuples, ret = sof_update_ipc_object(scomp, swidget, SOF_PIPELINE_TOKENS, swidget->tuples,
swidget->num_tuples, sizeof(*swidget), 1); swidget->num_tuples, sizeof(*swidget), 1);
...@@ -640,9 +644,9 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget) ...@@ -640,9 +644,9 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
/* TODO: Get priority from topology */ /* TODO: Get priority from topology */
pipeline->priority = 0; pipeline->priority = 0;
dev_dbg(scomp->dev, "pipeline '%s': id %d pri %d lp mode %d\n", dev_dbg(scomp->dev, "pipeline '%s': id %d, pri %d, core_id %u, lp mode %d\n",
swidget->widget->name, swidget->pipeline_id, swidget->widget->name, swidget->pipeline_id,
pipeline->priority, pipeline->lp_mode); pipeline->priority, pipeline->core_id, pipeline->lp_mode);
swidget->private = pipeline; swidget->private = pipeline;
...@@ -652,6 +656,7 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget) ...@@ -652,6 +656,7 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
pipeline->msg.primary |= SOF_IPC4_MSG_TARGET(SOF_IPC4_FW_GEN_MSG); pipeline->msg.primary |= SOF_IPC4_MSG_TARGET(SOF_IPC4_FW_GEN_MSG);
pipeline->msg.extension = pipeline->lp_mode; pipeline->msg.extension = pipeline->lp_mode;
pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_CORE_ID(pipeline->core_id);
pipeline->state = SOF_IPC4_PIPE_UNINITIALIZED; pipeline->state = SOF_IPC4_PIPE_UNINITIALIZED;
return 0; return 0;
......
...@@ -117,6 +117,7 @@ struct sof_ipc4_copier_config_set_sink_format { ...@@ -117,6 +117,7 @@ struct sof_ipc4_copier_config_set_sink_format {
* @priority: Priority of this pipeline * @priority: Priority of this pipeline
* @lp_mode: Low power mode * @lp_mode: Low power mode
* @mem_usage: Memory usage * @mem_usage: Memory usage
* @core_id: Target core for the pipeline
* @state: Pipeline state * @state: Pipeline state
* @msg: message structure for pipeline * @msg: message structure for pipeline
* @skip_during_fe_trigger: skip triggering this pipeline during the FE DAI trigger * @skip_during_fe_trigger: skip triggering this pipeline during the FE DAI trigger
...@@ -125,6 +126,7 @@ struct sof_ipc4_pipeline { ...@@ -125,6 +126,7 @@ struct sof_ipc4_pipeline {
uint32_t priority; uint32_t priority;
uint32_t lp_mode; uint32_t lp_mode;
uint32_t mem_usage; uint32_t mem_usage;
uint32_t core_id;
int state; int state;
struct sof_ipc4_msg msg; struct sof_ipc4_msg msg;
bool skip_during_fe_trigger; bool skip_during_fe_trigger;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment