doc: power_mgmt: Added Power Management documentation

Documented the Power Management subsystem which includes the
power management hook interface, device power management,
device busy status interfac and other APIs. Also included
is a guide to writing Power Management applications.

This has 2 parts.  One is the general description of the
infrastructure and the PMA writing guide which goes in the
'subsystem' area. Other is the API description that gets
automatically pulled in from the comments in the source files.
The API description goes into the section where all other
Zephyr APIs are put.

Change-Id: Id630209b23f931a8fcccb6f59428610298486743
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
This commit is contained in:
Ramesh Thomas 2016-04-21 12:18:12 -07:00 committed by Anas Nashif
commit 6d1e3cf96d
7 changed files with 637 additions and 18 deletions

View file

@ -267,10 +267,24 @@ extern struct device_pm_ops device_pm_ops_nop;
struct device;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
/**
* @brief Device Power Management APIs
* @defgroup device_power_management_api Device Power Management APIs
* @ingroup power_management_api
* @{
*/
/**
* @brief Structure holding handlers for device PM operations
* @param suspend Pointer to the handler for suspend operations
* @param resume Pointer to the handler for resume operations
*/
struct device_pm_ops {
int (*suspend)(struct device *device, int pm_policy);
int (*resume)(struct device *device, int pm_policy);
};
/**
* @}
*/
#endif
/**
@ -304,6 +318,13 @@ struct device {
void _sys_device_do_config_level(int level);
struct device* device_get_binding(char *name);
/**
* @brief Device Power Management APIs
* @defgroup device_power_management_api Device Power Management APIs
* @ingroup power_management_api
* @{
*/
/**
* @brief Indicate that the device is in the middle of a transaction
*
@ -324,7 +345,7 @@ void device_busy_set(struct device *busy_dev);
void device_busy_clear(struct device *busy_dev);
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
/**
/*
* Device PM functions
*/
@ -334,10 +355,10 @@ void device_busy_clear(struct device *busy_dev);
* This function should be used to initialize device pm hooks
* for which a device has no operation.
*
* @param unused_device
* @param unused_policy
* @param unused_device Unused
* @param unused_policy Unused
*
* @retval Always returns 0
* @retval 0 Always returns 0
*/
int device_pm_nop(struct device *unused_device, int unused_policy);
@ -351,8 +372,7 @@ int device_pm_nop(struct device *unused_device, int unused_policy);
* @param pm_policy PM policy for which this call is made.
*
* @retval 0 If successful.
* @retval -EBUSY If device is busy
* @retval Other negative errno code if failure.
* @retval Errno Negative errno code if failure.
*/
static inline int device_suspend(struct device *device, int pm_policy)
{
@ -369,7 +389,7 @@ static inline int device_suspend(struct device *device, int pm_policy)
* @param pm_policy PM policy for which this call is made.
*
* @retval 0 If successful.
* @retval Negative errno code if failure.
* @retval Errno Negative errno code if failure.
*/
static inline int device_resume(struct device *device, int pm_policy)
{
@ -415,6 +435,10 @@ int device_busy_check(struct device *chk_dev);
#endif
/**
* @}
*/
/**
* Synchronous calls API
*/