diff options
author | Syed Rafiuddin <srafiuddin@nvidia.com> | 2012-04-20 16:50:10 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-04-24 14:56:33 -0700 |
commit | d0903d7c37a2a4fbac6d830e7fdbcb7e512694d2 (patch) | |
tree | cd0e32ebab214ba78851b5be60019f31353585f1 /drivers/power | |
parent | 68c881c9d4dd9a6f581e98d7f05847abf301998f (diff) |
power: max17048: configure hibernate mode
configure fuel-gauge to enter and exit hibernate mode
Change-Id: Ifaa471a4b796fc1aa2b30f109091227eb19cf6ae
Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com>
Reviewed-on: http://git-master/r/97900
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/max17048_battery.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/power/max17048_battery.c b/drivers/power/max17048_battery.c index e5cdfa878267..e6dee61cc9b4 100644 --- a/drivers/power/max17048_battery.c +++ b/drivers/power/max17048_battery.c @@ -567,14 +567,30 @@ static int max17048_suspend(struct i2c_client *client, pm_message_t state) { struct max17048_chip *chip = i2c_get_clientdata(client); + int ret; cancel_delayed_work(&chip->work); + + ret = max17048_write_word(client, MAX17048_HIBRT, 0xffff); + if (ret < 0) { + dev_err(&client->dev, "failed in entering hibernate mode\n"); + return ret; + } + return 0; } static int max17048_resume(struct i2c_client *client) { struct max17048_chip *chip = i2c_get_clientdata(client); + int ret; + struct max17048_battery_model *mdata = chip->model_data; + + ret = max17048_write_word(client, MAX17048_HIBRT, mdata->hibernate); + if (ret < 0) { + dev_err(&client->dev, "failed in exiting hibernate mode\n"); + return ret; + } schedule_delayed_work(&chip->work, MAX17048_DELAY); return 0; |