Commit 6e0e60cd authored by MyungJoo Ham's avatar MyungJoo Ham Committed by Anton Vorontsov

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: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarAnton Vorontsov <anton.vorontsov@linaro.org>
parent 3124c4a0
......@@ -179,14 +179,11 @@ static int max17042_get_property(struct power_supply *psy,
val->intval = ret >> 8;
break;
case POWER_SUPPLY_PROP_CHARGE_FULL:
ret = max17042_read_reg(chip->client, MAX17042_RepSOC);
ret = max17042_read_reg(chip->client, MAX17042_FullCAP);
if (ret < 0)
return ret;
if ((ret >> 8) >= MAX17042_BATTERY_FULL)
val->intval = 1;
else if (ret >= 0)
val->intval = 0;
val->intval = ret * 1000 / 2;
break;
case POWER_SUPPLY_PROP_TEMP:
ret = max17042_read_reg(chip->client, MAX17042_TEMP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment