Skip to contentSkip to conversation

ASoC: SOF: ipc4: Add support for formats per pins

PATCH In review Peter Ujfalusi 2 participants 13 messages Mar 13, 2023 – Mar 14, 2023

Subsystems (3)
lore
Share & tools
lore

Peter Ujfalusi

author maintainer
#0 lore raw

cover ASoC: SOF: ipc4: Add support for formats per pins

Hi,

The modules in IPC4 can have multiple 'pins' on their input and output and these pins can receive or output audio in different formats.
Currently we assume that all pins are using the same format which is a limitation that needs to be lifted in order to support more complex components.

This series will extend and rework the format handling to allow different formats on pins.

Regards,
Peter
---

Ranjani Sridharan (11):
ASoC: SOF: rename a couple of tokens
ASoC: SOF: Use input/output pin consistently
ASoC: SOF: ipc4-topology: Add a new field in struct
sof_ipc4_available_audio_format
ASoC: SOF: ipc4-topology: Do not parse the DMA_BUFFER_SIZE token
ASoC: SOF: ipc4-topology: Parse the SOF_COMP_TOKENS only once
ASoC: SOF: ipc4-topology: Always parse the output formats in topology
ASoC: SOF: ipc4-topology: Modify the type of available input/output
formats
ASoC: SOF: ipc4-topology: Modify the signature of

    sof_ipc4_init_audio_fmt()

ASoC: SOF: ipc4-topology: Remove the ref_audio_fmt field
ASoC: SOF: ipc4-topology: Add new tokens for input/output pin format
count
ASoC: SOF: ipc4-topology: Search only pin 0 formats

 include/uapi/sound/sof/tokens.h |  20 +-
 sound/soc/sof/ipc4-pcm.c        |   2 +-
 sound/soc/sof/ipc4-topology.c   | 529 +++++++++++++++-----------------
 sound/soc/sof/ipc4-topology.h   |  36 ++-
 sound/soc/sof/sof-audio.h       |  35 +--
 sound/soc/sof/topology.c        | 124 ++++----
 6 files changed, 371 insertions(+), 375 deletions(-)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/11 ASoC: SOF: rename a couple of tokens

From: Ranjani Sridharan <[email protected]>

Rename SOF_TKN_CAVS_AUDIO_FORMAT_IN_VALID and SOF_TKN_CAVS_AUDIO_FORMAT_OUT_VALID as SOF_TKN_CAVS_AUDIO_FORMAT_IN_VALID_BIT_DEPTH and SOF_TKN_CAVS_AUDIO_FORMAT_OUT_VALID_BIT_DEPTH respectively.

These are currently not used.

---
 include/uapi/sound/sof/tokens.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/sound/sof/tokens.h +2 -2
index bacaf8a6317e..a1ef6b5c0d45 100644
@@ -173,7 +173,7 @@
 /* CAVS AUDIO FORMAT */
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_RATE	1900
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_BIT_DEPTH	1901
-#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_VALID_BIT	1902
+#define SOF_TKN_CAVS_AUDIO_FORMAT_IN_VALID_BIT_DEPTH	1902
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CHANNELS	1903
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_MAP	1904
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_CFG	1905
@@ -183,7 +183,7 @@
 /* intentional token numbering discontinuity, reserved for future use */
 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_RATE	1930
 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_BIT_DEPTH	1931
-#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_VALID_BIT	1932
+#define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_VALID_BIT_DEPTH 1932
 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CHANNELS	1933
 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_MAP	1934
 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_CFG	1935
Signature · 1 line
2.39.2
author maintainer
#4 lore raw

PATCH 4/11 ASoC: SOF: ipc4-topology: Do not parse the DMA_BUFFER_SIZE token

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Do not parse the SOF_TKN_CAVS_AUDIO_FORMAT_DMA_BUFFER_SIZE token as the dma_buffer_size can be derived from the input/output buffer size and the type of widget during copier prepare. For the deep buffer case, introduce a new token that will be used to get the deep buffer DMA size for the host copier from topology.

---
 include/uapi/sound/sof/tokens.h |   1 +
 sound/soc/sof/ipc4-topology.c   | 112 ++++++++++++++------------------
 sound/soc/sof/ipc4-topology.h   |   5 +-
 sound/soc/sof/sof-audio.h       |   2 +-
 sound/soc/sof/topology.c        |   1 -
 5 files changed, 52 insertions(+), 69 deletions(-)
include/uapi/sound/sof/tokens.h +1 -0
index 0b5110427132..9e91e2640dd4 100644
@@ -197,6 +197,7 @@
 
 /* COPIER */
 #define SOF_TKN_INTEL_COPIER_NODE_TYPE		1980
+#define SOF_TKN_INTEL_COPIER_DEEP_BUFFER_DMA_MS	1981
 
 /* ACP I2S */
 #define SOF_TKN_AMD_ACPI2S_RATE			1700
sound/soc/sof/ipc4-topology.c +47 -65

243 lines not on this page · raw message

sound/soc/sof/ipc4-topology.h +3 -2
index addc5b55cc10..696d6c39a21b 100644
@@ -55,6 +55,9 @@
 
 #define SOF_IPC4_INVALID_NODE_ID	0xffffffff
 
+/* FW requires minimum 2ms DMA buffer size */
+#define SOF_IPC4_MIN_DMA_BUFFER_SIZE	2
+
 /*
  * The base of multi-gateways. Multi-gateways addressing starts from
  * ALH_MULTI_GTW_BASE and there are ALH_MULTI_GTW_COUNT multi-sources
@@ -148,7 +151,6 @@ struct ipc4_pipeline_set_state_data {
  * @out_audio_fmt: Available output audio format
  * @input_audio_fmts: Available input audio formats
  * @ref_audio_fmt: Reference audio format to match runtime audio format
- * @dma_buffer_size: Available Gateway DMA buffer size (in bytes)
  * @audio_fmt_num: Number of available audio formats
  */
 struct sof_ipc4_available_audio_format {
@@ -156,7 +158,6 @@ struct sof_ipc4_available_audio_format {
 	struct sof_ipc4_audio_format *out_audio_fmt;
 	struct sof_ipc4_audio_format *input_audio_fmts;
 	struct sof_ipc4_audio_format *ref_audio_fmt;
-	u32 *dma_buffer_size;
 	int audio_fmt_num;
 };
 
sound/soc/sof/sof-audio.h +1 -1
index a1c4d3f34153..4504f9efdc50 100644
@@ -257,7 +257,7 @@ enum sof_tokens {
 	SOF_IN_AUDIO_FORMAT_TOKENS,
 	SOF_OUT_AUDIO_FORMAT_TOKENS,
 	SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
-	SOF_COPIER_GATEWAY_CFG_TOKENS,
+	SOF_COPIER_DEEP_BUFFER_TOKENS,
 	SOF_COPIER_TOKENS,
 	SOF_AUDIO_FMT_NUM_TOKENS,
 	SOF_COPIER_FORMAT_TOKENS,
sound/soc/sof/topology.c +0 -1
index 9f84b4c362c3..2d76ab13b3d1 100644
@@ -1232,7 +1232,6 @@ static int sof_widget_parse_tokens(struct snd_soc_component *scomp, struct snd_s
 			continue;
 		case SOF_IN_AUDIO_FORMAT_TOKENS:
 		case SOF_OUT_AUDIO_FORMAT_TOKENS:
-		case SOF_COPIER_GATEWAY_CFG_TOKENS:
 		case SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS:
 			num_sets = sof_get_token_value(SOF_TKN_COMP_NUM_AUDIO_FORMATS,
 						       swidget->tuples, swidget->num_tuples);
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 2/11 ASoC: SOF: Use input/output pin consistently

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Currently we use input/output and sink/source pins interchangeably. Remove the references to sink/source pins and replace with input/output pins everywhere for consistency and clarity.

---
 include/uapi/sound/sof/tokens.h | 12 ++---
 sound/soc/sof/ipc4-topology.c   | 48 ++++++++++----------
 sound/soc/sof/sof-audio.h       | 32 ++++++-------
 sound/soc/sof/topology.c        | 80 ++++++++++++++++-----------------
 4 files changed, 86 insertions(+), 86 deletions(-)
include/uapi/sound/sof/tokens.h +6 -6
index a1ef6b5c0d45..0b5110427132 100644
@@ -88,14 +88,14 @@
 #define SOF_TKN_COMP_CPC			406
 #define SOF_TKN_COMP_IS_PAGES			409
 #define SOF_TKN_COMP_NUM_AUDIO_FORMATS		410
-#define SOF_TKN_COMP_NUM_SINK_PINS		411
-#define SOF_TKN_COMP_NUM_SOURCE_PINS		412
+#define SOF_TKN_COMP_NUM_INPUT_PINS		411
+#define SOF_TKN_COMP_NUM_OUTPUT_PINS		412
 /*
- * The token for sink/source pin binding, it specifies the widget
- * name that the sink/source pin is connected from/to.
+ * The token for input/output pin binding, it specifies the widget
+ * name that the input/output pin is connected from/to.
  */
-#define SOF_TKN_COMP_SINK_PIN_BINDING_WNAME	413
-#define SOF_TKN_COMP_SRC_PIN_BINDING_WNAME	414
+#define SOF_TKN_COMP_INPUT_PIN_BINDING_WNAME	413
+#define SOF_TKN_COMP_OUTPUT_PIN_BINDING_WNAME	414
 
 
 /* SSP */
sound/soc/sof/ipc4-topology.c +24 -24

109 lines not on this page · raw message

sound/soc/sof/sof-audio.h +16 -16
index 239b82f37976..a1c4d3f34153 100644
@@ -30,9 +30,9 @@
  */
 #define SOF_WIDGET_MAX_NUM_PINS	8
 
-/* The type of a widget pin is either sink or source */
-#define SOF_PIN_TYPE_SINK	0
-#define SOF_PIN_TYPE_SOURCE	1
+/* Widget pin type */
+#define SOF_PIN_TYPE_INPUT	0
+#define SOF_PIN_TYPE_OUTPUT	1
 
 /* max number of FE PCMs before BEs */
 #define SOF_BE_PCM_BASE		16
@@ -433,31 +433,31 @@ struct snd_sof_widget {
 	struct snd_sof_tuple *tuples;
 
 	/*
-	 * The allowed range for num_sink/source_pins is [0, SOF_WIDGET_MAX_NUM_PINS].
-	 * Widgets may have zero sink or source pins, for example the tone widget has
-	 * zero sink pins.
+	 * The allowed range for num_input/output_pins is [0, SOF_WIDGET_MAX_NUM_PINS].
+	 * Widgets may have zero input or output pins, for example the tone widget has
+	 * zero input pins.
 	 */
-	u32 num_sink_pins;
-	u32 num_source_pins;
+	u32 num_input_pins;
+	u32 num_output_pins;
 
 	/*
-	 * The sink/source pin binding array, it takes the form of
+	 * The input/output pin binding array, it takes the form of
 	 * [widget_name_connected_to_pin0, widget_name_connected_to_pin1, ...],
 	 * with the index as the queue ID.
 	 *
 	 * The array is used for special pin binding. Note that even if there
-	 * is only one sink/source pin requires special pin binding, pin binding
-	 * should be defined for all sink/source pins in topology, for pin(s) that
+	 * is only one input/output pin requires special pin binding, pin binding
+	 * should be defined for all input/output pins in topology, for pin(s) that
 	 * are not used, give the value "NotConnected".
 	 *
 	 * If pin binding is not defined in topology, nothing to parse in the kernel,
-	 * sink_pin_binding and src_pin_binding shall be NULL.
+	 * input_pin_binding and output_pin_binding shall be NULL.
 	 */
-	char **sink_pin_binding;
-	char **src_pin_binding;
+	char **input_pin_binding;
+	char **output_pin_binding;
 
-	struct ida src_queue_ida;
-	struct ida sink_queue_ida;
+	struct ida output_queue_ida;
+	struct ida input_queue_ida;
 
 	void *private;		/* core does not touch this */
 };
sound/soc/sof/topology.c +40 -40

150 lines not on this page · raw message

Signature · 1 line
2.39.2
author maintainer
#3 lore raw

PATCH 3/11 ASoC: SOF: ipc4-topology: Add a new field in struct sof_ipc4_available_audio_format

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Add a new field, input_audio_fmts, in struct sof_ipc4_available_audio_format and parse all the available input audio formats into this new field and not into the base_config field. This is preparation to remove the base_config array from the struct sof_ipc4_available_audio_format.

This simplifies the sof_ipc4_init_audio_fmt()
function as the reference audio format for matching with input params has the same size.

---
 sound/soc/sof/ipc4-pcm.c      |   2 +-
 sound/soc/sof/ipc4-topology.c | 119 ++++++++++++++++++----------------
 sound/soc/sof/ipc4-topology.h |   2 +
 3 files changed, 65 insertions(+), 58 deletions(-)
sound/soc/sof/ipc4-pcm.c +1 -1
index 68258767aace..a679c08d9bb1 100644
@@ -389,7 +389,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
 	snd_mask_none(fmt);
 	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
 
-	rate->min = ipc4_copier->available_fmt.base_config->audio_fmt.sampling_frequency;
+	rate->min = ipc4_copier->available_fmt.input_audio_fmts->sampling_frequency;
 	rate->max = rate->min;
 
 	switch (ipc4_copier->dai_type) {
sound/soc/sof/ipc4-topology.c +62 -57

282 lines not on this page · raw message

sound/soc/sof/ipc4-topology.h +2 -0
index 22900b572766..addc5b55cc10 100644
@@ -146,6 +146,7 @@ struct ipc4_pipeline_set_state_data {
  * struct sof_ipc4_available_audio_format - Available audio formats
  * @base_config: Available base config
  * @out_audio_fmt: Available output audio format
+ * @input_audio_fmts: Available input audio formats
  * @ref_audio_fmt: Reference audio format to match runtime audio format
  * @dma_buffer_size: Available Gateway DMA buffer size (in bytes)
  * @audio_fmt_num: Number of available audio formats
@@ -153,6 +154,7 @@ struct ipc4_pipeline_set_state_data {
 struct sof_ipc4_available_audio_format {
 	struct sof_ipc4_base_module_cfg *base_config;
 	struct sof_ipc4_audio_format *out_audio_fmt;
+	struct sof_ipc4_audio_format *input_audio_fmts;
 	struct sof_ipc4_audio_format *ref_audio_fmt;
 	u32 *dma_buffer_size;
 	int audio_fmt_num;
Signature · 1 line
2.39.2
author maintainer
#5 lore raw

PATCH 5/11 ASoC: SOF: ipc4-topology: Parse the SOF_COMP_TOKENS only once

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

There is no need to parse the cpc and is_pages values multiple times. It is enough to parse the 2 tokens directly into the base_config field in each module's init_instance IPC payload.

---
 sound/soc/sof/ipc4-topology.c | 41 ++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 17 deletions(-)
sound/soc/sof/ipc4-topology.c +24 -17
index 50cd4fe3141c..b6933fa1a36d 100644
@@ -170,6 +170,7 @@ static void sof_ipc4_dbg_audio_format(struct device *dev,
  * @scomp: pointer to pointer to SOC component
  * @swidget: pointer to struct snd_sof_widget containing tuples
  * @available_fmt: pointer to struct sof_ipc4_available_audio_format being filling in
+ * @module_base_cfg: Pointer to the base_config in the module init IPC payload
  * @has_out_format: true if available_fmt contains output format
  *
  * Return: 0 if successful
@@ -177,6 +178,7 @@ static void sof_ipc4_dbg_audio_format(struct device *dev,
 static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 				  struct snd_sof_widget *swidget,
 				  struct sof_ipc4_available_audio_format *available_fmt,
+				  struct sof_ipc4_base_module_cfg *module_base_cfg,
 				  bool has_out_format)
 {
 	struct sof_ipc4_base_module_cfg *base_config;
@@ -199,17 +201,18 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 	if (!base_config)
 		return -ENOMEM;
 
-	/* set cpc and is_pages for all base_cfg */
-	for (i = 0; i < available_fmt->audio_fmt_num; i++) {
-		ret = sof_update_ipc_object(scomp, &base_config[i],
-					    SOF_COMP_TOKENS, swidget->tuples,
-					    swidget->num_tuples, sizeof(*base_config), 1);
-		if (ret) {
-			dev_err(scomp->dev, "parse comp tokens failed %d\n", ret);
-			goto err;
-		}
+	/* set cpc and is_pages in the module's base_config */
+	ret = sof_update_ipc_object(scomp, module_base_cfg, SOF_COMP_TOKENS, swidget->tuples,
+				    swidget->num_tuples, sizeof(*module_base_cfg), 1);
+	if (ret) {
+		dev_err(scomp->dev, "parse comp tokens for %s failed, error: %d\n",
+			swidget->widget->name, ret);
+		goto err;
 	}
 
+	dev_dbg(scomp->dev, "widget %s cpc: %d is_pages: %d\n",
+		swidget->widget->name, module_base_cfg->cpc, module_base_cfg->is_pages);
+
 	/* copy the ibs/obs for each base_cfg */
 	ret = sof_update_ipc_object(scomp, base_config,
 				    SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS, swidget->tuples,
@@ -221,9 +224,8 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 	}
 
 	for (i = 0; i < available_fmt->audio_fmt_num; i++)
-		dev_dbg(scomp->dev, "%d: ibs: %d obs: %d cpc: %d is_pages: %d\n", i,
-			base_config[i].ibs, base_config[i].obs,
-			base_config[i].cpc, base_config[i].is_pages);
+		dev_dbg(scomp->dev, "%d: ibs: %d obs: %d\n", i,
+			base_config[i].ibs, base_config[i].obs);
 
 	in_format = kcalloc(available_fmt->audio_fmt_num,
 			    sizeof(struct sof_ipc4_audio_format), GFP_KERNEL);
@@ -359,7 +361,8 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget)
 
 	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
 
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt, true);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt,
+				     &ipc4_copier->data.base_config, true);
 	if (ret)
 		goto free_copier;
 
@@ -457,7 +460,8 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
 
 	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
 
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt, true);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt,
+				     &ipc4_copier->data.base_config, true);
 	if (ret)
 		goto free_copier;
 
@@ -665,7 +669,8 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
 	gain->data.init_val = SOF_IPC4_VOL_ZERO_DB;
 
 	/* The out_audio_fmt in topology is ignored as it is not required to be sent to the FW */
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &gain->available_fmt, false);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &gain->available_fmt, &gain->base_config,
+				     false);
 	if (ret)
 		goto err;
 
@@ -731,7 +736,8 @@ static int sof_ipc4_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
 	swidget->private = mixer;
 
 	/* The out_audio_fmt in topology is ignored as it is not required to be sent to the FW */
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &mixer->available_fmt, false);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &mixer->available_fmt,
+				     &mixer->base_config, false);
 	if (ret)
 		goto err;
 
@@ -762,7 +768,8 @@ static int sof_ipc4_widget_setup_comp_src(struct snd_sof_widget *swidget)
 	swidget->private = src;
 
 	/* The out_audio_fmt in topology is ignored as it is not required by SRC */
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &src->available_fmt, false);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &src->available_fmt, &src->base_config,
+				     false);
 	if (ret)
 		goto err;
 
Signature · 1 line
2.39.2
author maintainer
#6 lore raw

PATCH 6/11 ASoC: SOF: ipc4-topology: Always parse the output formats in topology

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Parse the output formats available in topology always. Whether the output format is sent in the init instance payload or not is decided when sof_ipc4_init_audio_fmt() is invoked.

---
 sound/soc/sof/ipc4-topology.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
sound/soc/sof/ipc4-topology.c +6 -16
index b6933fa1a36d..0e1e4fc9224c 100644
@@ -171,15 +171,13 @@ static void sof_ipc4_dbg_audio_format(struct device *dev,
  * @swidget: pointer to struct snd_sof_widget containing tuples
  * @available_fmt: pointer to struct sof_ipc4_available_audio_format being filling in
  * @module_base_cfg: Pointer to the base_config in the module init IPC payload
- * @has_out_format: true if available_fmt contains output format
  *
  * Return: 0 if successful
  */
 static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 				  struct snd_sof_widget *swidget,
 				  struct sof_ipc4_available_audio_format *available_fmt,
-				  struct sof_ipc4_base_module_cfg *module_base_cfg,
-				  bool has_out_format)
+				  struct sof_ipc4_base_module_cfg *module_base_cfg)
 {
 	struct sof_ipc4_base_module_cfg *base_config;
 	struct sof_ipc4_audio_format *out_format, *in_format;
@@ -249,9 +247,6 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 				  sizeof(struct sof_ipc4_audio_format),
 				  available_fmt->audio_fmt_num);
 
-	if (!has_out_format)
-		return 0;
-
 	out_format = kcalloc(available_fmt->audio_fmt_num, sizeof(*out_format), GFP_KERNEL);
 	if (!out_format) {
 		ret = -ENOMEM;
@@ -362,7 +357,7 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget)
 	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
 
 	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt,
-				     &ipc4_copier->data.base_config, true);
+				     &ipc4_copier->data.base_config);
 	if (ret)
 		goto free_copier;
 
@@ -461,7 +456,7 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
 	dev_dbg(scomp->dev, "Updating IPC structure for %s\n", swidget->widget->name);
 
 	ret = sof_ipc4_get_audio_fmt(scomp, swidget, available_fmt,
-				     &ipc4_copier->data.base_config, true);
+				     &ipc4_copier->data.base_config);
 	if (ret)
 		goto free_copier;
 
@@ -668,9 +663,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
 	gain->data.channels = SOF_IPC4_GAIN_ALL_CHANNELS_MASK;
 	gain->data.init_val = SOF_IPC4_VOL_ZERO_DB;
 
-	/* The out_audio_fmt in topology is ignored as it is not required to be sent to the FW */
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &gain->available_fmt, &gain->base_config,
-				     false);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &gain->available_fmt, &gain->base_config);
 	if (ret)
 		goto err;
 
@@ -735,9 +728,8 @@ static int sof_ipc4_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
 
 	swidget->private = mixer;
 
-	/* The out_audio_fmt in topology is ignored as it is not required to be sent to the FW */
 	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &mixer->available_fmt,
-				     &mixer->base_config, false);
+				     &mixer->base_config);
 	if (ret)
 		goto err;
 
@@ -767,9 +759,7 @@ static int sof_ipc4_widget_setup_comp_src(struct snd_sof_widget *swidget)
 
 	swidget->private = src;
 
-	/* The out_audio_fmt in topology is ignored as it is not required by SRC */
-	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &src->available_fmt, &src->base_config,
-				     false);
+	ret = sof_ipc4_get_audio_fmt(scomp, swidget, &src->available_fmt, &src->base_config);
 	if (ret)
 		goto err;
 
Signature · 1 line
2.39.2
author maintainer
#7 lore raw

PATCH 7/11 ASoC: SOF: ipc4-topology: Modify the type of available input/output formats

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Introduce a new struct sof_ipc4_pin_format which contains the pin index and the buffer size. Replace the type of available input/output audio formats in struct sof_ipc4_available_audio_format with this new struct type and rename them to input_pin_fmts and output_pin_fmts.

Also, add a new token, SOF_TKN_CAVS_AUDIO_FORMAT_PIN_INDEX that will be used to parse the pin index for the audio format from topology. Currently we only set the audio format for Pin 0 in topology, so the default value will be 0 for all audio formats.

Finally, parse the pin_index and the input/output buffer sizes along with audio formats into the pin_format arrays in struct sof_ipc4_available_audio_format. This makes the base_config array in struct sof_ipc4_available_audio_format redundant. So remove it. This change will allow the addition of audio formats for the non-zero pins in topology transparent to the topology parser in the kernel.

---
 include/uapi/sound/sof/tokens.h |   1 +
 sound/soc/sof/ipc4-pcm.c        |   2 +-
 sound/soc/sof/ipc4-topology.c   | 181 +++++++++++++-------------------
 sound/soc/sof/ipc4-topology.h   |  27 +++--
 sound/soc/sof/sof-audio.h       |   1 -
 sound/soc/sof/topology.c        |   1 -
 6 files changed, 96 insertions(+), 117 deletions(-)
include/uapi/sound/sof/tokens.h +1 -0
index 9e91e2640dd4..92360601b49c 100644
@@ -180,6 +180,7 @@
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_INTERLEAVING_STYLE	1906
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_FMT_CFG	1907
 #define SOF_TKN_CAVS_AUDIO_FORMAT_IN_SAMPLE_TYPE	1908
+#define SOF_TKN_CAVS_AUDIO_FORMAT_PIN_INDEX		1909
 /* intentional token numbering discontinuity, reserved for future use */
 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_RATE	1930
 #define SOF_TKN_CAVS_AUDIO_FORMAT_OUT_BIT_DEPTH	1931
sound/soc/sof/ipc4-pcm.c +1 -1
index a679c08d9bb1..701da5ee4e4e 100644
@@ -389,7 +389,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
 	snd_mask_none(fmt);
 	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
 
-	rate->min = ipc4_copier->available_fmt.input_audio_fmts->sampling_frequency;
+	rate->min = ipc4_copier->available_fmt.input_pin_fmts->audio_fmt.sampling_frequency;
 	rate->max = rate->min;
 
 	switch (ipc4_copier->dai_type) {
sound/soc/sof/ipc4-topology.c +74 -107

394 lines not on this page · raw message

sound/soc/sof/ipc4-topology.h +20 -7
index 696d6c39a21b..2d9b1ba549f7 100644
@@ -145,19 +145,32 @@ struct ipc4_pipeline_set_state_data {
 	DECLARE_FLEX_ARRAY(u32, pipeline_ids);
 } __packed;
 
+/**
+ * struct sof_ipc4_pin_format - Module pin format
+ * @pin_index: pin index
+ * @buffer_size: buffer size in bytes
+ * @audio_fmt: audio format for the pin
+ *
+ * This structure can be used for both output or input pins and the pin_index is relative to the
+ * pin type i.e output/input pin
+ */
+struct sof_ipc4_pin_format {
+	u32 pin_index;
+	u32 buffer_size;
+	struct sof_ipc4_audio_format audio_fmt;
+};
+
 /**
  * struct sof_ipc4_available_audio_format - Available audio formats
- * @base_config: Available base config
- * @out_audio_fmt: Available output audio format
- * @input_audio_fmts: Available input audio formats
+ * @output_pin_fmts: Available output pin formats
+ * @input_pin_fmts: Available input pin formats
  * @ref_audio_fmt: Reference audio format to match runtime audio format
  * @audio_fmt_num: Number of available audio formats
  */
 struct sof_ipc4_available_audio_format {
-	struct sof_ipc4_base_module_cfg *base_config;
-	struct sof_ipc4_audio_format *out_audio_fmt;
-	struct sof_ipc4_audio_format *input_audio_fmts;
-	struct sof_ipc4_audio_format *ref_audio_fmt;
+	struct sof_ipc4_pin_format *output_pin_fmts;
+	struct sof_ipc4_pin_format *input_pin_fmts;
+	struct sof_ipc4_pin_format *ref_audio_fmt;
 	int audio_fmt_num;
 };
 
sound/soc/sof/sof-audio.h +0 -1
index 4504f9efdc50..d220af5f08fb 100644
@@ -256,7 +256,6 @@ enum sof_tokens {
 	SOF_COMP_EXT_TOKENS,
 	SOF_IN_AUDIO_FORMAT_TOKENS,
 	SOF_OUT_AUDIO_FORMAT_TOKENS,
-	SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
 	SOF_COPIER_DEEP_BUFFER_TOKENS,
 	SOF_COPIER_TOKENS,
 	SOF_AUDIO_FMT_NUM_TOKENS,
sound/soc/sof/topology.c +0 -1
index 2d76ab13b3d1..3a091f18731f 100644
@@ -1232,7 +1232,6 @@ static int sof_widget_parse_tokens(struct snd_soc_component *scomp, struct snd_s
 			continue;
 		case SOF_IN_AUDIO_FORMAT_TOKENS:
 		case SOF_OUT_AUDIO_FORMAT_TOKENS:
-		case SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS:
 			num_sets = sof_get_token_value(SOF_TKN_COMP_NUM_AUDIO_FORMATS,
 						       swidget->tuples, swidget->num_tuples);
 
Signature · 1 line
2.39.2
author maintainer
#8 lore raw

PATCH 8/11 ASoC: SOF: ipc4-topology: Modify the signature of sof_ipc4_init_audio_fmt()

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Only the copier needs to set the output format in its IPC payload. So move the code to set the output format inside sof_ipc4_prepare_copier_module() and modify the signature of sof_ipc4_init_audio_fmt() to remove the out_format argument.

---
 sound/soc/sof/ipc4-topology.c | 38 ++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 21 deletions(-)
sound/soc/sof/ipc4-topology.c +17 -21
index c462db95f3b2..baa8f4fa6d20 100644
@@ -828,7 +828,6 @@ static int sof_ipc4_widget_assign_instance_id(struct snd_sof_dev *sdev,
 static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
 				   struct snd_sof_widget *swidget,
 				   struct sof_ipc4_base_module_cfg *base_config,
-				   struct sof_ipc4_audio_format *out_format,
 				   struct snd_pcm_hw_params *params,
 				   struct sof_ipc4_available_audio_format *available_fmt)
 {
@@ -890,7 +889,7 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
 
 	/* copy input format */
 	memcpy(&base_config->audio_fmt, &available_fmt->input_pin_fmts[i].audio_fmt,
-	       sizeof(*out_format));
+	       sizeof(struct sof_ipc4_audio_format));
 
 	/* set base_cfg ibs/obs */
 	base_config->ibs = available_fmt->input_pin_fmts[i].buffer_size;
@@ -899,20 +898,6 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
 	dev_dbg(sdev->dev, "Init input audio formats for %s\n", swidget->widget->name);
 	sof_ipc4_dbg_audio_format(sdev->dev, &available_fmt->input_pin_fmts[i], 1);
 
-	if (out_format) {
-		/*
-		 * Current topology defines pin 0 input and output formats only in pairs.
-		 * This assumes that the pin 0 formats are defined before all other pins.
-		 * So pick the output audio format with the same index as the chosen
-		 * input format. This logic will need to be updated when the format definitions
-		 * in topology change.
-		 */
-		memcpy(out_format, &available_fmt->output_pin_fmts[i].audio_fmt,
-		       sizeof(*out_format));
-		dev_dbg(sdev->dev, "Init output audio formats for %s\n", swidget->widget->name);
-		sof_ipc4_dbg_audio_format(sdev->dev, &available_fmt->output_pin_fmts[i], 1);
-	}
-
 	/* Return the index of the matched format */
 	return i;
 }
@@ -1182,12 +1167,23 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 	}
 
 	/* set input and output audio formats */
-	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &copier_data->base_config,
-				      &copier_data->out_format, ref_params,
+	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &copier_data->base_config, ref_params,
 				      available_fmt);
 	if (ret < 0)
 		return ret;
 
+	/*
+	 * Set the output format. Current topology defines pin 0 input and output formats in pairs.
+	 * This assumes that the pin 0 formats are defined before all other pins.
+	 * So pick the output audio format with the same index as the chosen
+	 * input format. This logic will need to be updated when the format definitions
+	 * in topology change.
+	 */
+	memcpy(&copier_data->out_format, &available_fmt->output_pin_fmts[ret].audio_fmt,
+	       sizeof(struct sof_ipc4_audio_format));
+	dev_dbg(sdev->dev, "Output audio format for %s\n", swidget->widget->name);
+	sof_ipc4_dbg_audio_format(sdev->dev, &available_fmt->output_pin_fmts[ret], 1);
+
 	switch (swidget->id) {
 	case snd_soc_dapm_dai_in:
 	case snd_soc_dapm_dai_out:
@@ -1361,7 +1357,7 @@ static int sof_ipc4_prepare_gain_module(struct snd_sof_widget *swidget,
 
 	/* output format is not required to be sent to the FW for gain */
 	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &gain->base_config,
-				      NULL, pipeline_params, available_fmt);
+				      pipeline_params, available_fmt);
 	if (ret < 0)
 		return ret;
 
@@ -1387,7 +1383,7 @@ static int sof_ipc4_prepare_mixer_module(struct snd_sof_widget *swidget,
 
 	/* output format is not required to be sent to the FW for mixer */
 	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &mixer->base_config,
-				      NULL, pipeline_params, available_fmt);
+				      pipeline_params, available_fmt);
 	if (ret < 0)
 		return ret;
 
@@ -1413,7 +1409,7 @@ static int sof_ipc4_prepare_src_module(struct snd_sof_widget *swidget,
 
 	/* output format is not required to be sent to the FW for SRC */
 	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &src->base_config,
-				      NULL, pipeline_params, available_fmt);
+				      pipeline_params, available_fmt);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.39.2
author maintainer
#11 lore raw

PATCH 11/11 ASoC: SOF: ipc4-topology: Search only pin 0 formats

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Base config only contains the input/output audio formats for pin 0. So match only the pin 0 formats during runtime format selection.

---
 sound/soc/sof/ipc4-topology.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/sof/ipc4-topology.c +4 -1
index c91a90dd8a6e..683182e53a32 100644
@@ -877,12 +877,15 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
 	}
 
 	/*
-	 * Search supported audio formats to match rate, channels ,and
+	 * Search supported audio formats with pin index 0 to match rate, channels ,and
 	 * sample_valid_bytes from runtime params
 	 */
 	for (i = 0; i < pin_fmts_size; i++) {
 		struct sof_ipc4_audio_format *fmt = &pin_fmts[i].audio_fmt;
 
+		if (pin_fmts[i].pin_index)
+			continue;
+
 		rate = fmt->sampling_frequency;
 		channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg);
 		valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt->fmt_cfg);
Signature · 1 line
2.39.2
author maintainer
#9 lore raw

PATCH 9/11 ASoC: SOF: ipc4-topology: Remove the ref_audio_fmt field

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

Remove the field in struct sof_ipc4_available_audio_format and pass the format list to be searched as an argument to sof_ipc4_init_audio_fmt() directly.

---
 sound/soc/sof/ipc4-topology.c | 42 +++++++++++++++--------------------
 sound/soc/sof/ipc4-topology.h |  2 --
 2 files changed, 18 insertions(+), 26 deletions(-)
sound/soc/sof/ipc4-topology.c +18 -24
index baa8f4fa6d20..3aacc440a5e4 100644
@@ -829,16 +829,16 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
 				   struct snd_sof_widget *swidget,
 				   struct sof_ipc4_base_module_cfg *base_config,
 				   struct snd_pcm_hw_params *params,
-				   struct sof_ipc4_available_audio_format *available_fmt)
+				   struct sof_ipc4_available_audio_format *available_fmt,
+				   struct sof_ipc4_pin_format *pin_fmts)
 {
-	struct sof_ipc4_pin_format *pin_fmt = available_fmt->ref_audio_fmt;
 	u32 valid_bits;
 	u32 channels;
 	u32 rate;
 	int sample_valid_bits;
 	int i;
 
-	if (!pin_fmt) {
+	if (!pin_fmts) {
 		dev_err(sdev->dev, "no reference formats for %s\n", swidget->widget->name);
 		return -EINVAL;
 	}
@@ -868,7 +868,7 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
 	 * sample_valid_bytes from runtime params
 	 */
 	for (i = 0; i < available_fmt->audio_fmt_num; i++) {
-		struct sof_ipc4_audio_format *fmt = &pin_fmt[i].audio_fmt;
+		struct sof_ipc4_audio_format *fmt = &pin_fmts[i].audio_fmt;
 
 		rate = fmt->sampling_frequency;
 		channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg);
@@ -1058,6 +1058,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 	struct sof_ipc4_available_audio_format *available_fmt;
 	struct snd_soc_component *scomp = swidget->scomp;
 	struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
+	struct sof_ipc4_pin_format *format_list_to_search;
 	struct sof_ipc4_copier_data *copier_data;
 	struct snd_pcm_hw_params *ref_params;
 	struct sof_ipc4_copier *ipc4_copier;
@@ -1102,9 +1103,9 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 		 * for capture.
 		 */
 		if (dir == SNDRV_PCM_STREAM_PLAYBACK)
-			available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
+			format_list_to_search = available_fmt->input_pin_fmts;
 		else
-			available_fmt->ref_audio_fmt = available_fmt->output_pin_fmts;
+			format_list_to_search = available_fmt->output_pin_fmts;
 
 		copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK;
 		copier_data->gtw_cfg.node_id |=
@@ -1124,7 +1125,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 		copier_data = &ipc4_copier->data;
 		available_fmt = &ipc4_copier->available_fmt;
 		if (dir == SNDRV_PCM_STREAM_CAPTURE) {
-			available_fmt->ref_audio_fmt = available_fmt->output_pin_fmts;
+			format_list_to_search = available_fmt->output_pin_fmts;
 
 			/*
 			 * modify the input params for the dai copier as it only supports
@@ -1134,7 +1135,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 			snd_mask_none(fmt);
 			snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
 		} else {
-			available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
+			format_list_to_search = available_fmt->input_pin_fmts;
 		}
 
 		ref_params = pipeline_params;
@@ -1154,8 +1155,8 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 		copier_data = &ipc4_copier->data;
 		available_fmt = &ipc4_copier->available_fmt;
 
-		/* Use the input formats as the reference to match pcm params */
-		available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
+		/* Use the input formats to match pcm params */
+		format_list_to_search = available_fmt->input_pin_fmts;
 		ref_params = pipeline_params;
 
 		break;
@@ -1168,7 +1169,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 
 	/* set input and output audio formats */
 	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &copier_data->base_config, ref_params,
-				      available_fmt);
+				      available_fmt, format_list_to_search);
 	if (ret < 0)
 		return ret;
 
@@ -1353,11 +1354,9 @@ static int sof_ipc4_prepare_gain_module(struct snd_sof_widget *swidget,
 	struct sof_ipc4_available_audio_format *available_fmt = &gain->available_fmt;
 	int ret;
 
-	available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
-
-	/* output format is not required to be sent to the FW for gain */
 	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &gain->base_config,
-				      pipeline_params, available_fmt);
+				      pipeline_params, available_fmt,
+				      available_fmt->input_pin_fmts);
 	if (ret < 0)
 		return ret;
 
@@ -1378,12 +1377,9 @@ static int sof_ipc4_prepare_mixer_module(struct snd_sof_widget *swidget,
 	struct sof_ipc4_available_audio_format *available_fmt = &mixer->available_fmt;
 	int ret;
 
-	/* only 32bit is supported by mixer */
-	available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
-
-	/* output format is not required to be sent to the FW for mixer */
 	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &mixer->base_config,
-				      pipeline_params, available_fmt);
+				      pipeline_params, available_fmt,
+				      available_fmt->input_pin_fmts);
 	if (ret < 0)
 		return ret;
 
@@ -1405,11 +1401,9 @@ static int sof_ipc4_prepare_src_module(struct snd_sof_widget *swidget,
 	struct snd_interval *rate;
 	int ret;
 
-	available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
-
-	/* output format is not required to be sent to the FW for SRC */
 	ret = sof_ipc4_init_audio_fmt(sdev, swidget, &src->base_config,
-				      pipeline_params, available_fmt);
+				      pipeline_params, available_fmt,
+				      available_fmt->input_pin_fmts);
 	if (ret < 0)
 		return ret;
 
sound/soc/sof/ipc4-topology.h +0 -2
index 2d9b1ba549f7..6359ef8736ae 100644
@@ -164,13 +164,11 @@ struct sof_ipc4_pin_format {
  * struct sof_ipc4_available_audio_format - Available audio formats
  * @output_pin_fmts: Available output pin formats
  * @input_pin_fmts: Available input pin formats
- * @ref_audio_fmt: Reference audio format to match runtime audio format
  * @audio_fmt_num: Number of available audio formats
  */
 struct sof_ipc4_available_audio_format {
 	struct sof_ipc4_pin_format *output_pin_fmts;
 	struct sof_ipc4_pin_format *input_pin_fmts;
-	struct sof_ipc4_pin_format *ref_audio_fmt;
 	int audio_fmt_num;
 };
 
Signature · 1 line
2.39.2
author maintainer
#10 lore raw

PATCH 10/11 ASoC: SOF: ipc4-topology: Add new tokens for input/output pin format count

In reply to Peter Ujfalusi

From: Ranjani Sridharan <[email protected]>

In preparation for handling processing modules with different input/output pin counts, introduce two new tokens for input/output audio format counts. Use these token values to parse all the available audio formats from topology.

---
 include/uapi/sound/sof/tokens.h |   2 +
 sound/soc/sof/ipc4-topology.c   | 143 +++++++++++++++++++-------------
 sound/soc/sof/ipc4-topology.h   |   6 +-
 sound/soc/sof/topology.c        |  42 ++++++----
 4 files changed, 116 insertions(+), 77 deletions(-)
include/uapi/sound/sof/tokens.h +2 -0
index 92360601b49c..bd02842124f9 100644
@@ -96,6 +96,8 @@
  */
 #define SOF_TKN_COMP_INPUT_PIN_BINDING_WNAME	413
 #define SOF_TKN_COMP_OUTPUT_PIN_BINDING_WNAME	414
+#define SOF_TKN_COMP_NUM_INPUT_AUDIO_FORMATS	415
+#define SOF_TKN_COMP_NUM_OUTPUT_AUDIO_FORMATS	416
 
 
 /* SSP */
sound/soc/sof/ipc4-topology.c +85 -58

268 lines not on this page · raw message

sound/soc/sof/ipc4-topology.h +4 -2
index 6359ef8736ae..fad7a628f782 100644
@@ -164,12 +164,14 @@ struct sof_ipc4_pin_format {
  * struct sof_ipc4_available_audio_format - Available audio formats
  * @output_pin_fmts: Available output pin formats
  * @input_pin_fmts: Available input pin formats
- * @audio_fmt_num: Number of available audio formats
+ * @num_input_formats: Number of input pin formats
+ * @num_output_formats: Number of output pin formats
  */
 struct sof_ipc4_available_audio_format {
 	struct sof_ipc4_pin_format *output_pin_fmts;
 	struct sof_ipc4_pin_format *input_pin_fmts;
-	int audio_fmt_num;
+	u32 num_input_formats;
+	u32 num_output_formats;
 };
 
 /**
sound/soc/sof/topology.c +25 -17

60 lines not on this page · raw message

Signature · 1 line
2.39.2
maintainer
#12 lore raw
In reply to Peter Ujfalusi
Quoted 9 lines · Peter Ujfalusi

The modules in IPC4 can have multiple 'pins' on their input and output and these pins can receive or output audio in different formats.
Currently we assume that all pins are using the same format which is a limitation that needs to be lifted in order to support more complex components.

This series will extend and rework the format handling to allow different formats on pins.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/11] ASoC: SOF: rename a couple of tokens

        commit: 3f738e4a126c9ee082d814edeb7416697f9e2b37
[02/11] ASoC: SOF: Use input/output pin consistently
        commit: bb79f2a608245cd92b3183d77aec6902e51de950
[03/11] ASoC: SOF: ipc4-topology: Add a new field in struct sof_ipc4_available_audio_format
        commit: e63a73f94fef0cf592aa7bb55f907007d747af4f
[04/11] ASoC: SOF: ipc4-topology: Do not parse the DMA_BUFFER_SIZE token
        commit: 594c1bb9ff7365b90cb4d325deb8c38ddda90557
[05/11] ASoC: SOF: ipc4-topology: Parse the SOF_COMP_TOKENS only once
        commit: 171d5ccedbb6277a8f9a3eae36e4f465ddc3187f
[06/11] ASoC: SOF: ipc4-topology: Always parse the output formats in topology
        commit: 8abc9ab956b5756693710e1e09557e0189f01bef
[07/11] ASoC: SOF: ipc4-topology: Modify the type of available input/output formats
        commit: 7ab6b1e8302cf7a9bc8808c43b3e751e4148a351
[08/11] ASoC: SOF: ipc4-topology: Modify the signature of sof_ipc4_init_audio_fmt()
        commit: 9c560549e32bc2951c67106c59587f9f7bf6b70e
[09/11] ASoC: SOF: ipc4-topology: Remove the ref_audio_fmt field
        commit: f534a94c3d765bcd5bdf10271a265883be2b4030
[10/11] ASoC: SOF: ipc4-topology: Add new tokens for input/output pin format count
        commit: 4fdef47a44d6ff735902dfe740918f23932225ca
[11/11] ASoC: SOF: ipc4-topology: Search only pin 0 formats
        commit: ad70f2f0e6e38675d7805482d2c625fca5756a2e

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark