Commit 1eaff264 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: SOF: IPC4: clarify 'pipeline_ids' usage and logs

A pipeline is identified by two indices: 'instance_id' and 'pipeline_id'

This is clearly seen in kernel logs when creating a pipeline

"Create widget pipeline.20 instance 0 - pipe 20 - core 0"

but other logs are less clear

"ipc4 set pipeline 1 state 4"

Change definitions and logs to make sure the logs clearly identify
which of the two indices are used in state transitions.

No functional change.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230807210959.506849-20-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 699e146d
...@@ -23,7 +23,8 @@ static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state ...@@ -23,7 +23,8 @@ static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state
/* trigger a single pipeline */ /* trigger a single pipeline */
if (trigger_list->count == 1) if (trigger_list->count == 1)
return sof_ipc4_set_pipeline_state(sdev, trigger_list->pipeline_ids[0], state); return sof_ipc4_set_pipeline_state(sdev, trigger_list->pipeline_instance_ids[0],
state);
primary = state; primary = state;
primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_SET_PIPELINE_STATE); primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_SET_PIPELINE_STATE);
...@@ -42,15 +43,15 @@ static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state ...@@ -42,15 +43,15 @@ static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state
return sof_ipc_tx_message_no_reply(sdev->ipc, &msg, ipc_size); return sof_ipc_tx_message_no_reply(sdev->ipc, &msg, ipc_size);
} }
int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 id, u32 state) int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 instance_id, u32 state)
{ {
struct sof_ipc4_msg msg = {{ 0 }}; struct sof_ipc4_msg msg = {{ 0 }};
u32 primary; u32 primary;
dev_dbg(sdev->dev, "ipc4 set pipeline %d state %d", id, state); dev_dbg(sdev->dev, "ipc4 set pipeline instance %d state %d", instance_id, state);
primary = state; primary = state;
primary |= SOF_IPC4_GLB_PIPE_STATE_ID(id); primary |= SOF_IPC4_GLB_PIPE_STATE_ID(instance_id);
primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_SET_PIPELINE_STATE); primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_SET_PIPELINE_STATE);
primary |= SOF_IPC4_MSG_DIR(SOF_IPC4_MSG_REQUEST); primary |= SOF_IPC4_MSG_DIR(SOF_IPC4_MSG_REQUEST);
primary |= SOF_IPC4_MSG_TARGET(SOF_IPC4_FW_GEN_MSG); primary |= SOF_IPC4_MSG_TARGET(SOF_IPC4_FW_GEN_MSG);
...@@ -79,19 +80,19 @@ sof_ipc4_add_pipeline_to_trigger_list(struct snd_sof_dev *sdev, int state, ...@@ -79,19 +80,19 @@ sof_ipc4_add_pipeline_to_trigger_list(struct snd_sof_dev *sdev, int state,
* for the first time * for the first time
*/ */
if (spipe->started_count == spipe->paused_count) if (spipe->started_count == spipe->paused_count)
trigger_list->pipeline_ids[trigger_list->count++] = trigger_list->pipeline_instance_ids[trigger_list->count++] =
pipe_widget->instance_id; pipe_widget->instance_id;
break; break;
case SOF_IPC4_PIPE_RESET: case SOF_IPC4_PIPE_RESET:
/* RESET if the pipeline is neither running nor paused */ /* RESET if the pipeline is neither running nor paused */
if (!spipe->started_count && !spipe->paused_count) if (!spipe->started_count && !spipe->paused_count)
trigger_list->pipeline_ids[trigger_list->count++] = trigger_list->pipeline_instance_ids[trigger_list->count++] =
pipe_widget->instance_id; pipe_widget->instance_id;
break; break;
case SOF_IPC4_PIPE_PAUSED: case SOF_IPC4_PIPE_PAUSED:
/* Pause the pipeline only when its started_count is 1 more than paused_count */ /* Pause the pipeline only when its started_count is 1 more than paused_count */
if (spipe->paused_count == (spipe->started_count - 1)) if (spipe->paused_count == (spipe->started_count - 1))
trigger_list->pipeline_ids[trigger_list->count++] = trigger_list->pipeline_instance_ids[trigger_list->count++] =
pipe_widget->instance_id; pipe_widget->instance_id;
break; break;
default: default:
...@@ -113,7 +114,7 @@ sof_ipc4_update_pipeline_state(struct snd_sof_dev *sdev, int state, int cmd, ...@@ -113,7 +114,7 @@ sof_ipc4_update_pipeline_state(struct snd_sof_dev *sdev, int state, int cmd,
/* set state for pipeline if it was just triggered */ /* set state for pipeline if it was just triggered */
for (i = 0; i < trigger_list->count; i++) { for (i = 0; i < trigger_list->count; i++) {
if (trigger_list->pipeline_ids[i] == pipe_widget->instance_id) { if (trigger_list->pipeline_instance_ids[i] == pipe_widget->instance_id) {
pipeline->state = state; pipeline->state = state;
break; break;
} }
...@@ -314,8 +315,8 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component, ...@@ -314,8 +315,8 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
return sof_ipc4_chain_dma_trigger(sdev, pipeline_list, state, cmd); return sof_ipc4_chain_dma_trigger(sdev, pipeline_list, state, cmd);
/* allocate memory for the pipeline data */ /* allocate memory for the pipeline data */
trigger_list = kzalloc(struct_size(trigger_list, pipeline_ids, pipeline_list->count), trigger_list = kzalloc(struct_size(trigger_list, pipeline_instance_ids,
GFP_KERNEL); pipeline_list->count), GFP_KERNEL);
if (!trigger_list) if (!trigger_list)
return -ENOMEM; return -ENOMEM;
......
...@@ -144,11 +144,11 @@ struct sof_ipc4_pipeline { ...@@ -144,11 +144,11 @@ struct sof_ipc4_pipeline {
/** /**
* struct sof_ipc4_multi_pipeline_data - multi pipeline trigger IPC data * struct sof_ipc4_multi_pipeline_data - multi pipeline trigger IPC data
* @count: Number of pipelines to be triggered * @count: Number of pipelines to be triggered
* @pipeline_ids: Flexible array of IDs of the pipelines to be triggered * @pipeline_instance_ids: Flexible array of IDs of the pipelines to be triggered
*/ */
struct ipc4_pipeline_set_state_data { struct ipc4_pipeline_set_state_data {
u32 count; u32 count;
DECLARE_FLEX_ARRAY(u32, pipeline_ids); DECLARE_FLEX_ARRAY(u32, pipeline_instance_ids);
} __packed; } __packed;
/** /**
......
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