Skip to content
Merged
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
27 changes: 26 additions & 1 deletion sound/soc/sof/ipc4-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,41 @@ sof_ipc4_sps_to_time_info(struct snd_sof_pcm_stream *sps)
return stream_priv->time_info;
}

static
char *sof_ipc4_set_multi_pipeline_state_debug(struct snd_sof_dev *sdev, char *buf, size_t size,
struct ipc4_pipeline_set_state_data *trigger_list)
{
int i, offset = 0;

for (i = 0; i < trigger_list->count; i++) {
offset += snprintf(buf + offset, size - offset, " %d",
trigger_list->pipeline_instance_ids[i]);

if (offset >= size - 1) {
buf[size - 1] = '\0';
break;
}
}
return buf;
}

static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state,
struct ipc4_pipeline_set_state_data *trigger_list)
{
struct sof_ipc4_msg msg = {{ 0 }};
u32 primary, ipc_size;
char debug_buf[32];

/* trigger a single pipeline */
if (trigger_list->count == 1)
return sof_ipc4_set_pipeline_state(sdev, trigger_list->pipeline_instance_ids[0],
state);

dev_dbg(sdev->dev, "Set pipelines %s to state %d%s",
sof_ipc4_set_multi_pipeline_state_debug(sdev, debug_buf, sizeof(debug_buf),
trigger_list),
state, sof_ipc4_pipeline_state_str(state));

primary = state;
primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_SET_PIPELINE_STATE);
primary |= SOF_IPC4_MSG_DIR(SOF_IPC4_MSG_REQUEST);
Expand All @@ -89,7 +113,8 @@ int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 instance_id, u32 s
struct sof_ipc4_msg msg = {{ 0 }};
u32 primary;

dev_dbg(sdev->dev, "ipc4 set pipeline instance %d state %d", instance_id, state);
dev_dbg(sdev->dev, "Set pipeline %d to state %d%s", instance_id, state,
sof_ipc4_pipeline_state_str(state));

primary = state;
primary |= SOF_IPC4_GLB_PIPE_STATE_ID(instance_id);
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/ipc4-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,7 @@ size_t sof_ipc4_find_debug_slot_offset_by_type(struct snd_sof_dev *sdev,

void sof_ipc4_mic_privacy_state_change(struct snd_sof_dev *sdev, bool state);

enum sof_ipc4_pipeline_state;
const char *sof_ipc4_pipeline_state_str(enum sof_ipc4_pipeline_state state);

#endif
25 changes: 25 additions & 0 deletions sound/soc/sof/ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,26 @@ static void sof_ipc4_log_header(struct device *dev, u8 *text, struct sof_ipc4_ms
msg->extension, str);
}
}

const char *sof_ipc4_pipeline_state_str(enum sof_ipc4_pipeline_state state)
{
switch (state) {
case SOF_IPC4_PIPE_INVALID_STATE:
return " (INVALID_STATE)";
case SOF_IPC4_PIPE_UNINITIALIZED:
return " (UNINITIALIZED)";
case SOF_IPC4_PIPE_RESET:
return " (RESET)";
case SOF_IPC4_PIPE_PAUSED:
return " (PAUSED)";
case SOF_IPC4_PIPE_RUNNING:
return " (RUNNING)";
case SOF_IPC4_PIPE_EOS:
return " (EOS)";
default:
return " (<unknown>)";
}
}
#else /* CONFIG_SND_SOC_SOF_DEBUG_VERBOSE_IPC */
static void sof_ipc4_log_header(struct device *dev, u8 *text, struct sof_ipc4_msg *msg,
bool data_size_valid)
Expand All @@ -254,6 +274,11 @@ static void sof_ipc4_log_header(struct device *dev, u8 *text, struct sof_ipc4_ms
else
dev_dbg(dev, "%s: %#x|%#x\n", text, msg->primary, msg->extension);
}

const char *sof_ipc4_pipeline_state_str(enum sof_ipc4_pipeline_state state)
{
return "";
}
#endif

static void sof_ipc4_dump_payload(struct snd_sof_dev *sdev,
Expand Down
Loading