-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zephyr: decouple from platform pm_runtime.h interface
SOF defines a pm_runtime.h interface that consists of a RTOS layer and a platform specific layer. So far, the interface has been used in driver code and a very small set of audio modules (e.g. key phrase buffer in kpb.c). The platform layer has only been implemented on Intel platforms. A no-op implementation is used for other platforms. As all Intel platforms have moved to Zephyr, this now allows to simplify the code a lot for SOF Zephyr builds and drop all dependencies to the pm_runtime.h platform layer. With Zephyr, the drivers are defined on Zephyr side and the device runtime management can be handled with Zephyr device interfaces. This patch removes any use of the platform layer and also drops the generic lib/pm_runtime.c from Zephyr builds. A thin sof/lib/pm_runtime.h for Zephyr is added to handle the few uses of pm_runtime interface in SOF codebase (e.g. init and kbp). The changes simplify the codebase and reduce the amount of boilerplate code needed to add new hardware targets to SOF, when Zephyr is used as the RTOS. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
- Loading branch information
Showing
3 changed files
with
150 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <rtos/sof.h> | ||
#include <stdint.h> | ||
|
||
/** \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__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters