From: Greg Meiste Date: Tue, 7 Sep 2010 16:24:08 +0000 (-0500) Subject: power: ds2781: Report charging correctly X-Git-Tag: firefly_0821_release~9834^2~582 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c4f99cbeb9e1b34dbdd67cf102e62ade2d8cb7fa;p=firefly-linux-kernel-4.4.55.git power: ds2781: Report charging correctly 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 --- diff --git a/drivers/power/ds2781_battery.c b/drivers/power/ds2781_battery.c index 6803eb482e2a..2548d9fc83ca 100644 --- a/drivers/power/ds2781_battery.c +++ b/drivers/power/ds2781_battery.c @@ -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;