Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156116
b: refs/heads/master
c: 8f7e579
h: refs/heads/master
v: v3
  • Loading branch information
Andres Salomon authored and Anton Vorontsov committed Jun 30, 2009
1 parent 555583c commit 76a2acd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 04a820ead0838c76e9c1242feb5e71048bf3e9dc
refs/heads/master: 8f7e57985fa794ab6afdcd3642581d9e1fe6de31
9 changes: 6 additions & 3 deletions trunk/drivers/power/olpc_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define BAT_STAT_AC 0x10
#define BAT_STAT_CHARGING 0x20
#define BAT_STAT_DISCHARGING 0x40
#define BAT_STAT_TRICKLE 0x80

#define BAT_ERR_INFOFAIL 0x02
#define BAT_ERR_OVERVOLTAGE 0x04
Expand Down Expand Up @@ -90,7 +91,7 @@ static char bat_serial[17]; /* Ick */
static int olpc_bat_get_status(union power_supply_propval *val, uint8_t ec_byte)
{
if (olpc_platform_info.ecver > 0x44) {
if (ec_byte & BAT_STAT_CHARGING)
if (ec_byte & (BAT_STAT_CHARGING | BAT_STAT_TRICKLE))
val->intval = POWER_SUPPLY_STATUS_CHARGING;
else if (ec_byte & BAT_STAT_DISCHARGING)
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
Expand Down Expand Up @@ -220,7 +221,8 @@ static int olpc_bat_get_property(struct power_supply *psy,
It doesn't matter though -- the EC will return the last-known
information, and it's as if we just ran that _little_ bit faster
and managed to read it out before the battery went away. */
if (!(ec_byte & BAT_STAT_PRESENT) && psp != POWER_SUPPLY_PROP_PRESENT)
if (!(ec_byte & (BAT_STAT_PRESENT | BAT_STAT_TRICKLE)) &&
psp != POWER_SUPPLY_PROP_PRESENT)
return -ENODEV;

switch (psp) {
Expand All @@ -230,7 +232,8 @@ static int olpc_bat_get_property(struct power_supply *psy,
return ret;
break;
case POWER_SUPPLY_PROP_PRESENT:
val->intval = !!(ec_byte & BAT_STAT_PRESENT);
val->intval = !!(ec_byte & (BAT_STAT_PRESENT |
BAT_STAT_TRICKLE));
break;

case POWER_SUPPLY_PROP_HEALTH:
Expand Down

0 comments on commit 76a2acd

Please sign in to comment.