diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2014-05-22 15:32:39 +0530 |
---|---|---|
committer | Mrutyunjay Sawant <msawant@nvidia.com> | 2014-06-04 00:34:35 -0700 |
commit | b02a56ed7d2315c85f5ad00424be4e5c34f7e48e (patch) | |
tree | abf2ddd51cced99fa381ebf5b3d573929760e3a4 /drivers/power | |
parent | 42b26f9dc403621b00b2e75311ec1fa863804cda (diff) |
power: lc70903f: return old temp of device read failed
It is observed that device read failed once in while when reading
temp from device. The next read success. To resolve the temp read fail
from device, return last temperature read from device.
bug 200006331
Change-Id: Ic305dbc013a44e71490b9c4defe752319cb22b44
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/413137
Reviewed-on: http://git-master/r/417766
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/lc709203f_battery.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/power/lc709203f_battery.c b/drivers/power/lc709203f_battery.c index 55a549df490d..475dddfe43c4 100644 --- a/drivers/power/lc709203f_battery.c +++ b/drivers/power/lc709203f_battery.c @@ -91,6 +91,7 @@ struct lc709203f_chip { int shutdown_complete; int charge_complete; struct mutex mutex; + int read_failed; }; static int lc709203f_read_word(struct i2c_client *client, u8 reg) @@ -198,9 +199,13 @@ static int lc709203f_get_temperature(struct lc709203f_chip *chip) val = lc709203f_read_word(chip->client, LC709203F_TEMPERATURE); if (val < 0) { + chip->read_failed++; dev_err(&chip->client->dev, "%s: err %d\n", __func__, val); - return val; + if (chip->read_failed > 50) + return val; + return chip->temperature; } + chip->read_failed = 0;; chip->temperature = val; return val; } |