From 61134f2569db43eef67203ae215dd7a790d60981 Mon Sep 17 00:00:00 2001 From: Venkat Reddy Talla Date: Tue, 25 Mar 2014 12:27:35 +0530 Subject: 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 Reviewed-on: http://git-master/r/386100 Reviewed-by: Laxman Dewangan --- drivers/power/lc709203f_battery.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/power') 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); -- cgit v1.2.3