diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2012-03-13 22:00:01 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-03-26 12:41:25 -0400 |
commit | 6e0e60cd0d688d0d1af85ef2abb8e363595af988 (patch) | |
tree | 0c18bb3f9bd7a80e0fc532b3d9b3093e0c386297 /drivers/power | |
parent | 3124c4a080f9263abb667a827d30c9e81c9e5a21 (diff) |
max17042_battery: Fix CHARGE_FULL representation.
CHARGE_FULL should represent the full capacity of the battery in uAh.
The 0x10 (FullCAP) register shows the compensated full capacity in
mAh * 2; e.g., reg(0x10) = 0xBB8 means that it is 1500mAh.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/max17042_battery.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c index 5474e76d36fb..d576912b1219 100644 --- a/drivers/power/max17042_battery.c +++ b/drivers/power/max17042_battery.c | |||
@@ -179,14 +179,11 @@ static int max17042_get_property(struct power_supply *psy, | |||
179 | val->intval = ret >> 8; | 179 | val->intval = ret >> 8; |
180 | break; | 180 | break; |
181 | case POWER_SUPPLY_PROP_CHARGE_FULL: | 181 | case POWER_SUPPLY_PROP_CHARGE_FULL: |
182 | ret = max17042_read_reg(chip->client, MAX17042_RepSOC); | 182 | ret = max17042_read_reg(chip->client, MAX17042_FullCAP); |
183 | if (ret < 0) | 183 | if (ret < 0) |
184 | return ret; | 184 | return ret; |
185 | 185 | ||
186 | if ((ret >> 8) >= MAX17042_BATTERY_FULL) | 186 | val->intval = ret * 1000 / 2; |
187 | val->intval = 1; | ||
188 | else if (ret >= 0) | ||
189 | val->intval = 0; | ||
190 | break; | 187 | break; |
191 | case POWER_SUPPLY_PROP_TEMP: | 188 | case POWER_SUPPLY_PROP_TEMP: |
192 | ret = max17042_read_reg(chip->client, MAX17042_TEMP); | 189 | ret = max17042_read_reg(chip->client, MAX17042_TEMP); |