From bfdf2aa065e2069eb341666ff649f45beb65fc58 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 25 Nov 2026 16:48:21 +0000 Subject: [PATCH 1/3] platform: posix: remove the unused legacy DAI driver posix/dai.c implements a legacy SOF DAI driver for the native_sim platform, but nothing has called posix_dai_init(), which registers it, since it was added in commit c50eddce1 ("platform: Add Zephyr native_posix-based emulation environment"). The native_sim builds use the Zephyr native drivers; the fuzzing configuration gets its DAI from dai_virtual.c (CONFIG_DAI_POSIX). Remove the file and posix_dai_init(). platform/lib/dai.h stays: the ztest unit tests, which do not enable CONFIG_ZEPHYR_NATIVE_DRIVERS, still include it through sof/lib/dai-legacy.h. No functional change. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Liam Girdwood --- src/kernel/platform/posix/dai.c | 120 ------------------ .../posix/include/platform/platform.h | 1 - zephyr/CMakeLists.txt | 1 - 3 files changed, 122 deletions(-) delete mode 100644 src/kernel/platform/posix/dai.c diff --git a/src/kernel/platform/posix/dai.c b/src/kernel/platform/posix/dai.c deleted file mode 100644 index 3fdaa61ff44d..000000000000 --- a/src/kernel/platform/posix/dai.c +++ /dev/null @@ -1,120 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright(c) 2022 Google LLC. All rights reserved. -// Author: Andy Ross -#include - -#define NUM_DAI_TYPES 12 -#define DAIS_PER_TYPE 2 - -uint8_t useless_sum; - -static int pdai_set_config(struct dai *dai, struct ipc_config_dai *config, - const void *spec_config) -{ - for (int i = 0; config && i < sizeof(*config); i++) - useless_sum += ((uint8_t *)config)[i]; - return 0; -} - -static int pdai_trigger(struct dai *dai, int cmd, int direction) -{ - return 0; -} - -static int pdai_get_hw_params(struct dai *dai, - struct sof_ipc_stream_params *params, int dir) -{ - // FIXME: this is a polymorphic struct with extra - // type-specific data at the end, may need to do this more - // intelligently. - memset(params, 0, sizeof(*params)); - return 0; -} - -static int pdai_hw_params(struct dai *dai, struct sof_ipc_stream_params *params) -{ - for (int i = 0; params && i < sizeof(*params); i++) - useless_sum += ((uint8_t *)params)[i]; - return 0; -} - -static int pdai_get_handshake(struct dai *dai, int direction, int stream_id) -{ - return 0; -} - -static int pdai_get_fifo(struct dai *dai, int direction, int stream_id) -{ - return 0; -} - -static int pdai_probe(struct dai *dai) -{ - return 0; -} - -static int pdai_remove(struct dai *dai) -{ - return 0; -} - -static uint32_t pdai_get_init_delay_ms(struct dai *dai) -{ - return 0; -} - -static int pdai_get_fifo_depth(struct dai *dai, int direction) -{ - return 0; -} - -static void pdai_copy(struct dai *dai) -{ -} - -const struct dai_ops posix_dai_ops = { - .set_config = pdai_set_config, - .trigger = pdai_trigger, - .get_hw_params = pdai_get_hw_params, - .hw_params = pdai_hw_params, - .get_handshake = pdai_get_handshake, - .get_fifo = pdai_get_fifo, - .probe = pdai_probe, - .remove = pdai_remove, - .get_init_delay_ms = pdai_get_init_delay_ms, - .get_fifo_depth = pdai_get_fifo_depth, - .copy = pdai_copy, -}; - -static struct dai_type_info dai_types[NUM_DAI_TYPES]; -static struct dai_driver dai_drivers[NUM_DAI_TYPES]; -static struct dai dais[NUM_DAI_TYPES][DAIS_PER_TYPE]; - -static const struct dai_info posix_dai_info = { - .dai_type_array = dai_types, - .num_dai_types = ARRAY_SIZE(dai_types), -}; - -void posix_dai_init(struct sof *sof) -{ - for (int type = 0; type < ARRAY_SIZE(dai_types); type++) { - dai_types[type].type = type; - dai_types[type].dai_array = &dais[type][0]; - dai_types[type].num_dais = DAIS_PER_TYPE; - - dai_drivers[type].type = type; - //dai_drivers[type].uid = ???; - //dai_drivers[type].tctx = ???; - dai_drivers[type].dma_caps = BIT(0); - dai_drivers[type].dma_dev = BIT(0); - dai_drivers[type].ops = posix_dai_ops; - //dai_drivers[type].ts_ops = ???; - - for (int i = 0; i < DAIS_PER_TYPE; i++) { - dais[type][i].index = i; - dais[type][i].drv = &dai_drivers[type]; - } - } - - sof->dai_info = &posix_dai_info; -} diff --git a/src/kernel/platform/posix/include/platform/platform.h b/src/kernel/platform/posix/include/platform/platform.h index 8bc9b3a5eda3..f96be617b828 100644 --- a/src/kernel/platform/posix/include/platform/platform.h +++ b/src/kernel/platform/posix/include/platform/platform.h @@ -16,6 +16,5 @@ struct sof; void posix_dma_init(struct sof *sof); -void posix_dai_init(struct sof *sof); #endif /* PLATFORM_POSIX_PLATFORM_PLATFORM_H */ diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 23ebaa87f6f5..41db7e5f2b5e 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -554,7 +554,6 @@ endif() # Building for native_posix-based whole-OS host emulator zephyr_library_sources_ifdef(CONFIG_ZEPHYR_POSIX ${SOF_PLATFORM_PATH}/posix/dma.c - ${SOF_PLATFORM_PATH}/posix/dai.c ${SOF_PLATFORM_PATH}/posix/ipc.c ${SOF_PLATFORM_PATH}/posix/posix.c ) From 989cd9a7ac69fef124c25e9f8fbb5ff58bf03878 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 25 Nov 2026 16:49:17 +0000 Subject: [PATCH 2/3] idc: remove the unused idc_restore() and platform IDC declarations idc_restore() has had no caller since the XTOS power management code was removed, and it is not declared in any header. The platform IDC hooks platform_idc_init() and platform_idc_restore() are still declared in the Zephyr and posix rtos/idc.h, but no platform defines them since the XTOS IDC drivers were removed. Remove them. No functional change. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Liam Girdwood --- posix/include/rtos/idc.h | 4 ---- src/kernel/idc/idc.c | 16 ---------------- zephyr/include/rtos/idc.h | 4 ---- 3 files changed, 24 deletions(-) diff --git a/posix/include/rtos/idc.h b/posix/include/rtos/idc.h index 3f4c48bf0f51..864529ac31e1 100644 --- a/posix/include/rtos/idc.h +++ b/posix/include/rtos/idc.h @@ -185,10 +185,6 @@ void idc_enable_interrupts(int target_core, int source_core); void idc_free(uint32_t flags); -int platform_idc_init(void); - -int platform_idc_restore(void); - enum task_state idc_do_cmd(void *data); void idc_cmd(struct idc_msg *msg); diff --git a/src/kernel/idc/idc.c b/src/kernel/idc/idc.c index 829ffdc359b7..d9df3d8c8547 100644 --- a/src/kernel/idc/idc.c +++ b/src/kernel/idc/idc.c @@ -476,19 +476,3 @@ __cold int idc_init(void) return 0; } - -int idc_restore(void) -{ - struct idc **idc __unused = idc_get(); - - tr_info(&idc_tr, "entry"); - - /* idc_restore() is invoked during D0->D0ix/D0ix->D0 flow. In that - * case basic core structures e.g. idc struct should be already - * allocated (in D0->D0ix primary core disables all secondary cores, but - * memory has not been powered off). - */ - assert(*idc); - - return 0; -} diff --git a/zephyr/include/rtos/idc.h b/zephyr/include/rtos/idc.h index a90340860355..0967e2bfdb97 100644 --- a/zephyr/include/rtos/idc.h +++ b/zephyr/include/rtos/idc.h @@ -76,10 +76,6 @@ void idc_enable_interrupts(int target_core, int source_core); void idc_free(uint32_t flags); -int platform_idc_init(void); - -int platform_idc_restore(void); - enum task_state idc_do_cmd(void *data); void idc_cmd(struct idc_msg *msg); From 5cac42fc20125f218736da3fdda1bb388f975d70 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 25 Nov 2026 16:49:40 +0000 Subject: [PATCH 3/3] platform: imx8ulp: remove the no-op platform_shared_commit() Commit 580b9cf00 ("memory: remove platform_shared_commit() as it's a NOP on all platforms") removed it, but the i.MX8ULP platform, added later, brought back an empty copy and a call in platform_clock_init(). Remove both. No functional change. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Liam Girdwood --- src/kernel/platform/imx8ulp/include/platform/lib/memory.h | 8 -------- src/kernel/platform/imx8ulp/lib/clk.c | 2 -- 2 files changed, 10 deletions(-) diff --git a/src/kernel/platform/imx8ulp/include/platform/lib/memory.h b/src/kernel/platform/imx8ulp/include/platform/lib/memory.h index 7394ed7073a2..aa7e9de9b59d 100644 --- a/src/kernel/platform/imx8ulp/include/platform/lib/memory.h +++ b/src/kernel/platform/imx8ulp/include/platform/lib/memory.h @@ -104,14 +104,6 @@ struct sof; void platform_init_memmap(struct sof *sof); -/** - * \brief Function for keeping shared data synchronized. - * It's used after usage of data shared by different cores. - * Such data is dynamically allocated with SOF_MEM_FLAG_SHARED - * flag. Does nothing, since IMX doesn't support SMP. - */ -static inline void platform_shared_commit(void *ptr, int bytes) { } - #endif #define host_to_local(addr) (SDRAM0_BASE + ((addr) - MEM_RESERVED)) diff --git a/src/kernel/platform/imx8ulp/lib/clk.c b/src/kernel/platform/imx8ulp/lib/clk.c index 3bdc873eacf9..20e28e8eab21 100644 --- a/src/kernel/platform/imx8ulp/lib/clk.c +++ b/src/kernel/platform/imx8ulp/lib/clk.c @@ -38,6 +38,4 @@ void platform_clock_init(struct sof *sof) .set_freq = NULL, }; } - - platform_shared_commit(sof->clocks, sizeof(*sof->clocks) * NUM_CLOCKS); }