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

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.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d1bf5847
...@@ -559,7 +559,7 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget) ...@@ -559,7 +559,7 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
strcmp(w->widget->sname, swidget->widget->sname)) strcmp(w->widget->sname, swidget->widget->sname))
continue; continue;
blob->alh_cfg.count++; blob->alh_cfg.device_count++;
} }
ipc4_copier->copier_config = (uint32_t *)blob; ipc4_copier->copier_config = (uint32_t *)blob;
...@@ -1225,7 +1225,7 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget) ...@@ -1225,7 +1225,7 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget)
unsigned int group_id; unsigned int group_id;
blob = (struct sof_ipc4_alh_configuration_blob *)ipc4_copier->copier_config; 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) - group_id = SOF_IPC4_NODE_INDEX(ipc4_copier->data.gtw_cfg.node_id) -
ALH_MULTI_GTW_BASE; ALH_MULTI_GTW_BASE;
ida_free(&alh_group_ida, group_id); ida_free(&alh_group_ida, group_id);
...@@ -1609,7 +1609,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, ...@@ -1609,7 +1609,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
ch_map >>= 4; ch_map >>= 4;
} }
step = ch_count / blob->alh_cfg.count; step = ch_count / blob->alh_cfg.device_count;
mask = GENMASK(step - 1, 0); mask = GENMASK(step - 1, 0);
/* /*
* Set each gtw_cfg.node_id to blob->alh_cfg.mapping[] * 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, ...@@ -1624,7 +1624,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
dai = w->private; dai = w->private;
alh_copier = (struct sof_ipc4_copier *)dai->private; alh_copier = (struct sof_ipc4_copier *)dai->private;
alh_data = &alh_copier->data; 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 * Set the same channel mask for playback as the audio data is
* duplicated for all speakers. For capture, split the channels * duplicated for all speakers. For capture, split the channels
...@@ -1643,7 +1643,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, ...@@ -1643,7 +1643,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
i++; i++;
} }
if (blob->alh_cfg.count > 1) { if (blob->alh_cfg.device_count > 1) {
int group_id; int group_id;
group_id = ida_alloc_max(&alh_group_ida, ALH_MULTI_GTW_COUNT - 1, group_id = ida_alloc_max(&alh_group_ida, ALH_MULTI_GTW_COUNT - 1,
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff #define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
#define SOF_IPC4_VOL_ZERO_DB 0x7fffffff #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 #define SOF_IPC4_INVALID_NODE_ID 0xffffffff
...@@ -220,18 +220,26 @@ struct sof_ipc4_gtw_attributes { ...@@ -220,18 +220,26 @@ struct sof_ipc4_gtw_attributes {
uint32_t rsvd : 30; uint32_t rsvd : 30;
}; };
/** struct sof_ipc4_alh_multi_gtw_cfg: ALH gateway cfg data /**
* @count: Number of streams (valid items in mapping array) * struct sof_ipc4_dma_device_stream_ch_map: abstract representation of
* @alh_id: ALH stream id of a single ALH stream aggregated * channel mapping to DMAs
* @channel_mask: Channel mask * @device: representation of hardware device address or FIFO
* @mapping: ALH streams * @channel_mask: channels handled by @device. Channels are expected to be
* contiguous
*/
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_alh_multi_gtw_cfg { struct sof_ipc4_dma_stream_ch_map {
uint32_t count; uint32_t device_count;
struct { struct sof_ipc4_dma_device_stream_ch_map mapping[SOF_IPC4_DMA_DEVICE_MAX_COUNT];
uint32_t alh_id;
uint32_t channel_mask;
} mapping[ALH_MAX_NUMBER_OF_GTW];
} __packed; } __packed;
/** struct sof_ipc4_alh_configuration_blob: ALH blob /** struct sof_ipc4_alh_configuration_blob: ALH blob
...@@ -240,7 +248,7 @@ struct sof_ipc4_alh_multi_gtw_cfg { ...@@ -240,7 +248,7 @@ struct sof_ipc4_alh_multi_gtw_cfg {
*/ */
struct sof_ipc4_alh_configuration_blob { struct sof_ipc4_alh_configuration_blob {
struct sof_ipc4_gtw_attributes gw_attr; 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;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment