aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/power/olpc_battery.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index 9c216dd41550..58e419299cd6 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -36,6 +36,7 @@
36#define BAT_STAT_AC 0x10 36#define BAT_STAT_AC 0x10
37#define BAT_STAT_CHARGING 0x20 37#define BAT_STAT_CHARGING 0x20
38#define BAT_STAT_DISCHARGING 0x40 38#define BAT_STAT_DISCHARGING 0x40
39#define BAT_STAT_TRICKLE 0x80
39 40
40#define BAT_ERR_INFOFAIL 0x02 41#define BAT_ERR_INFOFAIL 0x02
41#define BAT_ERR_OVERVOLTAGE 0x04 42#define BAT_ERR_OVERVOLTAGE 0x04
@@ -90,7 +91,7 @@ static char bat_serial[17]; /* Ick */
90static int olpc_bat_get_status(union power_supply_propval *val, uint8_t ec_byte) 91static int olpc_bat_get_status(union power_supply_propval *val, uint8_t ec_byte)
91{ 92{
92 if (olpc_platform_info.ecver > 0x44) { 93 if (olpc_platform_info.ecver > 0x44) {
93 if (ec_byte & BAT_STAT_CHARGING) 94 if (ec_byte & (BAT_STAT_CHARGING | BAT_STAT_TRICKLE))
94 val->intval = POWER_SUPPLY_STATUS_CHARGING; 95 val->intval = POWER_SUPPLY_STATUS_CHARGING;
95 else if (ec_byte & BAT_STAT_DISCHARGING) 96 else if (ec_byte & BAT_STAT_DISCHARGING)
96 val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 97 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
@@ -220,7 +221,8 @@ static int olpc_bat_get_property(struct power_supply *psy,
220 It doesn't matter though -- the EC will return the last-known 221 It doesn't matter though -- the EC will return the last-known
221 information, and it's as if we just ran that _little_ bit faster 222 information, and it's as if we just ran that _little_ bit faster
222 and managed to read it out before the battery went away. */ 223 and managed to read it out before the battery went away. */
223 if (!(ec_byte & BAT_STAT_PRESENT) && psp != POWER_SUPPLY_PROP_PRESENT) 224 if (!(ec_byte & (BAT_STAT_PRESENT | BAT_STAT_TRICKLE)) &&
225 psp != POWER_SUPPLY_PROP_PRESENT)
224 return -ENODEV; 226 return -ENODEV;
225 227
226 switch (psp) { 228 switch (psp) {
@@ -230,7 +232,8 @@ static int olpc_bat_get_property(struct power_supply *psy,
230 return ret; 232 return ret;
231 break; 233 break;
232 case POWER_SUPPLY_PROP_PRESENT: 234 case POWER_SUPPLY_PROP_PRESENT:
233 val->intval = !!(ec_byte & BAT_STAT_PRESENT); 235 val->intval = !!(ec_byte & (BAT_STAT_PRESENT |
236 BAT_STAT_TRICKLE));
234 break; 237 break;
235 238
236 case POWER_SUPPLY_PROP_HEALTH: 239 case POWER_SUPPLY_PROP_HEALTH: