power: ds2781: Report charging correctly
authorGreg Meiste <w30289@motorola.com>
Tue, 7 Sep 2010 16:24:08 +0000 (11:24 -0500)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:51:08 +0000 (16:51 -0700)
Previously, charging was being reporting whenever a charger was present.
While true most of the time, there are cases where that won't be the
case.  This patch updates the driver to only report charging if charging
is actually occurring.

Change-Id: Ibc5881fed5d11f89d87d0c7adcd7ac1c2b273688
Signed-off-by: Greg Meiste <w30289@motorola.com>
drivers/power/ds2781_battery.c

index 6803eb482e2a0eaa72c622709625ce432c1e86f7..2548d9fc83ca410485464afefc9ee62a1087557d 100644 (file)
@@ -37,6 +37,7 @@
 #include "../w1/w1.h"
 #include "../w1/slaves/w1_ds2781.h"
 
+extern int is_ac_charging(void);
 extern int is_ac_charge_complete(void);
 
 struct battery_status {
@@ -248,7 +249,7 @@ static int battery_get_property(struct power_supply *psy,
 
        switch (psp) {
        case POWER_SUPPLY_PROP_STATUS:
-               if (di->status.charge_source) {
+               if (is_ac_charging()) {
                        if ((di->status.battery_full) ||
                            (di->status.percentage >= 100))
                                val->intval = POWER_SUPPLY_STATUS_FULL;