aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/power/ds2760_battery.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index ed0ea5e275c5..2d0e5edb4742 100644
--- a/drivers/power/ds2760_battery.c
+++ b/drivers/power/ds2760_battery.c
@@ -172,8 +172,13 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di)
172 di->full_active_uAh = di->raw[DS2760_ACTIVE_FULL] << 8 | 172 di->full_active_uAh = di->raw[DS2760_ACTIVE_FULL] << 8 |
173 di->raw[DS2760_ACTIVE_FULL + 1]; 173 di->raw[DS2760_ACTIVE_FULL + 1];
174 174
175 scale[0] = di->raw[DS2760_ACTIVE_FULL] << 8 | 175 /* If the full_active_uAh value is not given, fall back to the rated
176 di->raw[DS2760_ACTIVE_FULL + 1]; 176 * capacity. This is likely to happen when chips are not part of the
177 * battery pack and is therefore not bootstrapped. */
178 if (di->full_active_uAh == 0)
179 di->full_active_uAh = di->rated_capacity / 1000L;
180
181 scale[0] = di->full_active_uAh;
177 for (i = 1; i < 5; i++) 182 for (i = 1; i < 5; i++)
178 scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i]; 183 scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i];
179 184