Commit 22fadd766b2a222b273df9f2264b72e4b3bbe921

Authored by Sascha Silbe
Committed by Anton Vorontsov
1 parent 20fd9830cc

olpc_battery: Add support for CURRENT_NOW and VOLTAGE_NOW

{CURRENT,VOLTAGE}_AVG are actually {CURRENT,VOLTAGE}_NOW (the EC code
directly passes through the value from the gas gauge instead of the
internally used average). We retain {CURRENT,VOLTAGE}_AVG as an alias
for compatibility reasons, it will be removed later.

Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
[ pgf@laptop.org: added VOLTAGE_NOW, aliased to VOLTAGE_AVG ]
Signed-off-by: Paul Fox <pgf@laptop.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>

Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff

drivers/power/olpc_battery.c
... ... @@ -333,6 +333,7 @@
333 333 return ret;
334 334 break;
335 335 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
  336 + case POWER_SUPPLY_PROP_VOLTAGE_NOW:
336 337 ret = olpc_ec_cmd(EC_BAT_VOLTAGE, NULL, 0, (void *)&ec_word, 2);
337 338 if (ret)
338 339 return ret;
... ... @@ -340,6 +341,7 @@
340 341 val->intval = (s16)be16_to_cpu(ec_word) * 9760L / 32;
341 342 break;
342 343 case POWER_SUPPLY_PROP_CURRENT_AVG:
  344 + case POWER_SUPPLY_PROP_CURRENT_NOW:
343 345 ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2);
344 346 if (ret)
345 347 return ret;
346 348  
... ... @@ -414,7 +416,9 @@
414 416 POWER_SUPPLY_PROP_HEALTH,
415 417 POWER_SUPPLY_PROP_TECHNOLOGY,
416 418 POWER_SUPPLY_PROP_VOLTAGE_AVG,
  419 + POWER_SUPPLY_PROP_VOLTAGE_NOW,
417 420 POWER_SUPPLY_PROP_CURRENT_AVG,
  421 + POWER_SUPPLY_PROP_CURRENT_NOW,
418 422 POWER_SUPPLY_PROP_CAPACITY,
419 423 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
420 424 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,