diff mbox series

[04/20] ASoC: SOF: ipc4-topology: restore gateway config length

Message ID 20230807210959.506849-5-pierre-louis.bossart@linux.intel.com
State Accepted
Commit ef8a29bae82fc635952de97fdd3bcf8e29d8c6be
Headers show
Series ASoC: SOF: Intel: add LunarLake support | expand

Commit Message

Pierre-Louis Bossart Aug. 7, 2023, 9:09 p.m. UTC
The initial code had a logic flaw where the gateway config length kept
increasing after each playback/capture trigger, with the DMA config
TLV being added at every call of sof_ipc4_prepare_copier_module()

This didn't cause any issues with regular playback/capture, but this
was flagged as an error by firmware in the case of multiple amplifiers
on different links.

Fixes: a0659f81c348 ("ASoC: SOF: ipc4-topology: add DMA config TLV to IPC data")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/sof/ipc4-topology.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 9bc94be072aa..0196cbfc0998 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -1746,6 +1746,12 @@  sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 	/* update pipeline memory usage */
 	sof_ipc4_update_resource_usage(sdev, swidget, &copier_data->base_config);
 
+	/*
+	 * Restore gateway config length now that IPC payload is prepared. This avoids
+	 * counting the DMA CONFIG TLV multiple times
+	 */
+	copier_data->gtw_cfg.config_length = gtw_cfg_config_length / 4;
+
 	return 0;
 }