Commit cf7a8c03 authored by MyungJoo Ham's avatar MyungJoo Ham Committed by Anton Vorontsov

max17042_battery: Bugfix of incorrect voltage register value interpretation

The calculation had error in getting voltage values from
MAX17042 registers. The least bit denotes 78.125uV (625/8).
Signed-off-by: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarPhilip Rakity <prakity@marvell.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
parent 91d8b0d6
...@@ -111,12 +111,12 @@ static int max17042_get_property(struct power_supply *psy, ...@@ -111,12 +111,12 @@ static int max17042_get_property(struct power_supply *psy,
val->intval *= 10000; /* Units of LSB = 10mV */ val->intval *= 10000; /* Units of LSB = 10mV */
break; break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW: case POWER_SUPPLY_PROP_VOLTAGE_NOW:
val->intval = max17042_read_reg(chip->client, val->intval = max17042_read_reg(chip->client, MAX17042_VCELL)
MAX17042_VCELL) * 83; /* 1000 / 12 = 83 */ * 625 / 8;
break; break;
case POWER_SUPPLY_PROP_VOLTAGE_AVG: case POWER_SUPPLY_PROP_VOLTAGE_AVG:
val->intval = max17042_read_reg(chip->client, val->intval = max17042_read_reg(chip->client, MAX17042_AvgVCELL)
MAX17042_AvgVCELL) * 83; * 625 / 8;
break; break;
case POWER_SUPPLY_PROP_CAPACITY: case POWER_SUPPLY_PROP_CAPACITY:
val->intval = max17042_read_reg(chip->client, val->intval = max17042_read_reg(chip->client,
......
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