summaryrefslogtreecommitdiff
path: root/sound/soc/sof/ipc4-topology.c
diff options
context:
space:
mode:
authorBard Liao <yung-chuan.liao@linux.intel.com>2022-06-09 06:26:43 +0300
committerMark Brown <broonie@kernel.org>2022-06-10 15:32:10 +0300
commita45a4d4390b7a562f8edc3518ba6cd2ad17be5bc (patch)
tree7a2b8c77953a2ab7dbaa20bed6839f1dde623f27 /sound/soc/sof/ipc4-topology.c
parent9e2b5d33fec938ea2518735f2b66313cab89bb61 (diff)
downloadlinux-a45a4d4390b7a562f8edc3518ba6cd2ad17be5bc.tar.xz
ASoC: SOF: IPC4: add sdw blob
Add IPC4 SoundWire blob. It includes a common IPC4 gateway and a multiple ALH configuration struct which is used for storing the aggregated SoundWire stream information. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220609032643.916882-24-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc4-topology.c')
-rw-r--r--sound/soc/sof/ipc4-topology.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index d5cb08ec1af1..cb0f0823b8eb 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -476,6 +476,20 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
ipc4_copier->data.gtw_cfg.node_id = SOF_IPC4_NODE_TYPE(node_type);
switch (ipc4_copier->dai_type) {
+ case SOF_DAI_INTEL_ALH:
+ {
+ struct sof_ipc4_alh_configuration_blob *blob;
+
+ blob = kzalloc(sizeof(*blob), GFP_KERNEL);
+ if (!blob) {
+ ret = -ENOMEM;
+ goto err;
+ }
+
+ ipc4_copier->copier_config = (uint32_t *)blob;
+ ipc4_copier->data.gtw_cfg.config_length = sizeof(*blob) >> 2;
+ break;
+ }
case SOF_DAI_INTEL_SSP:
/* set SSP DAI index as the node_id */
ipc4_copier->data.gtw_cfg.node_id |=
@@ -1053,6 +1067,36 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
if (ret < 0)
return ret;
+ switch (swidget->id) {
+ case snd_soc_dapm_dai_in:
+ case snd_soc_dapm_dai_out:
+ {
+ /*
+ * Only SOF_DAI_INTEL_ALH needs copier_data to set blob.
+ * That's why only ALH dai's blob is set after sof_ipc4_init_audio_fmt
+ */
+ if (ipc4_copier->dai_type == SOF_DAI_INTEL_ALH) {
+ struct sof_ipc4_alh_configuration_blob *blob;
+ u32 ch_map;
+ int i;
+
+ blob = (struct sof_ipc4_alh_configuration_blob *)ipc4_copier->copier_config;
+ /* TODO: add aggregation mode support */
+ blob->alh_cfg.count = 1;
+ blob->alh_cfg.mapping[0].alh_id = copier_data->gtw_cfg.node_id;
+ blob->gw_attr.lp_buffer_alloc = 0;
+
+ /* Get channel_mask from ch_map */
+ ch_map = copier_data->base_config.audio_fmt.ch_map;
+ for (i = 0; ch_map; i++) {
+ if ((ch_map & 0xf) != 0xf)
+ blob->alh_cfg.mapping[0].channel_mask |= BIT(i);
+ ch_map >>= 4;
+ }
+ }
+ }
+ }
+
/* modify the input params for the next widget */
fmt = hw_param_mask(pipeline_params, SNDRV_PCM_HW_PARAM_FORMAT);
out_sample_valid_bits =