@@ -2753,12 +2753,14 @@ static int sof_ipc4_prepare_process_module(struct snd_sof_widget *swidget,
27532753 int input_fmt_index = 0 ;
27542754 int ret ;
27552755
2756- input_fmt_index = sof_ipc4_init_input_audio_fmt (sdev , swidget ,
2757- & process -> base_config ,
2758- pipeline_params ,
2759- available_fmt );
2760- if (input_fmt_index < 0 )
2761- return input_fmt_index ;
2756+ if (available_fmt -> num_input_formats ) {
2757+ input_fmt_index = sof_ipc4_init_input_audio_fmt (sdev , swidget ,
2758+ & process -> base_config ,
2759+ pipeline_params ,
2760+ available_fmt );
2761+ if (input_fmt_index < 0 )
2762+ return input_fmt_index ;
2763+ }
27622764
27632765 /* Configure output audio format only if the module supports output */
27642766 if (available_fmt -> num_output_formats ) {
@@ -2767,12 +2769,26 @@ static int sof_ipc4_prepare_process_module(struct snd_sof_widget *swidget,
27672769 u32 out_ref_rate , out_ref_channels ;
27682770 int out_ref_valid_bits , out_ref_type ;
27692771
2770- in_fmt = & available_fmt -> input_pin_fmts [input_fmt_index ].audio_fmt ;
2772+ if (available_fmt -> num_input_formats ) {
2773+ in_fmt = & available_fmt -> input_pin_fmts [input_fmt_index ].audio_fmt ;
27712774
2772- out_ref_rate = in_fmt -> sampling_frequency ;
2773- out_ref_channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT (in_fmt -> fmt_cfg );
2774- out_ref_valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH (in_fmt -> fmt_cfg );
2775- out_ref_type = sof_ipc4_fmt_cfg_to_type (in_fmt -> fmt_cfg );
2775+ out_ref_rate = in_fmt -> sampling_frequency ;
2776+ out_ref_channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT (in_fmt -> fmt_cfg );
2777+ out_ref_valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH (in_fmt -> fmt_cfg );
2778+ out_ref_type = sof_ipc4_fmt_cfg_to_type (in_fmt -> fmt_cfg );
2779+ } else {
2780+ /* for modules without input formats, use FE params as reference */
2781+ out_ref_rate = params_rate (fe_params );
2782+ out_ref_channels = params_channels (fe_params );
2783+ ret = sof_ipc4_get_sample_type (sdev , fe_params );
2784+ if (ret < 0 )
2785+ return ret ;
2786+ out_ref_type = (u32 )ret ;
2787+
2788+ out_ref_valid_bits = sof_ipc4_get_valid_bits (sdev , fe_params );
2789+ if (out_ref_valid_bits < 0 )
2790+ return out_ref_valid_bits ;
2791+ }
27762792
27772793 output_fmt_index = sof_ipc4_init_output_audio_fmt (sdev , swidget ,
27782794 & process -> base_config ,
@@ -2800,6 +2816,16 @@ static int sof_ipc4_prepare_process_module(struct snd_sof_widget *swidget,
28002816 if (ret )
28012817 return ret ;
28022818 }
2819+
2820+ /* set base cfg to match the first output format if there are no input formats */
2821+ if (!available_fmt -> num_input_formats ) {
2822+ struct sof_ipc4_audio_format * out_fmt ;
2823+
2824+ out_fmt = & available_fmt -> output_pin_fmts [0 ].audio_fmt ;
2825+
2826+ /* copy output format */
2827+ memcpy (& process -> base_config .audio_fmt , out_fmt , sizeof (* out_fmt ));
2828+ }
28032829 }
28042830
28052831 sof_ipc4_dbg_module_audio_format (sdev -> dev , swidget , available_fmt ,
0 commit comments