mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] power_supply: bq27x00: fix voltage and current units
@ 2010-02-27 15:06 Grazvydas Ignotas
  2010-02-27 15:12 ` Anton Vorontsov
  0 siblings, 1 reply; 2+ messages in thread
From: Grazvydas Ignotas @ 2010-02-27 15:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: Anton Vorontsov, David Woodhouse, Rodolfo Giometti, Grazvydas Ignotas

The chip returns voltage and current in mV and mA, but
power supply class uses uV and uA, so add missing conversion.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 drivers/power/bq27x00_battery.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 5d940fa..bece33e 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -125,7 +125,7 @@ static int bq27x00_battery_voltage(struct bq27x00_device_info *di)
 		return ret;
 	}
 
-	return volt;
+	return volt * 1000;
 }
 
 /*
@@ -156,11 +156,11 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di)
 		}
 		if (flags & BQ27000_FLAG_CHGS) {
 			dev_dbg(di->dev, "negative current!\n");
-			return -curr;
+			curr = -curr;
 		}
 	}
 
-	return curr;
+	return curr * 1000;
 }
 
 /*
-- 
1.6.3.3


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

end of thread, other threads:[~2010-02-27 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-27 15:06 [PATCH 2/2] power_supply: bq27x00: fix voltage and current units Grazvydas Ignotas
2010-02-27 15:12 ` Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®