diff --git a/src/platform/imx8/include/platform/lib/pm_runtime.h b/src/platform/imx8/include/platform/lib/pm_runtime.h deleted file mode 100644 index f2b85b2e9d4e..000000000000 --- a/src/platform/imx8/include/platform/lib/pm_runtime.h +++ /dev/null @@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright 2019 NXP - * - * Author: Daniel Baluta - */ - -#ifdef __SOF_LIB_PM_RUNTIME_H__ - -#ifndef __PLATFORM_LIB_PM_RUNTIME_H__ -#define __PLATFORM_LIB_PM_RUNTIME_H__ - -#include - -struct pm_runtime_data; - -/** - * \brief Initializes platform specific runtime power management. - * \param[in,out] prd Runtime power management data. - */ -static inline void platform_pm_runtime_init(struct pm_runtime_data *prd) { } - -/** - * \brief Retrieves platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -static inline void platform_pm_runtime_get(uint32_t context, uint32_t index, - uint32_t flags) { } - -/** - * \brief Releases platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -static inline void platform_pm_runtime_put(uint32_t context, uint32_t index, - uint32_t flags) { } - -static inline void platform_pm_runtime_enable(uint32_t context, - uint32_t index) {} - -static inline void platform_pm_runtime_disable(uint32_t context, - uint32_t index) {} - -static inline bool platform_pm_runtime_is_active(uint32_t context, - uint32_t index) -{ - return false; -} - -#endif /* __PLATFORM_LIB_PM_RUNTIME_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/pm_runtime.h" - -#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/src/platform/imx8ulp/include/platform/lib/pm_runtime.h b/src/platform/imx8ulp/include/platform/lib/pm_runtime.h deleted file mode 100644 index e3e246cf8301..000000000000 --- a/src/platform/imx8ulp/include/platform/lib/pm_runtime.h +++ /dev/null @@ -1,62 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright 2021 NXP - * - * Author: Daniel Baluta - * Author: Zhang Peng - */ - -#ifdef __SOF_LIB_PM_RUNTIME_H__ - -#ifndef __PLATFORM_LIB_PM_RUNTIME_H__ -#define __PLATFORM_LIB_PM_RUNTIME_H__ - -#include - -struct pm_runtime_data; - -/** - * \brief Initializes platform specific runtime power management. - * \param[in,out] prd Runtime power management data. - */ -static inline void platform_pm_runtime_init(struct pm_runtime_data *prd) { } - -/** - * \brief Retrieves platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -static inline void platform_pm_runtime_get(uint32_t context, uint32_t index, - uint32_t flags) { } - -/** - * \brief Releases platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -static inline void platform_pm_runtime_put(uint32_t context, uint32_t index, - uint32_t flags) { } - -static inline void platform_pm_runtime_enable(uint32_t context, - uint32_t index) {} - -static inline void platform_pm_runtime_disable(uint32_t context, - uint32_t index) {} - -static inline bool platform_pm_runtime_is_active(uint32_t context, - uint32_t index) -{ - return false; -} - -#endif /* __PLATFORM_LIB_PM_RUNTIME_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/pm_runtime.h" - -#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/src/platform/imx93_a55/include/platform/lib/pm_runtime.h b/src/platform/imx93_a55/include/platform/lib/pm_runtime.h deleted file mode 100644 index 8665518b08d5..000000000000 --- a/src/platform/imx93_a55/include/platform/lib/pm_runtime.h +++ /dev/null @@ -1,56 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright 2023 NXP - */ - -#ifdef __SOF_LIB_PM_RUNTIME_H__ - -#ifndef __PLATFORM_LIB_PM_RUNTIME_H__ -#define __PLATFORM_LIB_PM_RUNTIME_H__ - -/* TODO: is this required? Should this be implemented using Zephyr PM - * API? - */ -#include - -struct pm_runtime_data; - -static inline void platform_pm_runtime_init(struct pm_runtime_data *prd) -{ -} - -static inline void platform_pm_runtime_get(uint32_t context, - uint32_t index, - uint32_t flags) -{ -} - -static inline void platform_pm_runtime_put(uint32_t context, - uint32_t index, - uint32_t flags) -{ -} - -static inline void platform_pm_runtime_enable(uint32_t context, - uint32_t index) -{ -} - -static inline void platform_pm_runtime_disable(uint32_t context, - uint32_t index) -{ -} - -static inline bool platform_pm_runtime_is_active(uint32_t context, - uint32_t index) -{ - return false; -} - -#endif /* __PLATFORM_LIB_PM_RUNTIME_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/pm_runtime.h" - -#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/src/platform/intel/cavs/include/cavs/lib/pm_runtime.h b/src/platform/intel/cavs/include/cavs/lib/pm_runtime.h deleted file mode 100644 index 9b91c544fd58..000000000000 --- a/src/platform/intel/cavs/include/cavs/lib/pm_runtime.h +++ /dev/null @@ -1,97 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2019 Intel Corporation. All rights reserved. - * - * Author: Tomasz Lauda - */ - -/** - * \file cavs/lib/pm_runtime.h - * \brief Runtime power management header file for cAVS platforms - * \author Tomasz Lauda - */ - -#ifdef __PLATFORM_LIB_PM_RUNTIME_H__ - -#ifndef __CAVS_LIB_PM_RUNTIME_H__ -#define __CAVS_LIB_PM_RUNTIME_H__ - -#include - -/** - * \brief extra pwr flag to power up a core with a specific reason - * it can be powered down only with the same reason (flag) - */ -#define PWRD_MASK MASK(31, 30) -#define PWRD_BY_HPRO BIT(31) /**< requested by HPRO */ -#define PWRD_BY_TPLG BIT(30) /**< typical power up */ - -struct pm_runtime_data; - -/** \brief cAVS specific runtime power management data. */ -struct cavs_pm_runtime_data { - bool dsp_d0; /**< dsp target D0(true) or D0ix(false) */ - int host_dma_l1_sref; /**< ref counter for Host DMA accesses */ - uint32_t sleep_core_mask; /**< represents cores in waiti state */ - uint32_t prepare_d0ix_core_mask; /**< indicates whether core needs */ - /**< to prepare to d0ix power down */ - /**< before next waiti */ - int dsp_client_bitmap[CONFIG_CORE_COUNT]; /**< simple pwr override */ -}; - -/** - * \brief Initializes platform specific runtime power management. - * \param[in,out] prd Runtime power management data. - */ -void platform_pm_runtime_init(struct pm_runtime_data *prd); - -/** - * \brief Retrieves platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -void platform_pm_runtime_get(uint32_t context, uint32_t index, uint32_t flags); - -/** - * \brief Releases platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -void platform_pm_runtime_put(uint32_t context, uint32_t index, uint32_t flags); - -void platform_pm_runtime_enable(uint32_t context, uint32_t index); - -void platform_pm_runtime_disable(uint32_t context, uint32_t index); - -void platform_pm_runtime_prepare_d0ix_en(uint32_t index); - -void platform_pm_runtime_prepare_d0ix_dis(uint32_t index); - -int platform_pm_runtime_prepare_d0ix_is_req(uint32_t index); - -bool platform_pm_runtime_is_active(uint32_t context, uint32_t index); - -/** - * \brief Power gates platform specific hardware resources. - */ -void platform_pm_runtime_power_off(void); - -/** - * \brief CAVS DSP residency counters - * R0 - HPRO clock, highest power consumption state - * R1 - LPRO clock, low power consumption state - * R2 - LPS, lowest power consumption state - * with extra priority to R2 (LPS) which cannot be interrupted by R0/R1 changes - */ - -#endif - -#else - -#error "Do not include outside of platform/lib/pm_runtime.h" - -#endif diff --git a/src/platform/intel/cavs/platform.c b/src/platform/intel/cavs/platform.c index 50b482d1e905..fde0f22f0a22 100644 --- a/src/platform/intel/cavs/platform.c +++ b/src/platform/intel/cavs/platform.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -96,11 +95,6 @@ int platform_boot_complete(uint32_t boot_message) { struct ipc_cmd_hdr header; -#if CONFIG_TIGERLAKE - /* TGL specific HW recommended flow */ - pm_runtime_get(PM_RUNTIME_DSP, PWRD_BY_HPRO | (CONFIG_CORE_COUNT - 1)); -#endif - mailbox_dspbox_write(0, &ready, sizeof(ready)); /* get any IPC specific boot message and optional data */ @@ -121,17 +115,6 @@ static struct pm_notifier pm_state_notifier = { int platform_init(struct sof *sof) { int ret; - int i; - - /* Turn off memory for all unused cores */ - for (i = 0; i < CONFIG_CORE_COUNT; i++) - if (i != PLATFORM_PRIMARY_CORE_ID) - pm_runtime_put(CORE_MEMORY_POW, i); - - /* pm runtime already initialized, request the DSP to stay in D0 - * until we are allowed to do full power gating (by the IPC req). - */ - pm_runtime_disable(PM_RUNTIME_DSP, 0); trace_point(TRACE_BOOT_PLATFORM_CLOCK); platform_clock_init(sof); @@ -150,15 +133,6 @@ int platform_init(struct sof *sof) /* Set CPU to max frequency for booting (single shim_write below) */ trace_point(TRACE_BOOT_PLATFORM_CPU_FREQ); -#if CONFIG_TIGERLAKE - /* prevent DSP Common power gating */ - pm_runtime_get(PM_RUNTIME_DSP, PLATFORM_PRIMARY_CORE_ID); - -#if CONFIG_DSP_RESIDENCY_COUNTERS - init_dsp_r_state(r0_r_state); -#endif /* CONFIG_DSP_RESIDENCY_COUNTERS */ -#endif /* CONFIG_TIGERLAKE */ - /* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); ret = dmac_init(sof); diff --git a/src/platform/lunarlake/include/platform/lib/pm_runtime.h b/src/platform/lunarlake/include/platform/lib/pm_runtime.h deleted file mode 100644 index a5d16dc40f78..000000000000 --- a/src/platform/lunarlake/include/platform/lib/pm_runtime.h +++ /dev/null @@ -1,72 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2023 Intel Corporation. All rights reserved. - * - * Author: Tomasz Lauda - */ - -/** - * \file platform/lunarlake/include/platform/lib/pm_runtime.h - * \brief Runtime power management header file for Tigerlake - * \author Tomasz Lauda - */ - -#ifdef __SOF_LIB_PM_RUNTIME_H__ - -#ifndef __PLATFORM_LIB_PM_RUNTIME_H__ -#define __PLATFORM_LIB_PM_RUNTIME_H__ - -#include -#include - -/** - * \brief extra pwr flag to power up a core with a specific reason - * it can be powered down only with the same reason (flag) - */ -#define PWRD_MASK MASK(31, 30) -#define PWRD_BY_HPRO BIT(31) /**< requested by HPRO */ -#define PWRD_BY_TPLG BIT(30) /**< typical power up */ - -struct pm_runtime_data; - -/** - * \brief Initializes platform specific runtime power management. - * \param[in,out] prd Runtime power management data. - */ -void platform_pm_runtime_init(struct pm_runtime_data *prd); - -/** - * \brief Retrieves platform specific power management resource. - * - * \param[in] context - Type of power management context. - * \param[in] index - index of the device. - * \param[in] flags - Flags, set of RPM_... - */ -void platform_pm_runtime_get(uint32_t context, uint32_t index, uint32_t flags); - -/** - * \brief Releases platform specific power management resource. - * - * \param[in] context - Type of power management context. - * \param[in] index - Index of the device. - * \param[in] flags - Flags, set of RPM_... - */ -void platform_pm_runtime_put(uint32_t context, uint32_t index, uint32_t flags); - -void platform_pm_runtime_prepare_d0ix_en(uint32_t index); - -void platform_pm_runtime_enable(uint32_t context, uint32_t index); - -void platform_pm_runtime_disable(uint32_t context, uint32_t index); - -bool platform_pm_runtime_is_active(uint32_t context, uint32_t index); - -void platform_pm_runtime_power_off(void); - -#endif /* __PLATFORM_LIB_PM_RUNTIME_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/pm_runtime.h" - -#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/src/platform/meteorlake/include/platform/lib/pm_runtime.h b/src/platform/meteorlake/include/platform/lib/pm_runtime.h deleted file mode 100644 index bbf7c018e904..000000000000 --- a/src/platform/meteorlake/include/platform/lib/pm_runtime.h +++ /dev/null @@ -1,70 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2022 Intel Corporation. All rights reserved. - * - * Author: Tomasz Lauda - */ - -/** - * \file platform/tigerlake/include/platform/lib/pm_runtime.h - * \brief Runtime power management header file for Tigerlake - * \author Tomasz Lauda - */ - -#ifdef __SOF_LIB_PM_RUNTIME_H__ - -#ifndef __PLATFORM_LIB_PM_RUNTIME_H__ -#define __PLATFORM_LIB_PM_RUNTIME_H__ - -#include -#include - -/** - * \brief extra pwr flag to power up a core with a specific reason - * it can be powered down only with the same reason (flag) - */ -#define PWRD_MASK MASK(31, 30) -#define PWRD_BY_HPRO BIT(31) /**< requested by HPRO */ -#define PWRD_BY_TPLG BIT(30) /**< typical power up */ - -struct pm_runtime_data; - -/** - * \brief Initializes platform specific runtime power management. - * \param[in,out] prd Runtime power management data. - */ -void platform_pm_runtime_init(struct pm_runtime_data *prd); - -/** - * \brief Retrieves platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -void platform_pm_runtime_get(uint32_t context, uint32_t index, uint32_t flags); - -/** - * \brief Releases platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index Index of the device. - * \param[in] flags Flags, set of RPM_... - */ -void platform_pm_runtime_put(uint32_t context, uint32_t index, uint32_t flags); - -void platform_pm_runtime_prepare_d0ix_en(uint32_t index); - -void platform_pm_runtime_enable(uint32_t context, uint32_t index); - -void platform_pm_runtime_disable(uint32_t context, uint32_t index); - -bool platform_pm_runtime_is_active(uint32_t context, uint32_t index); - -#endif /* __PLATFORM_LIB_PM_RUNTIME_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/pm_runtime.h" - -#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/src/platform/pantherlake/include/platform/lib/pm_runtime.h b/src/platform/pantherlake/include/platform/lib/pm_runtime.h deleted file mode 100644 index edb1ebdeee49..000000000000 --- a/src/platform/pantherlake/include/platform/lib/pm_runtime.h +++ /dev/null @@ -1,72 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2022-2024 Intel Corporation. - * - * Author: Tomasz Lauda - */ - -/** - * \file platform/pantherlake/include/platform/lib/pm_runtime.h - * \brief Runtime power management header file for Tigerlake - * \author Tomasz Lauda - */ - -#ifdef __SOF_LIB_PM_RUNTIME_H__ - -#ifndef __PLATFORM_LIB_PM_RUNTIME_H__ -#define __PLATFORM_LIB_PM_RUNTIME_H__ - -#include -#include - -/** - * \brief extra pwr flag to power up a core with a specific reason - * it can be powered down only with the same reason (flag) - */ -#define PWRD_MASK MASK(31, 30) -#define PWRD_BY_HPRO BIT(31) /**< requested by HPRO */ -#define PWRD_BY_TPLG BIT(30) /**< typical power up */ - -struct pm_runtime_data; - -/** - * \brief Initializes platform specific runtime power management. - * \param[in,out] prd Runtime power management data. - */ -void platform_pm_runtime_init(struct pm_runtime_data *prd); - -/** - * \brief Retrieves platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index of the device. - * \param[in] flags, set of RPM_... - */ -void platform_pm_runtime_get(uint32_t context, uint32_t index, uint32_t flags); - -/** - * \brief Releases platform specific power management resource. - * - * \param[in] context Type of power management context. - * \param[in] index of the device. - * \param[in] flags, set of RPM_... - */ -void platform_pm_runtime_put(uint32_t context, uint32_t index, uint32_t flags); - -void platform_pm_runtime_prepare_d0ix_en(uint32_t index); - -void platform_pm_runtime_enable(uint32_t context, uint32_t index); - -void platform_pm_runtime_disable(uint32_t context, uint32_t index); - -bool platform_pm_runtime_is_active(uint32_t context, uint32_t index); - -void platform_pm_runtime_power_off(void); - -#endif /* __PLATFORM_LIB_PM_RUNTIME_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/pm_runtime.h" - -#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/src/platform/tigerlake/include/platform/lib/pm_runtime.h b/src/platform/tigerlake/include/platform/lib/pm_runtime.h deleted file mode 100644 index fbc670e5baec..000000000000 --- a/src/platform/tigerlake/include/platform/lib/pm_runtime.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2018 Intel Corporation. All rights reserved. - * - * Author: Tomasz Lauda - */ - -/** - * \file platform/tigerlake/include/platform/lib/pm_runtime.h - * \brief Runtime power management header file for Tigerlake - * \author Tomasz Lauda - */ - -#ifdef __SOF_LIB_PM_RUNTIME_H__ - -#ifndef __PLATFORM_LIB_PM_RUNTIME_H__ -#define __PLATFORM_LIB_PM_RUNTIME_H__ - -#include - -#endif /* __PLATFORM_LIB_PM_RUNTIME_H__ */ - -#else - -#error "This file shouldn't be included from outside of sof/lib/pm_runtime.h" - -#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 296fd27e4841..eaf185b9c8b8 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -231,7 +231,6 @@ if (CONFIG_SOC_SERIES_INTEL_CAVS_V25) zephyr_library_sources( ${SOF_PLATFORM_PATH}/intel/cavs/platform.c ${SOF_PLATFORM_PATH}/tigerlake/lib/clk.c - lib/pm_runtime.c lib/clk.c lib/dma.c ) @@ -251,7 +250,6 @@ if (CONFIG_SOC_SERIES_INTEL_ADSP_ACE) # Platform sources zephyr_library_sources( ${SOF_PLATFORM_PATH}/intel/ace/platform.c - lib/pm_runtime.c lib/clk.c lib/dma.c ) @@ -428,7 +426,6 @@ zephyr_library_sources( # SOF library - parts to transition to Zephyr over time ${SOF_LIB_PATH}/clk.c ${SOF_LIB_PATH}/notifier.c - ${SOF_LIB_PATH}/pm_runtime.c ${SOF_LIB_PATH}/cpu-clk-manager.c ${SOF_LIB_PATH}/dma.c ${SOF_LIB_PATH}/dai.c @@ -461,6 +458,7 @@ zephyr_library_sources( schedule.c lib/alloc.c lib/cpu.c + lib/pm_runtime.c # Common library functions - Will be moved to Zephyr over time lib.c diff --git a/zephyr/include/sof/lib/pm_runtime.h b/zephyr/include/sof/lib/pm_runtime.h new file mode 100644 index 000000000000..ee02eff51aad --- /dev/null +++ b/zephyr/include/sof/lib/pm_runtime.h @@ -0,0 +1,131 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2024 Intel Corporation. + */ + +#ifndef __SOF_LIB_PM_RUNTIME_H__ +#define __SOF_LIB_PM_RUNTIME_H__ + +#include +#include + +/** \addtogroup pm_runtime PM Runtime + * SOF PM runtime specification mapping for Zephyr builds. + * + * This interface is considered deprecated and native Zephyr + * interfaces should be used instead. + * @{ + */ + +/** \brief Runtime power management context */ +enum pm_runtime_context { + PM_RUNTIME_DSP /**< DSP */ +}; + +/** + * \brief Initializes runtime power management. + */ +static inline void pm_runtime_init(struct sof *sof) +{ +} + +/** + * \brief Retrieves power management resource (async). + * + * \param[in] context Type of power management context. + * \param[in] index Index of the device. + */ +void pm_runtime_get(enum pm_runtime_context context, uint32_t index); + +/** + * \brief Retrieves power management resource. + * + * \param[in] context Type of power management context. + * \param[in] index Index of the device. + */ +static inline void pm_runtime_get_sync(enum pm_runtime_context context, uint32_t index) +{ +} + + +/** + * \brief Releases power management resource (async). + * + * \param[in] context Type of power management context. + * \param[in] index Index of the device. + */ +void pm_runtime_put(enum pm_runtime_context context, uint32_t index); + +/** + * \brief Releases power management resource. + * + * \param[in] context Type of power management context. + * \param[in] index Index of the device. + */ +static inline void pm_runtime_put_sync(enum pm_runtime_context context, uint32_t index) +{ +} + +/** + * \brief Enables power management operations for the resource. + * + * \param[in] context Type of power management context. + * \param[in] index Index of the device. + */ +void pm_runtime_enable(enum pm_runtime_context context, uint32_t index); + +/** + * \brief Disables power management operations for the resource. + * + * \param[in] context Type of power management context. + * \param[in] index Index of the device. + */ +void pm_runtime_disable(enum pm_runtime_context context, uint32_t index); + +/** + * \brief Reports state of the power managed resource. + * + * @param context Type of power management context. + * @param index Index of the resource. + * + * @return true if the resource is active or pm disabled, false otherwise. + */ +bool pm_runtime_is_active(enum pm_runtime_context context, uint32_t index); + +static inline void platform_pm_runtime_prepare_d0ix_en(uint32_t index) +{ +} + +#if CONFIG_DSP_RESIDENCY_COUNTERS + +/** + * \brief Initializes DSP residency counters. + * + * \param[in] context Type of power management context. + */ +static inline void init_dsp_r_state(enum dsp_r_state) +{ +} + +/** + * \brief Reports DSP residency state. + * + * \param[in] new state + */ +static inline void report_dsp_r_state(enum dsp_r_state) +{ +} + +/** + * \brief Retrieves current DSP residency state. + * + * @return active DSP residency state + */ +static inline enum dsp_r_state get_dsp_r_state(void) +{ +} +#endif + +/** @}*/ + +#endif /* __SOF_LIB_PM_RUNTIME_H__ */ diff --git a/zephyr/lib/pm_runtime.c b/zephyr/lib/pm_runtime.c index 3f614683c8bc..fcaa03cb7275 100644 --- a/zephyr/lib/pm_runtime.c +++ b/zephyr/lib/pm_runtime.c @@ -64,7 +64,7 @@ const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks) } #endif /* CONFIG_PM_POLICY_CUSTOM */ -void platform_pm_runtime_enable(uint32_t context, uint32_t index) +void pm_runtime_enable(enum pm_runtime_context context, uint32_t index) { switch (context) { case PM_RUNTIME_DSP: @@ -77,7 +77,8 @@ void platform_pm_runtime_enable(uint32_t context, uint32_t index) } } -void platform_pm_runtime_disable(uint32_t context, uint32_t index) +/** Disables power _management_. The management, not the power. */ +void pm_runtime_disable(enum pm_runtime_context context, uint32_t index) { switch (context) { case PM_RUNTIME_DSP: @@ -89,19 +90,18 @@ void platform_pm_runtime_disable(uint32_t context, uint32_t index) } } -void platform_pm_runtime_init(struct pm_runtime_data *prd) -{ } - -void platform_pm_runtime_get(enum pm_runtime_context context, uint32_t index, - uint32_t flags) -{ } - -void platform_pm_runtime_put(enum pm_runtime_context context, uint32_t index, - uint32_t flags) -{ } - -void platform_pm_runtime_prepare_d0ix_en(uint32_t index) -{ } - -void platform_pm_runtime_power_off(void) -{ } +/** Is the _power_ active. The power, not its management. */ +bool pm_runtime_is_active(enum pm_runtime_context context, uint32_t index) +{ + switch (context) { + case PM_RUNTIME_DSP: +#if defined(CONFIG_PM) + return pm_policy_state_lock_is_active(PM_STATE_RUNTIME_IDLE, PM_ALL_SUBSTATES); +#else + return true; +#endif + default: + break; + } + return false; +}