From ed70020391f5c5cb5b6579e37bc17c3c249a4e2c Mon Sep 17 00:00:00 2001 From: Wojciech Jablonski Date: Thu, 19 Mar 2026 15:11:19 +0100 Subject: [PATCH 1/2] zephyr: fix gtw config size on D3 resume Convert length of DAI gtw cfg from words to bytes before passing it to dai_set_config() during D3 resume. The same conversion is already performed during the initial configuration. Signed-off-by: Wojciech Jablonski --- zephyr/lib/cpu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zephyr/lib/cpu.c b/zephyr/lib/cpu.c index 93f87e32538e..94f004bd7356 100644 --- a/zephyr/lib/cpu.c +++ b/zephyr/lib/cpu.c @@ -105,6 +105,7 @@ static void resume_dais(void) struct processing_module *mod; struct copier_data *cd; struct dai_data *dd; + size_t gtw_cfg_size; #if CONFIG_INTEL_ADSP_MIC_PRIVACY /* Re-initialize mic privacy manager first to ensure proper state before DAI resume */ @@ -119,12 +120,13 @@ static void resume_dais(void) mod = comp_mod(icd->cd); cd = module_get_private_data(mod); dd = cd->dd[0]; + /* gtw_cfg.config_length is in words */ + gtw_cfg_size = cd->config.gtw_cfg.config_length << 2; if (dai_probe(dd->dai->dev) < 0) { tr_err(&zephyr_tr, "DAI resume failed on probe, type %d index %d", dd->dai->type, dd->dai->index); - } else if (dai_set_config(dd->dai, &dd->ipc_config, - cd->config.gtw_cfg.config_data, - cd->config.gtw_cfg.config_length) < 0) { + } else if (dai_set_config(dd->dai, &dd->ipc_config, cd->config.gtw_cfg.config_data, + gtw_cfg_size) < 0) { tr_err(&zephyr_tr, "DAI resume failed on config, type %d index %d", dd->dai->type, dd->dai->index); } From 305d060dc8136bcc2ac16aa30495230274a7d751 Mon Sep 17 00:00:00 2001 From: Wojciech Jablonski Date: Thu, 19 Mar 2026 15:11:53 +0100 Subject: [PATCH 2/2] dai-zephyr: fix config nuances If a DAI config is passed as a blob (IPC4 case) to dai_set_config, it cannot be cast to sof_ipc_dai_config because the blob format might differ. This commit fixes this by using the format field of ipc_config_dai instead. Field options is set to 0 for the blob case. Additionally, this commit trims the size of a bespoke config for non-blob case after removing the common header. Signed-off-by: Wojciech Jablonski --- src/audio/dai-zephyr.c | 14 +++++++++++--- src/include/ipc/dai.h | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index 37b0b7c911ea..c383557556ef 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -146,14 +146,15 @@ __cold int dai_set_config(struct dai *dai, struct ipc_config_dai *common_config, const struct sof_ipc_dai_config *sof_cfg = spec_config; struct dai_config cfg = {0}; const void *cfg_params; + size_t dai_cfg_size = size; bool is_blob; assert_can_be_cold(); cfg.dai_index = common_config->dai_index; is_blob = common_config->is_config_blob; - cfg.format = sof_cfg->format; - cfg.options = sof_cfg->flags; + cfg.format = common_config->format; + cfg.options = is_blob ? 0 : sof_cfg->flags; cfg.rate = common_config->sampling_frequency; switch (common_config->type) { @@ -195,7 +196,14 @@ __cold int dai_set_config(struct dai *dai, struct ipc_config_dai *common_config, return -EINVAL; } - return dai_config_set(dev, &cfg, cfg_params, size); + if (!is_blob) { + if (size < SOF_DAI_CONFIG_HW_SPEC_OFFSET) + return -EINVAL; + + dai_cfg_size -= SOF_DAI_CONFIG_HW_SPEC_OFFSET; + } + + return dai_config_set(dev, &cfg, cfg_params, dai_cfg_size); } /* called from ipc/ipc3/dai.c */ diff --git a/src/include/ipc/dai.h b/src/include/ipc/dai.h index b5b29316f9e6..eaae4dadf80a 100644 --- a/src/include/ipc/dai.h +++ b/src/include/ipc/dai.h @@ -21,6 +21,7 @@ #include #include #include +#include #include /* @@ -97,6 +98,8 @@ enum sof_ipc_dai_type { SOF_DAI_AMD_SW_AUDIO /**