Skip to content

Commit fa77edf

Browse files
marcinszkudlinskimwasko
authored andcommitted
pipeline2.0: change module prepare API to use sink/src.c
Module prepare is an operation that needs to set up sink and source according to needs. Therefore it must have access to sink/source handlers This commit adds handlers to API. In case the module uses legacy audio stream sink/source pointers will be NULLs and number of sinks/sources will be zero Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
1 parent 002d4a3 commit fa77edf

File tree

22 files changed

+117
-24
lines changed

22 files changed

+117
-24
lines changed

src/audio/eq_fir/eq_fir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,9 @@ static void eq_fir_set_alignment(struct audio_stream __sparse_cache *source,
564564
audio_stream_init_alignment_constants(byte_align, frame_align_req, sink);
565565
}
566566

567-
static int eq_fir_prepare(struct processing_module *mod)
567+
static int eq_fir_prepare(struct processing_module *mod,
568+
struct sof_source __sparse_cache **sources, int num_of_sources,
569+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
568570
{
569571
struct comp_data *cd = module_get_private_data(mod);
570572
struct comp_buffer *sourceb, *sinkb;

src/audio/eq_iir/eq_iir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,9 @@ static void eq_iir_set_passthrough_func(struct comp_data *cd,
879879
#endif
880880
}
881881

882-
static int eq_iir_prepare(struct processing_module *mod)
882+
static int eq_iir_prepare(struct processing_module *mod,
883+
struct sof_source __sparse_cache **sources, int num_of_sources,
884+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
883885
{
884886
struct comp_data *cd = module_get_private_data(mod);
885887
struct comp_buffer *sourceb, *sinkb;

src/audio/mfcc/mfcc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ static void mfcc_set_alignment(struct audio_stream *source, struct audio_stream
186186
audio_stream_init_alignment_constants(byte_align, frame_align_req, sink);
187187
}
188188

189-
static int mfcc_prepare(struct processing_module *mod)
189+
static int mfcc_prepare(struct processing_module *mod,
190+
struct sof_source __sparse_cache **sources, int num_of_sources,
191+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
190192
{
191193
struct mfcc_comp_data *cd = module_get_private_data(mod);
192194
struct comp_buffer *sourceb;

src/audio/mixer/mixer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ static inline void mixer_set_frame_alignment(struct audio_stream __sparse_cache
217217
audio_stream_init_alignment_constants(byte_align, frame_align_req, source);
218218
}
219219

220-
static int mixer_prepare(struct processing_module *mod)
220+
static int mixer_prepare(struct processing_module *mod,
221+
struct sof_source __sparse_cache **sources, int num_of_sources,
222+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
221223
{
222224
struct mixer_data *md = module_get_private_data(mod);
223225
struct comp_buffer __sparse_cache *sink_c;

src/audio/mixin_mixout/mixin_mixout.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,9 @@ static int mixin_params(struct processing_module *mod)
686686
* We should also make sure that we propagate the prepare call to downstream
687687
* if downstream is not currently active.
688688
*/
689-
static int mixin_prepare(struct processing_module *mod)
689+
static int mixin_prepare(struct processing_module *mod,
690+
struct sof_source __sparse_cache **sources, int num_of_sources,
691+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
690692
{
691693
struct mixin_data *md = module_get_private_data(mod);
692694
struct comp_dev *dev = mod->dev;
@@ -805,7 +807,9 @@ static int mixout_params(struct processing_module *mod)
805807
return 0;
806808
}
807809

808-
static int mixout_prepare(struct processing_module *mod)
810+
static int mixout_prepare(struct processing_module *mod,
811+
struct sof_source __sparse_cache **sources, int num_of_sources,
812+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
809813
{
810814
struct module_source_info __sparse_cache *mod_source_info;
811815
struct comp_dev *dev = mod->dev;

src/audio/module_adapter/module/cadence.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,9 @@ static int cadence_codec_init_process(struct processing_module *mod)
501501
return 0;
502502
}
503503

504-
static int cadence_codec_prepare(struct processing_module *mod)
504+
static int cadence_codec_prepare(struct processing_module *mod,
505+
struct sof_source __sparse_cache **sources, int num_of_sources,
506+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
505507
{
506508
int ret = 0, mem_tabs_size;
507509
struct comp_dev *dev = mod->dev;

src/audio/module_adapter/module/dts.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ static int dts_codec_init(struct processing_module *mod)
183183
return ret;
184184
}
185185

186-
static int dts_codec_prepare(struct processing_module *mod)
186+
static int dts_codec_prepare(struct processing_module *mod,
187+
struct sof_source __sparse_cache **sources, int num_of_sources,
188+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
187189
{
188190
int ret;
189191
struct comp_dev *dev = mod->dev;

src/audio/module_adapter/module/generic.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ static int validate_config(struct module_config *cfg)
192192
return 0;
193193
}
194194

195-
int module_prepare(struct processing_module *mod)
195+
int module_prepare(struct processing_module *mod,
196+
struct sof_source __sparse_cache **sources, int num_of_sources,
197+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
196198
{
197199
int ret;
198200
struct module_data *md = &mod->priv;
@@ -205,7 +207,7 @@ int module_prepare(struct processing_module *mod)
205207
if (mod->priv.state < MODULE_INITIALIZED)
206208
return -EPERM;
207209

208-
ret = md->ops->prepare(mod);
210+
ret = md->ops->prepare(mod, sources, num_of_sources, sinks, num_of_sinks);
209211
if (ret) {
210212
comp_err(dev, "module_prepare() error %d: module specific prepare failed, comp_id %d",
211213
ret, dev_comp_id(dev));

src/audio/module_adapter/module/iadk_modules.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ static int iadk_modules_init(struct processing_module *mod)
117117
* configuration. Its internal structure is proprietary to the module implementation.
118118
* There is one assumption - all IADK modules utilize IPC4 protocol.
119119
*/
120-
static int iadk_modules_prepare(struct processing_module *mod)
120+
static int iadk_modules_prepare(struct processing_module *mod,
121+
struct sof_source __sparse_cache **sources, int num_of_sources,
122+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
121123
{
122124
struct comp_dev *dev = mod->dev;
123125
int ret = 0;

src/audio/module_adapter/module/passthrough.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ static int passthrough_codec_init(struct processing_module *mod)
2020
return 0;
2121
}
2222

23-
static int passthrough_codec_prepare(struct processing_module *mod)
23+
static int passthrough_codec_prepare(struct processing_module *mod,
24+
struct sof_source __sparse_cache **sources, int num_of_sources,
25+
struct sof_sink __sparse_cache **sinks, int num_of_sinks)
2426
{
2527
struct comp_dev *dev = mod->dev;
2628
struct module_data *codec = &mod->priv;

0 commit comments

Comments
 (0)