ASoC: SOF: ipc4-topology: Add prepare op for DAI type widgets
Define the prepare op for the DAI type widgets for IPC4. The prepare op is responsible for choosing the input/output audio formats for these widgets based on the runtime PCM params, assigning the instance ID and updating the total memory usage for the pipelines these widgets belong to. Co-developed-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Co-developed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220609032643.916882-7-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
904c48c40c
commit
acf5259420
|
@ -706,8 +706,13 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget)
|
|||
pipeline = pipe_widget->private;
|
||||
pipeline->mem_usage = 0;
|
||||
|
||||
if (WIDGET_IS_AIF(swidget->id))
|
||||
if (WIDGET_IS_AIF(swidget->id)) {
|
||||
ipc4_copier = swidget->private;
|
||||
} else if (WIDGET_IS_DAI(swidget->id)) {
|
||||
struct snd_sof_dai *dai = swidget->private;
|
||||
|
||||
ipc4_copier = dai->private;
|
||||
}
|
||||
|
||||
if (ipc4_copier) {
|
||||
kfree(ipc4_copier->ipc_config_data);
|
||||
|
@ -776,6 +781,34 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
|
|||
ref_params = fe_params;
|
||||
break;
|
||||
}
|
||||
case snd_soc_dapm_dai_in:
|
||||
case snd_soc_dapm_dai_out:
|
||||
{
|
||||
struct snd_sof_dai *dai = swidget->private;
|
||||
|
||||
ipc4_copier = (struct sof_ipc4_copier *)dai->private;
|
||||
copier_data = &ipc4_copier->data;
|
||||
available_fmt = &ipc4_copier->available_fmt;
|
||||
if (dir == SNDRV_PCM_STREAM_CAPTURE) {
|
||||
available_fmt->ref_audio_fmt = available_fmt->out_audio_fmt;
|
||||
ref_audio_fmt_size = sizeof(struct sof_ipc4_audio_format);
|
||||
|
||||
/*
|
||||
* modify the input params for the dai copier as it only supports
|
||||
* 32-bit always
|
||||
*/
|
||||
fmt = hw_param_mask(pipeline_params, SNDRV_PCM_HW_PARAM_FORMAT);
|
||||
snd_mask_none(fmt);
|
||||
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
|
||||
} else {
|
||||
available_fmt->ref_audio_fmt = &available_fmt->base_config->audio_fmt;
|
||||
ref_audio_fmt_size = sizeof(struct sof_ipc4_base_module_cfg);
|
||||
}
|
||||
|
||||
ref_params = pipeline_params;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
dev_err(sdev->dev, "unsupported type %d for copier %s",
|
||||
swidget->id, swidget->widget->name);
|
||||
|
@ -879,9 +912,13 @@ static const struct sof_ipc_tplg_widget_ops tplg_ipc4_widget_ops[SND_SOC_DAPM_TY
|
|||
sof_ipc4_prepare_copier_module,
|
||||
sof_ipc4_unprepare_copier_module},
|
||||
[snd_soc_dapm_dai_in] = {sof_ipc4_widget_setup_comp_dai, sof_ipc4_widget_free_comp_dai,
|
||||
dai_token_list, ARRAY_SIZE(dai_token_list), NULL, NULL, NULL},
|
||||
dai_token_list, ARRAY_SIZE(dai_token_list), NULL,
|
||||
sof_ipc4_prepare_copier_module,
|
||||
sof_ipc4_unprepare_copier_module},
|
||||
[snd_soc_dapm_dai_out] = {sof_ipc4_widget_setup_comp_dai, sof_ipc4_widget_free_comp_dai,
|
||||
dai_token_list, ARRAY_SIZE(dai_token_list), NULL, NULL, NULL},
|
||||
dai_token_list, ARRAY_SIZE(dai_token_list), NULL,
|
||||
sof_ipc4_prepare_copier_module,
|
||||
sof_ipc4_unprepare_copier_module},
|
||||
[snd_soc_dapm_scheduler] = {sof_ipc4_widget_setup_comp_pipeline, sof_ipc4_widget_free_comp,
|
||||
pipeline_token_list, ARRAY_SIZE(pipeline_token_list), NULL,
|
||||
NULL, NULL},
|
||||
|
|
Loading…
Reference in New Issue