power_mgmt: Add device power management support

Added device power management hook infrastructure. Added
DEVICE_INIT_PM and SYS_INIT_PM macros that creates device
structures with the supplied device_ops structure containing
the hooks.

Added example support in gpio_dw driver.  Updated the sample
app and tested using LPS and Device Suspend Only policies.

Change-Id: I2fe347f8d8fd1041d8318e02738990deb8c5d68e
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Ramesh Thomas 2016-03-23 23:23:10 -07:00 committed by Anas Nashif
commit 4104bbfb08
15 changed files with 276 additions and 144 deletions

View file

@ -544,24 +544,6 @@ static int gpio_pcal9535a_disable_callback(struct device *dev,
return -ENOTSUP;
}
static int gpio_pcal9535a_suspend_port(struct device *dev)
{
if (!_has_i2c_master(dev)) {
return -EINVAL;
}
return -ENOTSUP;
}
static int gpio_pcal9535a_resume_port(struct device *dev)
{
if (!_has_i2c_master(dev)) {
return -EINVAL;
}
return -ENOTSUP;
}
static struct gpio_driver_api gpio_pcal9535a_drv_api_funcs = {
.config = gpio_pcal9535a_config,
.write = gpio_pcal9535a_write,
@ -569,8 +551,6 @@ static struct gpio_driver_api gpio_pcal9535a_drv_api_funcs = {
.set_callback = gpio_pcal9535a_set_callback,
.enable_callback = gpio_pcal9535a_enable_callback,
.disable_callback = gpio_pcal9535a_disable_callback,
.suspend = gpio_pcal9535a_suspend_port,
.resume = gpio_pcal9535a_resume_port,
};
/**