aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-11-10 09:42:48 -0500
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-11-18 19:02:41 -0500
commite59ec4a1899dfff007d91b30f00e7211731b816b (patch)
treee9480fd0f47be894769a2999e03d80d0eac033eb /drivers/power
parent6c47a3e00c6e4f3cdac7566c1480de34d9e32e07 (diff)
bq27x00_battery: Fixup nominal available capacity reporting
We should not not report nominal available capacity if battery is not calibrated, as we don't want to represent bogus values in the sysfs and confuse userland. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/bq27x00_battery.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 5860d4dfbe9..41b3328ecfc 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -230,6 +230,14 @@ static int bq27x00_battery_read_charge(struct bq27x00_device_info *di, u8 reg)
230 */ 230 */
231static inline int bq27x00_battery_read_nac(struct bq27x00_device_info *di) 231static inline int bq27x00_battery_read_nac(struct bq27x00_device_info *di)
232{ 232{
233 int flags;
234 bool is_bq27500 = di->chip == BQ27500;
235 bool is_higher = bq27xxx_is_chip_version_higher(di);
236
237 flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500);
238 if (flags >= 0 && !is_higher && (flags & BQ27000_FLAG_CI))
239 return -ENODATA;
240
233 return bq27x00_battery_read_charge(di, BQ27x00_REG_NAC); 241 return bq27x00_battery_read_charge(di, BQ27x00_REG_NAC);
234} 242}
235 243