From aa870d83e272b31e6922b34650a62329c199eded Mon Sep 17 00:00:00 2001 From: Baofeng Tian Date: Mon, 13 Nov 2023 14:52:10 +0800 Subject: [PATCH] audio: eq_fir: simplify eq fir set parameters Simplify set parameters, also add source buffer parameter setting. Signed-off-by: Baofeng Tian --- src/audio/eq_fir/eq_fir_ipc4.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/audio/eq_fir/eq_fir_ipc4.c b/src/audio/eq_fir/eq_fir_ipc4.c index 5b500b705205..047d74e0e3b9 100644 --- a/src/audio/eq_fir/eq_fir_ipc4.c +++ b/src/audio/eq_fir/eq_fir_ipc4.c @@ -51,31 +51,20 @@ int set_fir_func(struct processing_module *mod, enum sof_ipc_frame fmt) int eq_fir_params(struct processing_module *mod) { struct sof_ipc_stream_params *params = mod->stream_params; - struct sof_ipc_stream_params comp_params; + struct comp_buffer *sinkb, *sourceb; struct comp_dev *dev = mod->dev; - struct comp_buffer *sinkb; - enum sof_ipc_frame valid_fmt, frame_fmt; - int i, ret; comp_dbg(dev, "eq_fir_params()"); - comp_params = *params; - comp_params.channels = mod->priv.cfg.base_cfg.audio_fmt.channels_count; - comp_params.rate = mod->priv.cfg.base_cfg.audio_fmt.sampling_frequency; - comp_params.buffer_fmt = mod->priv.cfg.base_cfg.audio_fmt.interleaving_style; + ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params); + component_set_nearest_period_frames(dev, params->rate); - audio_stream_fmt_conversion(mod->priv.cfg.base_cfg.audio_fmt.depth, - mod->priv.cfg.base_cfg.audio_fmt.valid_bit_depth, - &frame_fmt, &valid_fmt, - mod->priv.cfg.base_cfg.audio_fmt.s_type); + sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); + ipc4_update_buffer_format(sourceb, &mod->priv.cfg.base_cfg.audio_fmt); - comp_params.frame_fmt = valid_fmt; - - for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++) - comp_params.chmap[i] = (mod->priv.cfg.base_cfg.audio_fmt.ch_map >> i * 4) & 0xf; - - component_set_nearest_period_frames(dev, comp_params.rate); sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); - ret = buffer_set_params(sinkb, &comp_params, true); - return ret; + ipc4_update_buffer_format(sinkb, &mod->priv.cfg.base_cfg.audio_fmt); + + return 0; } +