diff --git a/src/audio/base_fw.c b/src/audio/base_fw.c index 54a09de4a437..d5284dbe515c 100644 --- a/src/audio/base_fw.c +++ b/src/audio/base_fw.c @@ -58,6 +58,7 @@ static int basefw_config(uint32_t *data_offset, char *data) tuple = tlv_next(tuple); tlv_value_uint32_set(tuple, IPC4_MEMORY_RECLAIMED_FW_CFG, 1); +#ifndef CONFIG_SOF_ZEPHYR_NO_SOF_CLOCK tuple = tlv_next(tuple); tlv_value_uint32_set(tuple, IPC4_FAST_CLOCK_FREQ_HZ_FW_CFG, CLK_MAX_CPU_HZ); @@ -65,6 +66,7 @@ static int basefw_config(uint32_t *data_offset, char *data) tlv_value_uint32_set(tuple, IPC4_SLOW_CLOCK_FREQ_HZ_FW_CFG, clock_get_freq(CPU_LOWEST_FREQ_IDX)); +#endif tuple = tlv_next(tuple); tlv_value_uint32_set(tuple, IPC4_DL_MAILBOX_BYTES_FW_CFG, MAILBOX_HOSTBOX_SIZE); @@ -220,17 +222,21 @@ static int basefw_register_kcps(bool first_block, if (!(first_block && last_block)) return IPC4_ERROR_INVALID_PARAM; +#if CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL /* value of kcps to request on core 0. Can be negative */ if (core_kcps_adjust(0, *(int32_t *)data)) return IPC4_ERROR_INVALID_PARAM; +#endif return IPC4_SUCCESS; } static int basefw_kcps_allocation_request(struct ipc4_resource_kcps *request) { +#if CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL if (core_kcps_adjust(request->core_id, request->kcps)) return IPC4_ERROR_INVALID_PARAM; +#endif return IPC4_SUCCESS; } @@ -259,6 +265,7 @@ static int basefw_resource_allocation_request(bool first_block, static int basefw_power_state_info_get(uint32_t *data_offset, char *data) { +#if CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL struct sof_tlv *tuple = (struct sof_tlv *)data; uint32_t core_kcps[CONFIG_CORE_COUNT] = {0}; int core_id; @@ -275,6 +282,9 @@ static int basefw_power_state_info_get(uint32_t *data_offset, char *data) tuple = tlv_next(tuple); *data_offset = (int)((char *)tuple - data); return IPC4_SUCCESS; +#else + return IPC4_UNAVAILABLE; +#endif } static int basefw_libraries_info_get(uint32_t *data_offset, char *data) diff --git a/src/audio/pipeline/pipeline-graph.c b/src/audio/pipeline/pipeline-graph.c index 7abc5ed8c461..f30731fa4874 100644 --- a/src/audio/pipeline/pipeline-graph.c +++ b/src/audio/pipeline/pipeline-graph.c @@ -282,7 +282,7 @@ int pipeline_complete(struct pipeline *p, struct comp_dev *source, .comp_data = &data, }; -#if !UNIT_TEST && !CONFIG_LIBRARY +#if !UNIT_TEST && !CONFIG_LIBRARY && CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL int __maybe_unused freq = clock_get_freq(cpu_get_id()); #else int __maybe_unused freq = 0; diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index c27f407ec891..9cd35970c09d 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -490,9 +490,7 @@ zephyr_library_sources( ${SOF_MATH_PATH}/exp_fcn_hifi.c # SOF library - parts to transition to Zephyr over time - ${SOF_LIB_PATH}/clk.c ${SOF_LIB_PATH}/notifier.c - ${SOF_LIB_PATH}/cpu-clk-manager.c ${SOF_LIB_PATH}/dma.c ${SOF_LIB_PATH}/dai.c @@ -530,6 +528,14 @@ zephyr_library_sources( lib.c ) +if(NOT CONFIG_SOF_ZEPHYR_NO_SOF_CLOCK) + zephyr_library_sources(${SOF_LIB_PATH}/clk.c) +endif() + +zephyr_library_sources_ifdef(CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL + ${SOF_LIB_PATH}/cpu-clk-manager.c +) + # Optional math utility zephyr_library_sources_ifdef(CONFIG_MATH_LUT_SINE_FIXED ${SOF_MATH_PATH}/lut_trig.c diff --git a/zephyr/Kconfig b/zephyr/Kconfig index b348fd7b9728..535cb6bc59ea 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -76,4 +76,10 @@ config SOF_BOOT_TEST initialized. After that SOF will continue running and be usable as usual. +config SOF_ZEPHYR_NO_SOF_CLOCK + bool + help + Do not use SOF clk.h interface to set the DSP clock frequency. + Requires implementation of platform/lib/clk.h. + endif diff --git a/zephyr/include/rtos/clk.h b/zephyr/include/rtos/clk.h index b0fefc748334..6db452bdab88 100644 --- a/zephyr/include/rtos/clk.h +++ b/zephyr/include/rtos/clk.h @@ -6,9 +6,10 @@ #ifndef __ZEPHYR_RTOS_CLK_H__ #define __ZEPHYR_RTOS_CLK_H__ +#ifndef CONFIG_SOF_ZEPHYR_NO_SOF_CLOCK + #include -/* TODO remove once drivers upstream */ #define __SOF_LIB_CLK_H__ #include @@ -77,4 +78,6 @@ static inline struct clock_info *clocks_get(void) return sof_get()->clocks; } +#endif /* CONFIG_SOF_ZEPHYR_NO_SOF_CLOCK */ + #endif /* __ZEPHYR_RTOS_CLK_H__ */