power: max17042: Report full status only when charger plugged
Darbha Sriharsha [Tue, 3 Sep 2013 07:04:14 +0000 (12:04 +0530)]
The battery gauge should report "100% Full" status only when the
battery is charged to full capacity and the charger is still
connected. When the battery is fully charged but the charger
cable is unplugged, we should report "100% Not Charging" as the
status

Bug 1358884

Change-Id: Ibfc7d30fdaab8c37fc99ccb5032719807780709a
Signed-off-by: Darbha Sriharsha <dsriharsha@nvidia.com>
Reviewed-on: http://git-master/r/269379
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/power/max17042_battery.c

index a203485..20cacb8 100644 (file)
@@ -338,7 +338,8 @@ static int max17042_get_property(struct power_supply *psy,
                        val->intval = POWER_SUPPLY_STATUS_CHARGING;
                else
                        val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
-               if (chip->cap >= 100)
+               if (chip->cap >= 100
+                       && chip->status == POWER_SUPPLY_STATUS_CHARGING)
                        val->intval = POWER_SUPPLY_STATUS_FULL;
                break;
        default: