Unverified Commit e186e1f2 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown
Browse files

ASoC: SOF: ipc4-topology: extend ALH-specific data structure



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: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-6-pierre-louis.bossart@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d1bf5847
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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,
+21 −13
Original line number Diff line number Diff line
@@ -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;
struct sof_ipc4_dma_device_stream_ch_map {
	uint32_t device;
	uint32_t channel_mask;
	} mapping[ALH_MAX_NUMBER_OF_GTW];
};

/**
 * 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;
};

/**