From 7210624955249fb4fb936b2ca18ee9bab670fdeb Mon Sep 17 00:00:00 2001 From: Abhijeet Dharmapurikar Date: Thu, 15 Dec 2016 16:55:32 -0800 Subject: smb-lib: report FULL regardless of charger presence For a full battery, the driver currently reports battery full only when the charger is online and switches back to reporting discharging when charger is removed. This is incorrect because a user might reinsert the charger seeing discharging status right after he removes it only to realize that the battery is full after he plugs it back. So allow the full status to be reported even when no charger is online. Change-Id: I0c31e2fbe984420a6754e923cfc3abe77bc54991 Signed-off-by: Abhijeet Dharmapurikar --- drivers/power/qcom-charger/smb-lib.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/power/qcom-charger/smb-lib.c b/drivers/power/qcom-charger/smb-lib.c index 507704dd469a..f7dcd1eef2d0 100644 --- a/drivers/power/qcom-charger/smb-lib.c +++ b/drivers/power/qcom-charger/smb-lib.c @@ -1155,32 +1155,9 @@ int smblib_get_prop_batt_capacity(struct smb_charger *chg, int smblib_get_prop_batt_status(struct smb_charger *chg, union power_supply_propval *val) { - union power_supply_propval pval = {0, }; - bool usb_online, dc_online; u8 stat; int rc; - rc = smblib_get_prop_usb_online(chg, &pval); - if (rc < 0) { - smblib_err(chg, "Couldn't get usb online property rc=%d\n", - rc); - return rc; - } - usb_online = (bool)pval.intval; - - rc = smblib_get_prop_dc_online(chg, &pval); - if (rc < 0) { - smblib_err(chg, "Couldn't get dc online property rc=%d\n", - rc); - return rc; - } - dc_online = (bool)pval.intval; - - if (!usb_online && !dc_online) { - val->intval = POWER_SUPPLY_STATUS_DISCHARGING; - return rc; - } - rc = smblib_read(chg, BATTERY_CHARGER_STATUS_1_REG, &stat); if (rc < 0) { smblib_err(chg, "Couldn't read BATTERY_CHARGER_STATUS_1 rc=%d\n", -- cgit v1.2.3