Skip to content

Commit

Permalink
Tools: Tplg_parser: Add parse of input and output pins count
Browse files Browse the repository at this point in the history
This patch adds to the parser the capability to parse the tokens
and place the found values to pins_info member in tplg_comp_info
struct.

Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu authored and lgirdwood committed Oct 15, 2024
1 parent 8052696 commit 944e6ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/tplg_parser/audio_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ static const struct sof_topology_token ipc4_out_audio_format_tokens[] = {
offsetof(struct sof_ipc4_pin_format, buffer_size)},
};

static const struct sof_topology_token ipc4_comp_pin_tokens[] = {
{SOF_TKN_COMP_NUM_INPUT_PINS, SND_SOC_TPLG_TUPLE_TYPE_WORD,
tplg_token_get_uint32_t, offsetof(struct tplg_pins_info, num_input_pins)},
{SOF_TKN_COMP_NUM_OUTPUT_PINS, SND_SOC_TPLG_TUPLE_TYPE_WORD,
tplg_token_get_uint32_t, offsetof(struct tplg_pins_info, num_output_pins)},
};

int tplg_parse_widget_audio_formats(struct tplg_context *ctx)
{
struct snd_soc_tplg_vendor_array *array = &ctx->widget->priv.array[0];
Expand Down Expand Up @@ -146,5 +153,11 @@ int tplg_parse_widget_audio_formats(struct tplg_context *ctx)
pin_fmt[i].buffer_size);
}

return 0;
ret = sof_parse_token_sets(&comp_info->pins_info, ipc4_comp_pin_tokens,
ARRAY_SIZE(ipc4_comp_pin_tokens), array, size, 1, 0);
if (ret < 0)
fprintf(stderr, "widget: %s: Failed to parse ipc4_comp_pin_tokens\n",
ctx->widget->name);

return ret;
}
6 changes: 6 additions & 0 deletions tools/tplg_parser/include/tplg_parser/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,19 @@ struct tplg_pipeline_info {
struct list_item item; /* item in a list */
};

struct tplg_pins_info {
uint32_t num_input_pins;
uint32_t num_output_pins;
};

struct tplg_comp_info {
struct list_item item; /* item in a list */
struct sof_ipc4_available_audio_format available_fmt; /* available formats in tplg */
struct ipc4_module_init_instance module_init;
struct ipc4_base_module_cfg basecfg;
struct tplg_pipeline_info *pipe_info;
struct sof_uuid uuid;
struct tplg_pins_info pins_info;
char *name;
char *stream_name;
int id;
Expand Down

0 comments on commit 944e6ec

Please sign in to comment.