Skip to content

Commit

Permalink
Audio: basefw: Implement ipc4 pipeline info get
Browse files Browse the repository at this point in the history
Added support for ipc4 query no 255 (10).
This make it possible to get information about
the current loaded pipelines.

Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
  • Loading branch information
gbernatxintel committed Apr 23, 2024
1 parent 665817f commit 31bc57f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <ipc4/base_fw_platform.h>
#include <ipc4/pipeline.h>
#include <ipc4/logging.h>
#include <ipc/topology.h>
#include <sof_versions.h>
#include <sof/lib/cpu-clk-manager.h>
#include <sof/lib/cpu.h>
Expand Down Expand Up @@ -498,6 +499,31 @@ int schedulers_info_get(uint32_t *data_off_size,
return 0;
}

static int basefw_pipeline_list_info_get(uint32_t *data_offset, char *data)
{
struct ipc4_pipeline_set_state_data *ppl_data = (struct ipc4_pipeline_set_state_data *)data;

struct ipc *ipc = ipc_get();
struct ipc_comp_dev *ipc_pipe;
const struct ipc4_pipeline_set_state_data *pipeline_data;

pipeline_data = ipc4_get_pipeline_data_wrapper();
ppl_data->pipelines_count = 0;

for (int ppl = 0; ppl < pipeline_data->pipelines_count; ppl++) {
ipc_pipe = ipc_get_pipeline_by_id(ipc, ppl);
if (!ipc_pipe)
tr_err(&ipc_tr, "No pipeline with instance_id = %d", ppl);
else
ppl_data->ppl_id[ppl_data->pipelines_count++] =
ipc_pipe->pipeline->pipeline_id;
}

*data_offset = sizeof(ppl_data->pipelines_count) +
ppl_data->pipelines_count * sizeof(ppl_data->ppl_id[0]);
return 0;
}

int set_perf_meas_state(const char *data)
{
#ifdef CONFIG_SOF_TELEMETRY
Expand Down Expand Up @@ -571,11 +597,12 @@ static int basefw_get_large_config(struct comp_dev *dev,
case IPC4_SCHEDULERS_INFO_GET:
return schedulers_info_get(data_offset, data,
extended_param_id.part.parameter_instance);
case IPC4_PIPELINE_LIST_INFO_GET:
return basefw_pipeline_list_info_get(data_offset, data);
/* TODO: add more support */
case IPC4_DSP_RESOURCE_STATE:
case IPC4_NOTIFICATION_MASK:
case IPC4_MODULES_INFO_GET:
case IPC4_PIPELINE_LIST_INFO_GET:
case IPC4_PIPELINE_PROPS_GET:
case IPC4_GATEWAYS_INFO_GET:
case IPC4_LIBRARIES_INFO_GET:
Expand Down
2 changes: 2 additions & 0 deletions src/include/sof/ipc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd);
int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *delayed);
int ipc4_find_dma_config_multiple(struct ipc_config_dai *dai, uint8_t *data_buffer,
uint32_t size, uint32_t device_id, int dma_cfg_idx);
const struct ipc4_pipeline_set_state_data *ipc4_get_pipeline_data_wrapper(void);

#else
#error "No or invalid IPC MAJOR version selected."
#endif
Expand Down
9 changes: 9 additions & 0 deletions src/ipc/ipc4/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,15 @@ static int ipc_wait_for_compound_msg(void)
return IPC4_SUCCESS;
}

const struct ipc4_pipeline_set_state_data *ipc4_get_pipeline_data_wrapper(void)
{
const struct ipc4_pipeline_set_state_data *ppl_data;

ppl_data = ipc4_get_pipeline_data();

return ppl_data;
}

static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4)
{
const struct ipc4_pipeline_set_state_data *ppl_data;
Expand Down

0 comments on commit 31bc57f

Please sign in to comment.