power_mgmt: APIs for devices to signal busy
Certain Low power SOC states (e.g. deep sleep) will result in device IP blocks losing state. In such a scenario it can be useful to have a mechanism for devices (driver code) to signal the power manager / policy that they are in the middle of a transaction. We expect the device driver code to make a call to device_busy_set(device *) before initiating a transaction and device_busy_clear(device *) on completion. It is expected that device driver developers will add this as necessary in their drivers. Further an API is provided for power manager application / policy to check this. Based on this the power manager / policy can decide whether or not to go into a particular power state. Change-Id: I0fedd90b98e182cd41b53c7f9e08655532822faa Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
This commit is contained in:
parent
35360df9be
commit
592882e5f4
4 changed files with 110 additions and 1 deletions
|
@ -304,6 +304,25 @@ struct device {
|
|||
void _sys_device_do_config_level(int level);
|
||||
struct device* device_get_binding(char *name);
|
||||
|
||||
/**
|
||||
* @brief Indicate that the device is in the middle of a transaction
|
||||
*
|
||||
* Called by a device driver to indicate that it is in the middle of a
|
||||
* transaction.
|
||||
*
|
||||
* @param busy_dev Pointer to device structure of the driver instance.
|
||||
*/
|
||||
void device_busy_set(struct device *busy_dev);
|
||||
|
||||
/**
|
||||
* @brief Indicate that the device has completed its transaction
|
||||
*
|
||||
* Called by a device driver to indicate the end of a transaction.
|
||||
*
|
||||
* @param busy_dev Pointer to device structure of the driver instance.
|
||||
*/
|
||||
void device_busy_clear(struct device *busy_dev);
|
||||
|
||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
/**
|
||||
* Device PM functions
|
||||
|
@ -370,6 +389,30 @@ static inline int device_resume(struct device *device, int pm_policy)
|
|||
*/
|
||||
void device_list_get(struct device **device_list, int *device_count);
|
||||
|
||||
/**
|
||||
* @brief Check if any device is in the middle of a transaction
|
||||
*
|
||||
* Called by an application to see if any device is in the middle
|
||||
* of a critical transaction that cannot be interrupted.
|
||||
*
|
||||
* @retval 0 if no device is busy
|
||||
* @retval -EBUSY if any device is busy
|
||||
*/
|
||||
int device_any_busy_check(void);
|
||||
|
||||
/**
|
||||
* @brief Check if a specific device is in the middle of a transaction
|
||||
*
|
||||
* Called by an application to see if a particular device is in the
|
||||
* middle of a critical transaction that cannot be interrupted.
|
||||
*
|
||||
* @param chk_dev Pointer to device structure of the specific device driver
|
||||
* the caller is interested in.
|
||||
* @retval 0 if the device is not busy
|
||||
* @retval -EBUSY if the device is busy
|
||||
*/
|
||||
int device_busy_check(struct device *chk_dev);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue