All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: max17042: bugfix of incorrect voltage register value interpretation.
@ 2011-08-17  1:18 MyungJoo Ham
  2011-08-19 16:51 ` Anton Vorontsov
  0 siblings, 1 reply; 2+ messages in thread
From: MyungJoo Ham @ 2011-08-17  1:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Anton Vorontsov, Philip Rakity, Kyungmin Park, Wolfram Sang,
	myungjoo.ham, dg77.kim

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>
---
 drivers/power/max17042_battery.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index 61fb6d7..a6dc9c7 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,
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] power: max17042: bugfix of incorrect voltage register value interpretation.
  2011-08-17  1:18 [PATCH] power: max17042: bugfix of incorrect voltage register value interpretation MyungJoo Ham
@ 2011-08-19 16:51 ` Anton Vorontsov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2011-08-19 16:51 UTC (permalink / raw)
  To: MyungJoo Ham
  Cc: linux-kernel, Philip Rakity, Kyungmin Park, Wolfram Sang,
	myungjoo.ham, dg77.kim

On Wed, Aug 17, 2011 at 10:18:34AM +0900, MyungJoo Ham wrote:
> 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>
> ---

Applied, thank you.

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-19 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-17  1:18 [PATCH] power: max17042: bugfix of incorrect voltage register value interpretation MyungJoo Ham
2011-08-19 16:51 ` Anton Vorontsov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.