mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
ASoC: SOF: ipc4-topology: Add support for process modules with no input pins
A tone generator module can be a type of processing module with no input pins. Adjust the logic to set the reference params for selecting output format and the basecfg format based on the output format. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://patch.msgid.link/20260204081833.16630-7-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
15a55ec2f8
commit
42d0f8695d
1 changed files with 39 additions and 11 deletions
|
|
@ -2753,12 +2753,14 @@ static int sof_ipc4_prepare_process_module(struct snd_sof_widget *swidget,
|
|||
int input_fmt_index = 0;
|
||||
int ret;
|
||||
|
||||
input_fmt_index = sof_ipc4_init_input_audio_fmt(sdev, swidget,
|
||||
&process->base_config,
|
||||
pipeline_params,
|
||||
available_fmt);
|
||||
if (input_fmt_index < 0)
|
||||
return input_fmt_index;
|
||||
if (available_fmt->num_input_formats) {
|
||||
input_fmt_index = sof_ipc4_init_input_audio_fmt(sdev, swidget,
|
||||
&process->base_config,
|
||||
pipeline_params,
|
||||
available_fmt);
|
||||
if (input_fmt_index < 0)
|
||||
return input_fmt_index;
|
||||
}
|
||||
|
||||
/* Configure output audio format only if the module supports output */
|
||||
if (available_fmt->num_output_formats) {
|
||||
|
|
@ -2767,12 +2769,28 @@ static int sof_ipc4_prepare_process_module(struct snd_sof_widget *swidget,
|
|||
u32 out_ref_rate, out_ref_channels;
|
||||
int out_ref_valid_bits, out_ref_type;
|
||||
|
||||
in_fmt = &available_fmt->input_pin_fmts[input_fmt_index].audio_fmt;
|
||||
if (available_fmt->num_input_formats) {
|
||||
in_fmt = &available_fmt->input_pin_fmts[input_fmt_index].audio_fmt;
|
||||
|
||||
out_ref_rate = in_fmt->sampling_frequency;
|
||||
out_ref_channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(in_fmt->fmt_cfg);
|
||||
out_ref_valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(in_fmt->fmt_cfg);
|
||||
out_ref_type = sof_ipc4_fmt_cfg_to_type(in_fmt->fmt_cfg);
|
||||
out_ref_rate = in_fmt->sampling_frequency;
|
||||
out_ref_channels =
|
||||
SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(in_fmt->fmt_cfg);
|
||||
out_ref_valid_bits =
|
||||
SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(in_fmt->fmt_cfg);
|
||||
out_ref_type = sof_ipc4_fmt_cfg_to_type(in_fmt->fmt_cfg);
|
||||
} else {
|
||||
/* for modules without input formats, use FE params as reference */
|
||||
out_ref_rate = params_rate(fe_params);
|
||||
out_ref_channels = params_channels(fe_params);
|
||||
ret = sof_ipc4_get_sample_type(sdev, fe_params);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
out_ref_type = (u32)ret;
|
||||
|
||||
out_ref_valid_bits = sof_ipc4_get_valid_bits(sdev, fe_params);
|
||||
if (out_ref_valid_bits < 0)
|
||||
return out_ref_valid_bits;
|
||||
}
|
||||
|
||||
output_fmt_index = sof_ipc4_init_output_audio_fmt(sdev, swidget,
|
||||
&process->base_config,
|
||||
|
|
@ -2800,6 +2818,16 @@ static int sof_ipc4_prepare_process_module(struct snd_sof_widget *swidget,
|
|||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* set base cfg to match the first output format if there are no input formats */
|
||||
if (!available_fmt->num_input_formats) {
|
||||
struct sof_ipc4_audio_format *out_fmt;
|
||||
|
||||
out_fmt = &available_fmt->output_pin_fmts[0].audio_fmt;
|
||||
|
||||
/* copy output format */
|
||||
memcpy(&process->base_config.audio_fmt, out_fmt, sizeof(*out_fmt));
|
||||
}
|
||||
}
|
||||
|
||||
sof_ipc4_dbg_module_audio_format(sdev->dev, swidget, available_fmt,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue