[PATCH 5/9] ASoC: SOF: ipc4-topology: extend ALH-specific data structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



LunarLake introduces a new TLV blob passed to the firmware for DMA
configuration. This TLV structure is directly inspired by the ALH
multi-gateway structure used so far. This patch suggest a transition
to the more abstract structure with no references to ALH.

This is an iso-functionality redefinition of structure, the TLV will
be added in a follow-up patch.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>
Reviewed-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
---
 sound/soc/sof/ipc4-topology.c | 10 +++++-----
 sound/soc/sof/ipc4-topology.h | 34 +++++++++++++++++++++-------------
 2 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index db64e0cb8663..31a97a4248f4 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -559,7 +559,7 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
 			    strcmp(w->widget->sname, swidget->widget->sname))
 				continue;
 
-			blob->alh_cfg.count++;
+			blob->alh_cfg.device_count++;
 		}
 
 		ipc4_copier->copier_config = (uint32_t *)blob;
@@ -1225,7 +1225,7 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget)
 			unsigned int group_id;
 
 			blob = (struct sof_ipc4_alh_configuration_blob *)ipc4_copier->copier_config;
-			if (blob->alh_cfg.count > 1) {
+			if (blob->alh_cfg.device_count > 1) {
 				group_id = SOF_IPC4_NODE_INDEX(ipc4_copier->data.gtw_cfg.node_id) -
 					   ALH_MULTI_GTW_BASE;
 				ida_free(&alh_group_ida, group_id);
@@ -1609,7 +1609,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 				ch_map >>= 4;
 			}
 
-			step = ch_count / blob->alh_cfg.count;
+			step = ch_count / blob->alh_cfg.device_count;
 			mask =  GENMASK(step - 1, 0);
 			/*
 			 * Set each gtw_cfg.node_id to blob->alh_cfg.mapping[]
@@ -1624,7 +1624,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 				dai = w->private;
 				alh_copier = (struct sof_ipc4_copier *)dai->private;
 				alh_data = &alh_copier->data;
-				blob->alh_cfg.mapping[i].alh_id = alh_data->gtw_cfg.node_id;
+				blob->alh_cfg.mapping[i].device = alh_data->gtw_cfg.node_id;
 				/*
 				 * Set the same channel mask for playback as the audio data is
 				 * duplicated for all speakers. For capture, split the channels
@@ -1643,7 +1643,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 
 				i++;
 			}
-			if (blob->alh_cfg.count > 1) {
+			if (blob->alh_cfg.device_count > 1) {
 				int group_id;
 
 				group_id = ida_alloc_max(&alh_group_ida, ALH_MULTI_GTW_COUNT - 1,
diff --git a/sound/soc/sof/ipc4-topology.h b/sound/soc/sof/ipc4-topology.h
index cf007282867b..6b59434fbd60 100644
--- a/sound/soc/sof/ipc4-topology.h
+++ b/sound/soc/sof/ipc4-topology.h
@@ -55,7 +55,7 @@
 #define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
 #define SOF_IPC4_VOL_ZERO_DB	0x7fffffff
 
-#define ALH_MAX_NUMBER_OF_GTW   16
+#define SOF_IPC4_DMA_DEVICE_MAX_COUNT 16
 
 #define SOF_IPC4_INVALID_NODE_ID	0xffffffff
 
@@ -220,18 +220,26 @@ struct sof_ipc4_gtw_attributes {
 	uint32_t rsvd : 30;
 };
 
-/** struct sof_ipc4_alh_multi_gtw_cfg: ALH gateway cfg data
- * @count: Number of streams (valid items in mapping array)
- * @alh_id: ALH stream id of a single ALH stream aggregated
- * @channel_mask: Channel mask
- * @mapping: ALH streams
+/**
+ * struct sof_ipc4_dma_device_stream_ch_map: abstract representation of
+ * channel mapping to DMAs
+ * @device: representation of hardware device address or FIFO
+ * @channel_mask: channels handled by @device. Channels are expected to be
+ * contiguous
  */
-struct sof_ipc4_alh_multi_gtw_cfg {
-	uint32_t count;
-	struct {
-		uint32_t alh_id;
-		uint32_t channel_mask;
-	} mapping[ALH_MAX_NUMBER_OF_GTW];
+struct sof_ipc4_dma_device_stream_ch_map {
+	uint32_t device;
+	uint32_t channel_mask;
+};
+
+/**
+ * struct sof_ipc4_dma_stream_ch_map: DMA configuration data
+ * @device_count: Number valid items in mapping array
+ * @mapping: device address and channel mask
+ */
+struct sof_ipc4_dma_stream_ch_map {
+	uint32_t device_count;
+	struct sof_ipc4_dma_device_stream_ch_map mapping[SOF_IPC4_DMA_DEVICE_MAX_COUNT];
 } __packed;
 
 /** struct sof_ipc4_alh_configuration_blob: ALH blob
@@ -240,7 +248,7 @@ struct sof_ipc4_alh_multi_gtw_cfg {
  */
 struct sof_ipc4_alh_configuration_blob {
 	struct sof_ipc4_gtw_attributes gw_attr;
-	struct sof_ipc4_alh_multi_gtw_cfg alh_cfg;
+	struct sof_ipc4_dma_stream_ch_map alh_cfg;
 };
 
 /**
-- 
2.37.2




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux