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>
This commit is contained in:
Bard Liao 2022-06-08 20:26:43 -07:00 committed by Mark Brown
parent 9e2b5d33fe
commit a45a4d4390
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
2 changed files with 69 additions and 0 deletions

View file

@ -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 =

View file

@ -40,6 +40,8 @@
#define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
#define SOF_IPC4_VOL_ZERO_DB 0x7fffffff
#define ALH_MAX_NUMBER_OF_GTW 16
/**
* struct sof_ipc4_pipeline - pipeline config data
* @priority: Priority of this pipeline
@ -112,6 +114,29 @@ 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_alh_multi_gtw_cfg {
uint32_t count;
struct {
uint32_t alh_id;
uint32_t channel_mask;
} mapping[ALH_MAX_NUMBER_OF_GTW];
} __packed;
/** struct sof_ipc4_alh_configuration_blob: ALH blob
* @gw_attr: Gateway attributes
* @alh_cfg: ALH configuration data
*/
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_copier - copier config data
* @data: IPC copier data