Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242576
b: refs/heads/master
c: a2e5118
h: refs/heads/master
v: v3
  • Loading branch information
Pali Rohár authored and Lars-Peter Clausen committed Feb 22, 2011
1 parent 9397d4b commit 4e06ff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0e9f30497e88600ba52013665270f543bb94f0d8
refs/heads/master: a2e5118c370e78c3841606e7edc7677c986325fa
7 changes: 5 additions & 2 deletions trunk/drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#define BQ27500_FLAG_DSC BIT(0)
#define BQ27500_FLAG_FC BIT(9)

#define BQ27000_RS 20 /* Resistor sense */

/* If the system has several batteries we need a different name for each
* of them...
*/
Expand Down Expand Up @@ -149,7 +151,7 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di)

if (di->chip == BQ27500) {
/* bq27500 returns signed value */
curr = (int)(s16)curr;
curr = (int)((s16)curr) * 1000;
} else {
ret = bq27x00_read(BQ27x00_REG_FLAGS, &flags, 0, di);
if (ret < 0) {
Expand All @@ -160,9 +162,10 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di)
dev_dbg(di->dev, "negative current!\n");
curr = -curr;
}
curr = curr * 3570 / BQ27000_RS;
}

return curr * 1000;
return curr;
}

/*
Expand Down

0 comments on commit 4e06ff2

Please sign in to comment.