diff options
author | Hyongbin Kim <hyongbink@nvidia.com> | 2013-08-12 19:46:55 +0900 |
---|---|---|
committer | Gabby Lee <galee@nvidia.com> | 2013-10-13 17:15:52 -0700 |
commit | f39a455220e340b17f59faa5c0c51d9bd3e382f1 (patch) | |
tree | d1589ae325fca829a47600eb0df1ad88d849b94d /drivers/power | |
parent | 327af2463d0012c46ba3ec811d4113ceb930fcdf (diff) |
power: max17048: Set default RCOMP when power off
Reset to default RCOMP value when power off.
Bug 1341794
Change-Id: I4b5b4d375a39593c67bf38703e782ce2d1bec933
Signed-off-by: Hyongbin Kim <hyongbink@nvidia.com>
Reviewed-on: http://git-master/r/260486
(cherry picked from commit 8f74af093cd0e5859a9adce2b98ee0d316609a93)
Reviewed-on: http://git-master/r/289143
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gabby Lee <galee@nvidia.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/max17048_battery.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/power/max17048_battery.c b/drivers/power/max17048_battery.c index e4798e46cd6d..d8ee14e51baa 100644 --- a/drivers/power/max17048_battery.c +++ b/drivers/power/max17048_battery.c @@ -943,6 +943,26 @@ static int __devexit max17048_remove(struct i2c_client *client) static void max17048_shutdown(struct i2c_client *client) { struct max17048_chip *chip = i2c_get_clientdata(client); + struct max17048_battery_model *mdata = chip->pdata->model_data; + int ret, val; + + /* reset RCOMP to default value */ + val = max17048_read_word(client, MAX17048_CONFIG); + if (val < 0) { + dev_err(&client->dev, + "%s(): Failed in reading register" \ + "MAX17048_CONFIG err %d\n", + __func__, val); + } else { + /* clear upper byte */ + val &= 0xFF; + /* Apply defaut Rcomp value */ + val |= (mdata->rcomp << 8); + ret = max17048_write_word(client, MAX17048_CONFIG, val); + if (ret < 0) + dev_err(&client->dev, + "failed set RCOMP\n"); + } if (client->irq) disable_irq(client->irq); |