Skip to contentSkip to conversation

spitz: better voltage-to-percentage conversion

PATCH In review Pavel Machek 3 participants 4 messages Nov 27, 2009 – Nov 29, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spitz: better voltage-to-percentage conversion

Old code has two huge tables... unfortunately those tables are simple linear relationships and wrong: li-ions do not behave like that.

Convert physical values to mV,mA,mOhm, add computation that makes sense for physical point of view, and provide tables based on measurements.

To get even better results, we should provide better battery_current estimate (taking backlight into account), and adjust adjust battery_resistance according to its age and temperature.

arch/arm/mach-pxa/corgi_pm.c +0 -1
@@ -215,7 +215,6 @@
 	.fatal_noacin_volt= SHARPSL_FATAL_NOACIN_VOLT,
 	.bat_levels       = 40,
 	.bat_levels_noac  = sharpsl_battery_levels_noac,
-	.bat_levels_acin  = sharpsl_battery_levels_acin,
 	.status_high_acin = 188,
 	.status_low_acin  = 178,
 	.status_high_noac = 185,
arch/arm/mach-pxa/sharpsl_pm.c +71 -88

177 lines not on this page · raw message

arch/arm/mach-pxa/spitz_pm.c +0 -1
@@ -209,7 +209,6 @@
 	.fatal_noacin_volt= SHARPSL_FATAL_NOACIN_VOLT,
 	.bat_levels       = 40,
 	.bat_levels_noac  = sharpsl_battery_levels_noac,
-	.bat_levels_acin  = sharpsl_battery_levels_acin,
 	.status_high_acin = 188,
 	.status_low_acin  = 178,
 	.status_high_noac = 185,
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Pavel Machek a ?crit :

Quoted 16 lines

Old code has two huge tables... unfortunately those tables are simple linear relationships and wrong: li-ions do not behave like that.

Convert physical values to mV,mA,mOhm, add computation that makes sense for physical point of view, and provide tables based on measurements.

To get even better results, we should provide better battery_current estimate (taking backlight into account), and adjust adjust battery_resistance according to its age and temperature.

--- a/arch/arm/mach-pxa/corgi_pm.c 2009-11-23 20:48:26.000000000 +0100

arch/arm/mach-pxa/sharpsl_pm.c line 135

Quoted 3 lines
arch/arm/mach-pxa/sharpsl_pm.c +3 -0
+typedef int miliamp_t;
+typedef int miliohm_t;
+typedef int milivolt_t;

milliamp, milliohm, millivolt ?

#2 lore raw
In reply to Pavel Machek

arch/arm/mach-pxa/sharpsl_pm.c line 135

Quoted 4 lines · Pavel Machek
arch/arm/mach-pxa/sharpsl_pm.c +4 -0
+
+typedef int miliamp_t;
+typedef int miliohm_t;
+typedef int milivolt_t;

'milliamp' 'milliohm' 'millivolt'

#3 lore raw

Hi!

Quoted 6 lines

arch/arm/mach-pxa/sharpsl_pm.c line 135

Quoted 4 lines
arch/arm/mach-pxa/sharpsl_pm.c +4 -0
+
+typedef int miliamp_t;
+typedef int miliohm_t;
+typedef int milivolt_t;

'milliamp' 'milliohm' 'millivolt'

Thanks, updated patch follows.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html