[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1327425968-21195-5-git-send-email-dirk.brandewie@gmail.com>
Date: Tue, 24 Jan 2012 09:26:07 -0800
From: dirk.brandewie@...il.com
To: linux-kernel@...r.kernel.org
Cc: cbouatmailru@...il.com, dg77.kim@...sung.com,
kyungmin.park@...sung.com, myungjoo.ham@...sung.com,
Jason.Wortham@...im-ic.com, bruce.e.robertson@...el.com,
Dirk Brandewie <dirk.brandewie@...il.com>
Subject: [PATCH 4/5] max17042: Fix value scaling for VCELL and avgVCELL
From: Bruce Robertson <bruce.e.robertson@...el.com>
The bottom three bits of the register are don't care bits. The LSB
value is 625 uV. Adjust the returned values appropriately
Signed-off-by: Bruce Robertson <bruce.e.robertson@...el.com>
Signed-off-by: Dirk Brandewie <dirk.brandewie@...il.com>
Acked-by: MyungJoo Ham <myungjoo.ham@...sung.com>
---
drivers/power/max17042_battery.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index e0a4430..6e96b58 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -148,11 +148,15 @@ static int max17042_get_property(struct power_supply *psy,
break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
val->intval = max17042_read_reg(chip->client,
- MAX17042_VCELL) * 83; /* 1000 / 12 = 83 */
+ MAX17042_VCELL);
+ val->intval >>= 3;
+ val->intval *= 625; /* Units of LSB = 625 uV */
break;
case POWER_SUPPLY_PROP_VOLTAGE_AVG:
val->intval = max17042_read_reg(chip->client,
- MAX17042_AvgVCELL) * 83;
+ MAX17042_AvgVCELL);
+ val->intval >>= 3;
+ val->intval *= 625; /* Units of LSB = 625 uV */
break;
case POWER_SUPPLY_PROP_CAPACITY:
val->intval = max17042_read_reg(chip->client,
--
1.7.7.5
--
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