[PATCH] GTA01: fix current and voltage reporting units

Paul Fertser fercerpav at gmail.com
Sun Jul 5 20:53:25 CEST 2009


According to power_supply class specification all voltages and currents
must be reported in uV and uA respectively.

Signed-off-by: Paul Fertser <fercerpav at gmail.com>
---
 arch/arm/mach-s3c2410/mach-gta01.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
index 1fe3eef..1021ff5 100644
--- a/arch/arm/mach-s3c2410/mach-gta01.c
+++ b/arch/arm/mach-s3c2410/mach-gta01.c
@@ -237,7 +237,7 @@ static int gta01_bat_get_voltage(void)
 	adc = pcf50606_adc_sync_read(pcf, PCF50606_ADCMUX_BATVOLT_RES);
 	mv = (adc * 6000) / 1024;
 	
-	return mv;
+	return mv * 1000;
 }
 
 static int gta01_bat_get_current(void)
@@ -251,7 +251,7 @@ static int gta01_bat_get_current(void)
 	res = (adc_adcin1 - adc_battvolt) * 2400;
 
 	/*rsense is 220 milli */
-	return (res * 1000) / (220 * 1024);
+	return (res * 1000) / (220 * 1024) * 1000;
 }
 
 static struct gta01_bat_platform_data gta01_bat_pdata = {
-- 
1.6.0.6




More information about the openmoko-kernel mailing list