Skip to content

Commit 968f7b5

Browse files
lrgirdwolgirdwood
authored andcommitted
modules: adapter: make max module sinks/source a Kconfig setting
Currently max number of connected sources and sinks is hard coded. Make this Kconfig to support different connections counts and validate the count is within limits. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 3320d9a commit 968f7b5

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/audio/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ config IPC4_GATEWAY
7272
host and DSP without using DMA: via memory window (audio payload) and
7373
IPC4 messages (set/get/flush commands).
7474

75+
config MODULE_MAX_CONNECTIONS
76+
int "Module maximum number of connected sink/source modules"
77+
default 8
78+
help
79+
Specifies the maximum number of sink and source connections a module
80+
may have to other modules.
81+
7582
rsource "up_down_mixer/Kconfig"
7683

7784
config COMP_BLOB

src/audio/module_adapter/module_adapter.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ int module_adapter_prepare(struct comp_dev *dev)
272272
comp_err(dev, "module_adapter_prepare(): no source and sink buffers connected!");
273273
return -EINVAL;
274274
}
275+
if (mod->num_of_sources > CONFIG_MODULE_MAX_CONNECTIONS ||
276+
mod->num_of_sinks > CONFIG_MODULE_MAX_CONNECTIONS) {
277+
comp_err(dev, "module_adapter_prepare(): too many connected sinks %d or sources %d!",
278+
mod->num_of_sinks, mod->num_of_sources);
279+
return -EINVAL;
280+
}
275281

276282
/* check processing mode */
277283
if (IS_PROCESSING_MODE_AUDIO_STREAM(mod) && mod->max_sources > 1 && mod->max_sinks > 1) {

src/include/module/module/base.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ struct processing_module {
101101
uint32_t num_of_sinks;
102102

103103
/* sink and source handlers for the module */
104-
struct sof_sink *sinks[MODULE_MAX_SOURCES];
105-
struct sof_source *sources[MODULE_MAX_SOURCES];
104+
struct sof_sink *sinks[CONFIG_MODULE_MAX_CONNECTIONS];
105+
struct sof_source *sources[CONFIG_MODULE_MAX_CONNECTIONS];
106106

107107
/* this is used in case of raw data or audio_stream mode
108108
* number of buffers described by fields:

src/include/sof/audio/module_adapter/module/generic.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#define IS_PROCESSING_MODE_SINK_SOURCE(mod) ((mod)->proc_type == MODULE_PROCESS_TYPE_SOURCE_SINK)
2929

3030
#define MAX_BLOB_SIZE 8192
31-
#define MODULE_MAX_SOURCES 8
3231

3332
#if CONFIG_IPC_MAJOR_4
3433
#define IPC_MOD_CMD(v)

0 commit comments

Comments
 (0)