eq: remove buffer_acquire from eq_fir and eq_iir

remove buffer ops from eq_fir and eq_iir modules

this is a continuation of changes
from commit 4a03699

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
This commit is contained in:
Tobiasz Dryjanski 2023-09-15 19:59:40 +02:00 committed by Kai Vehmanen
parent f57e478f4c
commit fe91b3c97f
2 changed files with 11 additions and 33 deletions

View File

@ -174,7 +174,6 @@ static int eq_fir_params(struct processing_module *mod)
struct sof_ipc_stream_params comp_params; struct sof_ipc_stream_params comp_params;
struct comp_dev *dev = mod->dev; struct comp_dev *dev = mod->dev;
struct comp_buffer *sinkb; struct comp_buffer *sinkb;
struct comp_buffer *sink_c;
enum sof_ipc_frame valid_fmt, frame_fmt; enum sof_ipc_frame valid_fmt, frame_fmt;
int i, ret; int i, ret;
@ -197,9 +196,7 @@ static int eq_fir_params(struct processing_module *mod)
component_set_nearest_period_frames(dev, comp_params.rate); component_set_nearest_period_frames(dev, comp_params.rate);
sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
sink_c = buffer_acquire(sinkb); ret = buffer_set_params(sinkb, &comp_params, true);
ret = buffer_set_params(sink_c, &comp_params, true);
buffer_release(sink_c);
return ret; return ret;
} }
#endif /* CONFIG_IPC_MAJOR_4 */ #endif /* CONFIG_IPC_MAJOR_4 */
@ -570,7 +567,6 @@ static int eq_fir_prepare(struct processing_module *mod,
{ {
struct comp_data *cd = module_get_private_data(mod); struct comp_data *cd = module_get_private_data(mod);
struct comp_buffer *sourceb, *sinkb; struct comp_buffer *sourceb, *sinkb;
struct comp_buffer *source_c, *sink_c;
struct comp_dev *dev = mod->dev; struct comp_dev *dev = mod->dev;
int channels; int channels;
enum sof_ipc_frame frame_fmt; enum sof_ipc_frame frame_fmt;
@ -589,13 +585,9 @@ static int eq_fir_prepare(struct processing_module *mod,
/* EQ component will only ever have 1 source and 1 sink buffer. */ /* EQ component will only ever have 1 source and 1 sink buffer. */
sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list);
sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
source_c = buffer_acquire(sourceb); eq_fir_set_alignment(&sourceb->stream, &sinkb->stream);
sink_c = buffer_acquire(sinkb); channels = audio_stream_get_channels(&sinkb->stream);
eq_fir_set_alignment(&source_c->stream, &sink_c->stream); frame_fmt = audio_stream_get_frm_fmt(&sourceb->stream);
channels = audio_stream_get_channels(&sink_c->stream);
frame_fmt = audio_stream_get_frm_fmt(&source_c->stream);
buffer_release(sink_c);
buffer_release(source_c);
cd->eq_fir_func = eq_fir_passthrough; cd->eq_fir_func = eq_fir_passthrough;
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL); cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);

View File

@ -694,7 +694,6 @@ static int eq_iir_verify_params(struct comp_dev *dev,
struct sof_ipc_stream_params *params) struct sof_ipc_stream_params *params)
{ {
struct comp_buffer *sourceb, *sinkb; struct comp_buffer *sourceb, *sinkb;
struct comp_buffer *source_c, *sink_c;
uint32_t buffer_flag; uint32_t buffer_flag;
int ret; int ret;
@ -705,8 +704,6 @@ static int eq_iir_verify_params(struct comp_dev *dev,
sink_list); sink_list);
sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, sinkb = list_first_item(&dev->bsink_list, struct comp_buffer,
source_list); source_list);
source_c = buffer_acquire(sourceb);
sink_c = buffer_acquire(sinkb);
/* we check whether we can support frame_fmt conversion (whether we have /* we check whether we can support frame_fmt conversion (whether we have
* such conversion function) due to source and sink buffer frame_fmt's. * such conversion function) due to source and sink buffer frame_fmt's.
@ -714,14 +711,11 @@ static int eq_iir_verify_params(struct comp_dev *dev,
* pcm frame_fmt and will not make any conversion (sink and source * pcm frame_fmt and will not make any conversion (sink and source
* frame_fmt will be equal). * frame_fmt will be equal).
*/ */
buffer_flag = eq_iir_find_func(audio_stream_get_frm_fmt(&source_c->stream), buffer_flag = eq_iir_find_func(audio_stream_get_frm_fmt(&sourceb->stream),
audio_stream_get_frm_fmt(&sink_c->stream), fm_configured, audio_stream_get_frm_fmt(&sinkb->stream), fm_configured,
ARRAY_SIZE(fm_configured)) ? ARRAY_SIZE(fm_configured)) ?
BUFF_PARAMS_FRAME_FMT : 0; BUFF_PARAMS_FRAME_FMT : 0;
buffer_release(sink_c);
buffer_release(source_c);
ret = comp_verify_params(dev, buffer_flag, params); ret = comp_verify_params(dev, buffer_flag, params);
if (ret < 0) { if (ret < 0) {
comp_err(dev, "eq_iir_verify_params(): comp_verify_params() failed."); comp_err(dev, "eq_iir_verify_params(): comp_verify_params() failed.");
@ -838,7 +832,6 @@ static int eq_iir_params(struct processing_module *mod)
struct sof_ipc_stream_params comp_params; struct sof_ipc_stream_params comp_params;
struct comp_dev *dev = mod->dev; struct comp_dev *dev = mod->dev;
struct comp_buffer *sinkb; struct comp_buffer *sinkb;
struct comp_buffer *sink_c;
enum sof_ipc_frame valid_fmt, frame_fmt; enum sof_ipc_frame valid_fmt, frame_fmt;
int i, ret; int i, ret;
@ -860,9 +853,7 @@ static int eq_iir_params(struct processing_module *mod)
component_set_nearest_period_frames(dev, comp_params.rate); component_set_nearest_period_frames(dev, comp_params.rate);
sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
sink_c = buffer_acquire(sinkb); ret = buffer_set_params(sinkb, &comp_params, true);
ret = buffer_set_params(sink_c, &comp_params, true);
buffer_release(sink_c);
return ret; return ret;
} }
#endif #endif
@ -885,7 +876,6 @@ static int eq_iir_prepare(struct processing_module *mod,
{ {
struct comp_data *cd = module_get_private_data(mod); struct comp_data *cd = module_get_private_data(mod);
struct comp_buffer *sourceb, *sinkb; struct comp_buffer *sourceb, *sinkb;
struct comp_buffer *source_c, *sink_c;
struct comp_dev *dev = mod->dev; struct comp_dev *dev = mod->dev;
enum sof_ipc_frame source_format; enum sof_ipc_frame source_format;
enum sof_ipc_frame sink_format; enum sof_ipc_frame sink_format;
@ -910,16 +900,12 @@ static int eq_iir_prepare(struct processing_module *mod,
/* EQ component will only ever have 1 source and 1 sink buffer */ /* EQ component will only ever have 1 source and 1 sink buffer */
sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list);
sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
source_c = buffer_acquire(sourceb); eq_iir_set_alignment(&sourceb->stream, &sinkb->stream);
sink_c = buffer_acquire(sinkb);
eq_iir_set_alignment(&source_c->stream, &sink_c->stream);
/* get source and sink data format */ /* get source and sink data format */
channels = audio_stream_get_channels(&sink_c->stream); channels = audio_stream_get_channels(&sinkb->stream);
source_format = audio_stream_get_frm_fmt(&source_c->stream); source_format = audio_stream_get_frm_fmt(&sourceb->stream);
sink_format = audio_stream_get_frm_fmt(&sink_c->stream); sink_format = audio_stream_get_frm_fmt(&sinkb->stream);
buffer_release(sink_c);
buffer_release(source_c);
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL); cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);