Skip to content

Commit 84ac213

Browse files
author
Jyri Sarha
committed
audio: module_adapter: ipc4: Allow probes module through channels check
The channel check introduced in commit: cdb7f91 ("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 <jyri.sarha@linux.intel.com>
1 parent d6cfeaf commit 84ac213

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎src/audio/module_adapter/module_adapter_ipc4.c‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ int module_ext_init_decode(const struct comp_driver *drv, struct module_ext_init
126126
return 0;
127127
}
128128

129+
/* Check if entire base config is all zero, as it is with probe module */
130+
static bool is_probe_module(struct ipc4_base_module_cfg *base_cfg)
131+
{
132+
const unsigned char *p = (const unsigned char *)base_cfg;
133+
size_t s = sizeof(*base_cfg);
134+
135+
for (size_t i = 0; i < s; i++) {
136+
if (p[i] != 0) {
137+
return false;
138+
}
139+
}
140+
return true;
141+
}
142+
129143
/*
130144
* \module adapter data initialize.
131145
* \param[in] dev - device.
@@ -158,8 +172,9 @@ int module_adapter_init_data(struct comp_dev *dev,
158172
dst->size = cfgsz;
159173

160174
/* Host-supplied channel count indexes PLATFORM_MAX_CHANNELS arrays. */
161-
if (dst->base_cfg.audio_fmt.channels_count == 0 ||
162-
dst->base_cfg.audio_fmt.channels_count > PLATFORM_MAX_CHANNELS) {
175+
if ((dst->base_cfg.audio_fmt.channels_count == 0 ||
176+
dst->base_cfg.audio_fmt.channels_count > PLATFORM_MAX_CHANNELS) &&
177+
!is_probe_module(&dst->base_cfg)) {
163178
comp_err(dev, "invalid channels count %u",
164179
dst->base_cfg.audio_fmt.channels_count);
165180
return -EINVAL;

0 commit comments

Comments
 (0)