From 37b6afd39fdb85f685ee0a94e1997266c479878c Mon Sep 17 00:00:00 2001 From: Serhiy Katsyuba Date: Wed, 11 Feb 2026 12:24:25 +0100 Subject: [PATCH 1/2] audio: base_fw_intel: fix incorrect DAI type usage We have two enums with DAI types: enum sof_ipc_dai_type in SOF and enum dai_type in Zephyr. dai_get_device() expects the SOF enum sof_ipc_dai_type and then internally converts it to the Zephyr enum dai_type. This fix does not change any behavior as both DAI_INTEL_SSP and SOF_DAI_INTEL_SSP are currently declared as 1. However, there is a risk that those enums might go out of sync in the future. Signed-off-by: Serhiy Katsyuba --- src/audio/base_fw_intel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/base_fw_intel.c b/src/audio/base_fw_intel.c index b47868ad2d48..3601d0c5bd72 100644 --- a/src/audio/base_fw_intel.c +++ b/src/audio/base_fw_intel.c @@ -422,7 +422,7 @@ __cold int basefw_vendor_dma_control(uint32_t node_id, const char *config_data, { union ipc4_connector_node_id node = (union ipc4_connector_node_id)node_id; int ret, result; - enum dai_type type; + enum sof_ipc_dai_type type; assert_can_be_cold(); @@ -442,7 +442,7 @@ __cold int basefw_vendor_dma_control(uint32_t node_id, const char *config_data, return IPC4_SUCCESS; case ipc4_i2s_link_output_class: case ipc4_i2s_link_input_class: - type = DAI_INTEL_SSP; + type = SOF_DAI_INTEL_SSP; break; default: return IPC4_INVALID_RESOURCE_ID; From a930b55e67454192f7288fab230f01e54bf967c4 Mon Sep 17 00:00:00 2001 From: Serhiy Katsyuba Date: Wed, 11 Feb 2026 12:47:11 +0100 Subject: [PATCH 2/2] dai-zephyr: enforce type check for dai_get_device() Allow the compiler to issue a warning/error if the wrong DAI type enum is passed as a parameter, as it is easy to incorrectly use Zephyr's enum dai_type instead of the proper SOF enum sof_ipc_dai_type. Signed-off-by: Serhiy Katsyuba --- src/include/sof/lib/dai-zephyr.h | 3 ++- src/lib/dai.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/include/sof/lib/dai-zephyr.h b/src/include/sof/lib/dai-zephyr.h index 049adba4a656..8ff739fa42d5 100644 --- a/src/include/sof/lib/dai-zephyr.h +++ b/src/include/sof/lib/dai-zephyr.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -305,7 +306,7 @@ void dai_release_llp_slot(struct dai_data *dd); /** * \brief Retrieve a pointer to the Zephyr device structure for a DAI of a given type and index. */ -const struct device *dai_get_device(uint32_t type, uint32_t index); +const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index); /** * \brief Retrieve the list of all DAI devices. diff --git a/src/lib/dai.c b/src/lib/dai.c index ca18b53a3e79..8e45f8a4bb97 100644 --- a/src/lib/dai.c +++ b/src/lib/dai.c @@ -231,7 +231,7 @@ static int sof_dai_type_to_zephyr(uint32_t type) } } -const struct device *dai_get_device(uint32_t type, uint32_t index) +const struct device *dai_get_device(enum sof_ipc_dai_type type, uint32_t index) { struct dai_config cfg; int z_type;