diff --git a/tools/tplg_parser/audio_formats.c b/tools/tplg_parser/audio_formats.c index 53166f81b620..39a54e7f6100 100644 --- a/tools/tplg_parser/audio_formats.c +++ b/tools/tplg_parser/audio_formats.c @@ -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]; @@ -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; } diff --git a/tools/tplg_parser/include/tplg_parser/topology.h b/tools/tplg_parser/include/tplg_parser/topology.h index 8cedca32430f..04988d688082 100644 --- a/tools/tplg_parser/include/tplg_parser/topology.h +++ b/tools/tplg_parser/include/tplg_parser/topology.h @@ -111,6 +111,11 @@ 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 */ @@ -118,6 +123,7 @@ struct tplg_comp_info { 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;