Loading drivers/power/qpnp-bms.c +15 −2 Original line number Diff line number Diff line /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -768,7 +768,20 @@ static int get_battery_status(struct qpnp_bms_chip *chip) static bool is_battery_charging(struct qpnp_bms_chip *chip) { return get_battery_status(chip) == POWER_SUPPLY_STATUS_CHARGING; union power_supply_propval ret = {0,}; if (chip->batt_psy == NULL) chip->batt_psy = power_supply_get_by_name("battery"); if (chip->batt_psy) { /* if battery has been registered, use the status property */ chip->batt_psy->get_property(chip->batt_psy, POWER_SUPPLY_PROP_CHARGE_TYPE, &ret); return ret.intval != POWER_SUPPLY_CHARGE_TYPE_NONE; } /* Default to false if the battery power supply is not registered. */ pr_debug("battery power supply is not registered\n"); return false; } static bool is_battery_full(struct qpnp_bms_chip *chip) Loading drivers/power/qpnp-charger.c +25 −1 Original line number Diff line number Diff line Loading @@ -2007,6 +2007,24 @@ get_prop_charge_type(struct qpnp_chg_chip *chip) return POWER_SUPPLY_CHARGE_TYPE_NONE; } #define DEFAULT_CAPACITY 50 static int get_batt_capacity(struct qpnp_chg_chip *chip) { union power_supply_propval ret = {0,}; if (chip->fake_battery_soc >= 0) return chip->fake_battery_soc; if (chip->use_default_batt_values || !get_prop_batt_present(chip)) return DEFAULT_CAPACITY; if (chip->bms_psy) { chip->bms_psy->get_property(chip->bms_psy, POWER_SUPPLY_PROP_CAPACITY, &ret); return ret.intval; } return DEFAULT_CAPACITY; } static int get_prop_batt_status(struct qpnp_chg_chip *chip) { Loading Loading @@ -2035,6 +2053,13 @@ get_prop_batt_status(struct qpnp_chg_chip *chip) if (chgr_sts & FAST_CHG_ON_IRQ && bat_if_sts & BAT_FET_ON_IRQ) return POWER_SUPPLY_STATUS_CHARGING; /* report full if state of charge is 100 and a charger is connected */ if ((qpnp_chg_is_usb_chg_plugged_in(chip) || qpnp_chg_is_dc_chg_plugged_in(chip)) && get_batt_capacity(chip) == 100) { return POWER_SUPPLY_STATUS_FULL; } return POWER_SUPPLY_STATUS_DISCHARGING; } Loading Loading @@ -2086,7 +2111,6 @@ get_prop_charge_full(struct qpnp_chg_chip *chip) return 0; } #define DEFAULT_CAPACITY 50 static int get_prop_capacity(struct qpnp_chg_chip *chip) { Loading Loading
drivers/power/qpnp-bms.c +15 −2 Original line number Diff line number Diff line /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -768,7 +768,20 @@ static int get_battery_status(struct qpnp_bms_chip *chip) static bool is_battery_charging(struct qpnp_bms_chip *chip) { return get_battery_status(chip) == POWER_SUPPLY_STATUS_CHARGING; union power_supply_propval ret = {0,}; if (chip->batt_psy == NULL) chip->batt_psy = power_supply_get_by_name("battery"); if (chip->batt_psy) { /* if battery has been registered, use the status property */ chip->batt_psy->get_property(chip->batt_psy, POWER_SUPPLY_PROP_CHARGE_TYPE, &ret); return ret.intval != POWER_SUPPLY_CHARGE_TYPE_NONE; } /* Default to false if the battery power supply is not registered. */ pr_debug("battery power supply is not registered\n"); return false; } static bool is_battery_full(struct qpnp_bms_chip *chip) Loading
drivers/power/qpnp-charger.c +25 −1 Original line number Diff line number Diff line Loading @@ -2007,6 +2007,24 @@ get_prop_charge_type(struct qpnp_chg_chip *chip) return POWER_SUPPLY_CHARGE_TYPE_NONE; } #define DEFAULT_CAPACITY 50 static int get_batt_capacity(struct qpnp_chg_chip *chip) { union power_supply_propval ret = {0,}; if (chip->fake_battery_soc >= 0) return chip->fake_battery_soc; if (chip->use_default_batt_values || !get_prop_batt_present(chip)) return DEFAULT_CAPACITY; if (chip->bms_psy) { chip->bms_psy->get_property(chip->bms_psy, POWER_SUPPLY_PROP_CAPACITY, &ret); return ret.intval; } return DEFAULT_CAPACITY; } static int get_prop_batt_status(struct qpnp_chg_chip *chip) { Loading Loading @@ -2035,6 +2053,13 @@ get_prop_batt_status(struct qpnp_chg_chip *chip) if (chgr_sts & FAST_CHG_ON_IRQ && bat_if_sts & BAT_FET_ON_IRQ) return POWER_SUPPLY_STATUS_CHARGING; /* report full if state of charge is 100 and a charger is connected */ if ((qpnp_chg_is_usb_chg_plugged_in(chip) || qpnp_chg_is_dc_chg_plugged_in(chip)) && get_batt_capacity(chip) == 100) { return POWER_SUPPLY_STATUS_FULL; } return POWER_SUPPLY_STATUS_DISCHARGING; } Loading Loading @@ -2086,7 +2111,6 @@ get_prop_charge_full(struct qpnp_chg_chip *chip) return 0; } #define DEFAULT_CAPACITY 50 static int get_prop_capacity(struct qpnp_chg_chip *chip) { Loading