aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/max17042_battery.c
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2011-08-17 10:18:34 +0900
committerAnton Vorontsov <cbouatmailru@gmail.com>2011-08-19 21:03:35 +0400
commitcf7a8c03db792894f436db5f3ffc44d947b9b068 (patch)
tree182005726b4a00b42e0e574673c89598c6f8241a /drivers/power/max17042_battery.c
parentmax17042_battery: Do not lose accuracy calculating current_now (diff)
downloadlinux-dev-cf7a8c03db792894f436db5f3ffc44d947b9b068.tar.xz
linux-dev-cf7a8c03db792894f436db5f3ffc44d947b9b068.zip
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: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power/max17042_battery.c')
-rw-r--r--drivers/power/max17042_battery.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index 61fb6d7dfe7a..a6dc9c7a95e2 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -111,12 +111,12 @@ static int max17042_get_property(struct power_supply *psy,
val->intval *= 10000; /* Units of LSB = 10mV */
break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
- val->intval = max17042_read_reg(chip->client,
- MAX17042_VCELL) * 83; /* 1000 / 12 = 83 */
+ val->intval = max17042_read_reg(chip->client, MAX17042_VCELL)
+ * 625 / 8;
break;
case POWER_SUPPLY_PROP_VOLTAGE_AVG:
- val->intval = max17042_read_reg(chip->client,
- MAX17042_AvgVCELL) * 83;
+ val->intval = max17042_read_reg(chip->client, MAX17042_AvgVCELL)
+ * 625 / 8;
break;
case POWER_SUPPLY_PROP_CAPACITY:
val->intval = max17042_read_reg(chip->client,