device: Extend device_set_power_state API to support async requests

The existing device_set_power_state() API works only in synchronous
mode and this is not desirable for devices(ex: Gyro) which take
longer time (few 100 mSec) to suspend/resume.

To support async mode, a new callback argument is added to the API.
The device drivers can asynchronously suspend/resume and call the
callback function upon completion of the async request.

This commit adds the missing callback parameter to all the drivers
to make it compliant with the new API.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
Ramakrishna Pallala 2019-02-14 09:35:42 +05:30 committed by Anas Nashif
commit e1639b5345
29 changed files with 246 additions and 120 deletions

View file

@ -321,11 +321,18 @@ static int pwm_nrfx_pm_control(struct device *dev,
#define PWM_NRFX_PM_CONTROL(idx) \
static int pwm_##idx##_nrfx_pm_control(struct device *dev, \
u32_t ctrl_command, \
void *context) \
void *context, \
device_pm_cb cb, \
void *arg) \
{ \
static u32_t current_state = DEVICE_PM_ACTIVE_STATE; \
return pwm_nrfx_pm_control(dev, ctrl_command, context, \
int ret = 0; \
ret = pwm_nrfx_pm_control(dev, ctrl_command, context, \
&current_state); \
if (cb) { \
cb(dev, ret, context, arg); \
} \
return ret; \
}
#else