aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGrazvydas Ignotas <notasas@gmail.com>2012-01-14 15:50:49 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2012-02-01 12:27:28 -0500
commit4d4036591b3de279a8c93a3cb010b0bc1264703c (patch)
tree2ae895a48407219e41332f93bf8e5949ce9440c9 /drivers
parentb7aaacf56ac9e0cdb58c3d087fea7084d897c307 (diff)
bq27x00_battery: Fix flag register read
When reading flags, bq27x00_read() argument is inverted and causes reads 2 of bytes for bq27200 and 1 byte for bq27500, while their register sizes are 1 and 2 bytes respectively. This causes bq27500 upper flag bits always to be returned as 0, causing full charge state to never be reported correctly, so fix it. Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/bq27x00_battery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index d4b5281dea15..1ed6ea0bad6e 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -311,7 +311,7 @@ static void bq27x00_update(struct bq27x00_device_info *di)
311 struct bq27x00_reg_cache cache = {0, }; 311 struct bq27x00_reg_cache cache = {0, };
312 bool is_bq27500 = di->chip == BQ27500; 312 bool is_bq27500 = di->chip == BQ27500;
313 313
314 cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500); 314 cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500);
315 if (cache.flags >= 0) { 315 if (cache.flags >= 0) {
316 if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) { 316 if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) {
317 dev_info(di->dev, "battery is not calibrated! ignoring capacity values\n"); 317 dev_info(di->dev, "battery is not calibrated! ignoring capacity values\n");