diff options
author | Andres Salomon <dilinger@debian.org> | 2008-09-04 15:31:20 -0400 |
---|---|---|
committer | Andres Salomon <dilinger@debian.org> | 2008-09-04 15:31:20 -0400 |
commit | 7bd35a5e461731c283dfcb8d8b2ba2436a95405b (patch) | |
tree | 836a15c4f59fab72a35fb223d11494b34c219f40 | |
parent | 222f7583b4602355bf507280ff466a9c19090729 (diff) | |
download | lwn-7bd35a5e461731c283dfcb8d8b2ba2436a95405b.tar.gz lwn-7bd35a5e461731c283dfcb8d8b2ba2436a95405b.zip |
OLPC: power_supply: have status treat TRICKLE and CHARGING differently
Spit out either "Charging" or "Charging (trickle)" depending upon
whether or not TRICKLE is set.
Signed-off-by: Andres Salomon <dilinger@debian.org>
-rw-r--r-- | drivers/power/olpc_battery.c | 4 | ||||
-rw-r--r-- | drivers/power/power_supply_sysfs.c | 2 | ||||
-rw-r--r-- | include/linux/power_supply.h | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index c5e94f3c8d25..ca56832a3b13 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c @@ -90,8 +90,10 @@ 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|BAT_STAT_TRICKLE)) + if (ec_byte & BAT_STAT_CHARGING) val->intval = POWER_SUPPLY_STATUS_CHARGING; + else if (ec_byte & BAT_STAT_TRICKLE) + val->intval = POWER_SUPPLY_STATUS_TRICKLE_CHARGING; else if (ec_byte & (BAT_STAT_LOW|BAT_STAT_DISCHARGING)) val->intval = POWER_SUPPLY_STATUS_EMPTY; else if (ec_byte & BAT_STAT_DISCHARGING) diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index f4a935bedfe9..04822c17f99a 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -41,7 +41,7 @@ static ssize_t power_supply_show_property(struct device *dev, struct device_attribute *attr, char *buf) { static char *status_text[] = { - "Unknown", "Charging", "Discharging", + "Unknown", "Charging", "Charging (trickle)", "Discharging", "Empty", "Not charging", "Full" }; static char *health_text[] = { diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index a45864204b5c..0743ee5d3475 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -33,6 +33,7 @@ enum { POWER_SUPPLY_STATUS_UNKNOWN = 0, POWER_SUPPLY_STATUS_CHARGING, + POWER_SUPPLY_STATUS_TRICKLE_CHARGING, POWER_SUPPLY_STATUS_DISCHARGING, POWER_SUPPLY_STATUS_EMPTY, POWER_SUPPLY_STATUS_NOT_CHARGING, |