[<prev] [next>] [day] [month] [year] [list]
Message-ID: <D8CE7665-74C6-4717-B377-EE17D3DA5F91@marvell.com>
Date: Fri, 12 Aug 2011 21:19:57 -0700
From: Philip Rakity <prakity@...vell.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Anton Vorontsov <cbouatmailru@...il.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
"myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>
Subject: [PATCH] power: max17042: do not lose accuracy calculating
current_now
PROP_CURRENT_NOW value is first divided then multiplied up
causing a lose of accuracy. Use the same method as
PROP_CURRENT_AVG to do the calculation.
Signed-off-by: Philip Rakity <prakity@...vell.com>
---
drivers/power/max17042_battery.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index 4245806..7b7762a 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -153,8 +153,7 @@ static int max17042_get_property(struct power_supply *psy,
val->intval++;
val->intval *= -1;
}
- val->intval >>= 4;
- val->intval *= 1000000 * 25 / chip->pdata->r_sns;
+ val->intval *= 1562500 / chip->pdata->r_sns;
} else {
return -EINVAL;
}
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists