summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVenkat Reddy Talla <vreddytalla@nvidia.com>2014-03-25 12:27:35 +0530
committerLaxman Dewangan <ldewangan@nvidia.com>2014-03-25 05:05:34 -0700
commit61134f2569db43eef67203ae215dd7a790d60981 (patch)
treec955933bbc5ee10808fd8e10ead91783b583eb0c
parent9c387643e40fcfb6cf6eb426d75c81873fa7c098 (diff)
power: lc709203f: do not override initial RSOC value
do not program lc709203 register 0x07 if initial rsoc value provided in dts file is 0. fuel gauge will be automatically initialzed 10 ms after battery connected to the device and will track the RSOC thereafter. Bug 1470891 Change-Id: I79c9860c03416bd3287d8011493b351fc006b925 Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com> Reviewed-on: http://git-master/r/386100 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
-rw-r--r--drivers/power/lc709203f_battery.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/power/lc709203f_battery.c b/drivers/power/lc709203f_battery.c
index 75c946a4e14d..67505caa4ee4 100644
--- a/drivers/power/lc709203f_battery.c
+++ b/drivers/power/lc709203f_battery.c
@@ -322,12 +322,8 @@ static void of_lc709203f_parse_platform_data(struct i2c_client *client,
int ret;
ret = of_property_read_u32(np, "onsemi,initial-rsoc", &pval);
- if (!ret) {
+ if (!ret)
pdata->initial_rsoc = pval;
- } else {
- dev_warn(&client->dev, "initial-rsoc not provided\n");
- pdata->initial_rsoc = 0xAA55;
- }
ret = of_property_read_u32(np, "onsemi,appli-adjustment", &pval);
if (!ret)
@@ -465,14 +461,17 @@ static int lc709203f_probe(struct i2c_client *client,
chip->shutdown_complete = 0;
i2c_set_clientdata(client, chip);
- ret = lc709203f_write_word(chip->client,
- LC709203F_INITIAL_RSOC, chip->pdata->initial_rsoc);
- if (ret < 0) {
- dev_err(&client->dev, "INITIAL_RSOC write failed: %d\n", ret);
- return ret;
- }
- dev_info(&client->dev, "initial-rsoc: 0x%04x\n",
+ if (chip->pdata->initial_rsoc) {
+ ret = lc709203f_write_word(chip->client,
+ LC709203F_INITIAL_RSOC, chip->pdata->initial_rsoc);
+ if (ret < 0) {
+ dev_err(&client->dev,
+ "INITIAL_RSOC write failed: %d\n", ret);
+ return ret;
+ }
+ dev_info(&client->dev, "initial-rsoc: 0x%04x\n",
chip->pdata->initial_rsoc);
+ }
ret = lc709203f_write_word(chip->client,
LC709203F_ALARM_LOW_CELL_RSOC, chip->pdata->alert_low_rsoc);