[PATCH 3/3] olpc-battery: add support for CURRENT_NOW

Sascha Silbe sascha-pgp at silbe.org
Sat May 1 14:35:45 EDT 2010


CURRENT_AVG is actually CURRENT_NOW (the EC code directly passes through
the value from the gas gauge instead of the internally used average).
We retain CURRENT_AVG as an alias for compatibility reasons, it will be
removed later.

This change allows an unpatched UPower (0.9.2) to calculate TimeToEmpty
and TimeToFull.

Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
---
 drivers/power/olpc_battery.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index a49e548..ce0d316 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -339,6 +339,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
 		val->intval = (int)((s16)be16_to_cpu(ec_word)) * 9760L / 32;
 		break;
 	case POWER_SUPPLY_PROP_CURRENT_AVG:
+	case POWER_SUPPLY_PROP_CURRENT_NOW:
 		ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2);
 		if (ret)
 			return ret;
@@ -416,6 +417,7 @@ static enum power_supply_property olpc_bat_props[] = {
 	POWER_SUPPLY_PROP_TECHNOLOGY,
 	POWER_SUPPLY_PROP_VOLTAGE_AVG,
 	POWER_SUPPLY_PROP_CURRENT_AVG,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
 	POWER_SUPPLY_PROP_CAPACITY,
 	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
 	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
-- 
1.6.5




More information about the Devel mailing list