Skip to content

Commit 4e36541

Browse files
author
Jyri Sarha
committed
Audio: IIR: Memory, blob, and fast_get allocs to module API
Allocate all memory, blob handlers, and fast_get() buffers through module API mod_alloc() and friends. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 7040189 commit 4e36541

5 files changed

Lines changed: 26 additions & 29 deletions

File tree

src/audio/eq_iir/eq_iir.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <sof/common.h>
1818
#include <rtos/panic.h>
1919
#include <sof/ipc/msg.h>
20-
#include <rtos/alloc.h>
2120
#include <rtos/init.h>
2221
#include <sof/lib/uuid.h>
2322
#include <sof/list.h>
@@ -60,16 +59,16 @@ static int eq_iir_init(struct processing_module *mod)
6059
return -EINVAL;
6160
}
6261

63-
cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
62+
cd = mod_zalloc(mod, sizeof(*cd));
6463
if (!cd)
6564
return -ENOMEM;
6665

6766
md->private = cd;
6867

6968
/* component model data handler */
70-
cd->model_handler = comp_data_blob_handler_new(dev);
69+
cd->model_handler = mod_data_blob_handler_new(mod);
7170
if (!cd->model_handler) {
72-
comp_err(dev, "comp_data_blob_handler_new() failed.");
71+
comp_err(dev, "mod_data_blob_handler_new() failed.");
7372
ret = -ENOMEM;
7473
goto err;
7574
}
@@ -80,27 +79,28 @@ static int eq_iir_init(struct processing_module *mod)
8079
ret = comp_init_data_blob(cd->model_handler, bs, cfg->data);
8180
if (ret < 0) {
8281
comp_err(dev, "comp_init_data_blob() failed with error: %d", ret);
83-
comp_data_blob_handler_free(cd->model_handler);
8482
goto err;
8583
}
8684

8785
for (i = 0; i < PLATFORM_MAX_CHANNELS; i++)
8886
iir_reset_df1(&cd->iir[i]);
8987

9088
return 0;
89+
9190
err:
92-
rfree(cd);
91+
mod_data_blob_handler_free(mod, cd->model_handler);
92+
mod_free(mod, cd);
9393
return ret;
9494
}
9595

9696
static int eq_iir_free(struct processing_module *mod)
9797
{
9898
struct comp_data *cd = module_get_private_data(mod);
9999

100-
eq_iir_free_delaylines(cd);
101-
comp_data_blob_handler_free(cd->model_handler);
100+
eq_iir_free_delaylines(mod);
101+
mod_data_blob_handler_free(mod, cd->model_handler);
102102

103-
rfree(cd);
103+
mod_free(mod, cd);
104104
return 0;
105105
}
106106

@@ -144,7 +144,7 @@ static int eq_iir_process(struct processing_module *mod,
144144
/* Check for changed configuration */
145145
if (comp_is_new_data_blob_available(cd->model_handler)) {
146146
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);
147-
ret = eq_iir_new_blob(mod, cd, audio_stream_get_frm_fmt(source),
147+
ret = eq_iir_new_blob(mod, audio_stream_get_frm_fmt(source),
148148
audio_stream_get_frm_fmt(sink),
149149
audio_stream_get_channels(source));
150150
if (ret)
@@ -216,7 +216,7 @@ static int eq_iir_prepare(struct processing_module *mod,
216216

217217
/* Initialize EQ */
218218
if (cd->config) {
219-
ret = eq_iir_new_blob(mod, cd, source_format, sink_format, channels);
219+
ret = eq_iir_new_blob(mod, source_format, sink_format, channels);
220220
if (ret)
221221
return ret;
222222
}
@@ -234,7 +234,7 @@ static int eq_iir_reset(struct processing_module *mod)
234234
struct comp_data *cd = module_get_private_data(mod);
235235
int i;
236236

237-
eq_iir_free_delaylines(cd);
237+
eq_iir_free_delaylines(mod);
238238

239239
cd->eq_iir_func = NULL;
240240
for (i = 0; i < PLATFORM_MAX_CHANNELS; i++)

src/audio/eq_iir/eq_iir.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ void eq_iir_s24_default(struct processing_module *mod, struct input_stream_buffe
5656
void eq_iir_s32_default(struct processing_module *mod, struct input_stream_buffer *bsource,
5757
struct output_stream_buffer *bsink, uint32_t frames);
5858

59-
int eq_iir_new_blob(struct processing_module *mod, struct comp_data *cd,
60-
enum sof_ipc_frame source_format, enum sof_ipc_frame sink_format,
61-
int channels);
59+
int eq_iir_new_blob(struct processing_module *mod, enum sof_ipc_frame source_format,
60+
enum sof_ipc_frame sink_format, int channels);
6261

6362
void eq_iir_set_passthrough_func(struct comp_data *cd,
6463
enum sof_ipc_frame source_format,
@@ -71,5 +70,5 @@ void eq_iir_pass(struct processing_module *mod, struct input_stream_buffer *bsou
7170

7271
int eq_iir_setup(struct processing_module *mod, int nch);
7372

74-
void eq_iir_free_delaylines(struct comp_data *cd);
73+
void eq_iir_free_delaylines(struct processing_module *mod);
7574
#endif /* __SOF_AUDIO_EQ_IIR_EQ_IIR_H__ */

src/audio/eq_iir/eq_iir_generic.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,16 @@ static void eq_iir_init_delay(struct iir_state_df1 *iir,
285285
}
286286
}
287287

288-
void eq_iir_free_delaylines(struct comp_data *cd)
288+
void eq_iir_free_delaylines(struct processing_module *mod)
289289
{
290+
struct comp_data *cd = module_get_private_data(mod);
290291
struct iir_state_df1 *iir = cd->iir;
291292
int i = 0;
292293

293294
/* Free the common buffer for all EQs and point then
294295
* each IIR channel delay line to NULL.
295296
*/
296-
rfree(cd->iir_delay);
297+
mod_free(mod, cd->iir_delay);
297298
cd->iir_delay = NULL;
298299
cd->iir_delay_size = 0;
299300
for (i = 0; i < PLATFORM_MAX_CHANNELS; i++)
@@ -315,7 +316,7 @@ int eq_iir_setup(struct processing_module *mod, int nch)
315316
int delay_size;
316317

317318
/* Free existing IIR channels data if it was allocated */
318-
eq_iir_free_delaylines(cd);
319+
eq_iir_free_delaylines(mod);
319320

320321
/* Set coefficients for each channel EQ from coefficient blob */
321322
delay_size = eq_iir_init_coef(mod, nch);
@@ -329,8 +330,7 @@ int eq_iir_setup(struct processing_module *mod, int nch)
329330
return 0;
330331

331332
/* Allocate all IIR channels data in a big chunk and clear it */
332-
cd->iir_delay = rzalloc(SOF_MEM_FLAG_USER,
333-
delay_size);
333+
cd->iir_delay = mod_zalloc(mod, delay_size);
334334
if (!cd->iir_delay) {
335335
comp_err(mod->dev, "eq_iir_setup(), delay allocation fail");
336336
return -ENOMEM;

src/audio/eq_iir/eq_iir_ipc3.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <sof/common.h>
1818
#include <rtos/panic.h>
1919
#include <sof/ipc/msg.h>
20-
#include <rtos/alloc.h>
2120
#include <rtos/init.h>
2221
#include <sof/lib/uuid.h>
2322
#include <sof/list.h>
@@ -298,10 +297,10 @@ static int eq_iir_verify_params(struct comp_dev *dev,
298297
return 0;
299298
}
300299

301-
int eq_iir_new_blob(struct processing_module *mod, struct comp_data *cd,
302-
enum sof_ipc_frame source_format, enum sof_ipc_frame sink_format,
303-
int channels)
300+
int eq_iir_new_blob(struct processing_module *mod, enum sof_ipc_frame source_format,
301+
enum sof_ipc_frame sink_format, int channels)
304302
{
303+
struct comp_data *cd = module_get_private_data(mod);
305304
int ret;
306305

307306
ret = eq_iir_setup(mod, channels);

src/audio/eq_iir/eq_iir_ipc4.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <sof/common.h>
1818
#include <rtos/panic.h>
1919
#include <sof/ipc/msg.h>
20-
#include <rtos/alloc.h>
2120
#include <rtos/init.h>
2221
#include <sof/lib/uuid.h>
2322
#include <sof/list.h>
@@ -77,10 +76,10 @@ static eq_iir_func eq_iir_find_func(struct processing_module *mod)
7776
return NULL;
7877
}
7978

80-
int eq_iir_new_blob(struct processing_module *mod, struct comp_data *cd,
81-
enum sof_ipc_frame source_format, enum sof_ipc_frame sink_format,
82-
int channels)
79+
int eq_iir_new_blob(struct processing_module *mod, enum sof_ipc_frame source_format,
80+
enum sof_ipc_frame sink_format, int channels)
8381
{
82+
struct comp_data *cd = module_get_private_data(mod);
8483
int ret;
8584

8685
ret = eq_iir_setup(mod, channels);

0 commit comments

Comments
 (0)