From cf67fd40bd30a06860159e7dc11a74477c449a68 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Fri, 2 Oct 2026 14:45:19 +0300 Subject: [PATCH] audio: module_adapter: ipc4: Allow probes module through channels check The channel check introduced in commit: cdb7f911bb15e ("audio: module_adapter: bound host channels_count at ipc4 init") does not let probes module through. Add extra condition to allows probes that relies on ipc4 probes implementation on Linux ASoC side, that initializes the whole base config as zero for probes module. Signed-off-by: Jyri Sarha --- .../module_adapter/module_adapter_ipc4.c | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/audio/module_adapter/module_adapter_ipc4.c b/src/audio/module_adapter/module_adapter_ipc4.c index 00ec3d057ab5..b7956482e79b 100644 --- a/src/audio/module_adapter/module_adapter_ipc4.c +++ b/src/audio/module_adapter/module_adapter_ipc4.c @@ -126,6 +126,25 @@ int module_ext_init_decode(const struct comp_driver *drv, struct module_ext_init return 0; } +/** + * \brief Check whether the entire base configuration is zeroed. + * \param[in] base_cfg - Base module configuration to inspect. + * + * \return: true if every byte is zero, otherwise false. + */ +static bool is_probe_module(struct ipc4_base_module_cfg *base_cfg) +{ + const unsigned char *p = (const unsigned char *)base_cfg; + size_t s = sizeof(*base_cfg); + + for (size_t i = 0; i < s; i++) { + if (p[i] != 0) { + return false; + } + } + return true; +} + /* * \module adapter data initialize. * \param[in] dev - device. @@ -158,8 +177,9 @@ int module_adapter_init_data(struct comp_dev *dev, dst->size = cfgsz; /* Host-supplied channel count indexes PLATFORM_MAX_CHANNELS arrays. */ - if (dst->base_cfg.audio_fmt.channels_count == 0 || - dst->base_cfg.audio_fmt.channels_count > PLATFORM_MAX_CHANNELS) { + if ((dst->base_cfg.audio_fmt.channels_count == 0 || + dst->base_cfg.audio_fmt.channels_count > PLATFORM_MAX_CHANNELS) && + !is_probe_module(&dst->base_cfg)) { comp_err(dev, "invalid channels count %u", dst->base_cfg.audio_fmt.channels_count); return -EINVAL;