Loading drivers/power/supply/qcom/qpnp-fg-gen3.c +9 −0 Original line number Diff line number Diff line Loading @@ -936,6 +936,11 @@ static int fg_get_prop_capacity(struct fg_chip *chip, int *val) return 0; } static int fg_get_prop_real_capacity(struct fg_chip *chip, int *val) { return fg_get_msoc(chip, val); } #define DEFAULT_BATT_TYPE "Unknown Battery" #define MISSING_BATT_TYPE "Missing Battery" #define LOADING_BATT_TYPE "Loading Battery" Loading Loading @@ -4105,6 +4110,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CC_STEP_SEL: pval->intval = chip->ttf.cc_step.sel; break; case POWER_SUPPLY_PROP_REAL_CAPACITY: rc = fg_get_prop_real_capacity(chip, &pval->intval); break; default: pr_err("unsupported property %d\n", psp); rc = -EINVAL; Loading Loading @@ -4308,6 +4316,7 @@ static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, POWER_SUPPLY_PROP_CC_STEP, POWER_SUPPLY_PROP_CC_STEP_SEL, POWER_SUPPLY_PROP_REAL_CAPACITY, }; static const struct power_supply_desc fg_psy_desc = { Loading drivers/power/supply/qcom/qpnp-qg.c +13 −0 Original line number Diff line number Diff line Loading @@ -1547,6 +1547,15 @@ static int qg_get_battery_capacity(struct qpnp_qg *chip, int *soc) return 0; } static int qg_get_battery_capacity_real(struct qpnp_qg *chip, int *soc) { mutex_lock(&chip->soc_lock); *soc = chip->msoc; mutex_unlock(&chip->soc_lock); return 0; } static int qg_get_charge_counter(struct qpnp_qg *chip, int *charge_counter) { int rc, cc_soc = 0; Loading Loading @@ -1707,6 +1716,9 @@ static int qg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY: rc = qg_get_battery_capacity(chip, &pval->intval); break; case POWER_SUPPLY_PROP_REAL_CAPACITY: rc = qg_get_battery_capacity_real(chip, &pval->intval); break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: rc = qg_get_battery_voltage(chip, &pval->intval); break; Loading Loading @@ -1826,6 +1838,7 @@ static int qg_property_is_writeable(struct power_supply *psy, static enum power_supply_property qg_psy_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_REAL_CAPACITY, POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_OCV, Loading drivers/power/supply/qcom/smb5-lib.c +19 −2 Original line number Diff line number Diff line Loading @@ -2787,7 +2787,8 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) union power_supply_propval pval = {0, }; int rc = 0; rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CAPACITY, &pval); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); if (rc < 0) { smblib_err(chg, "Couldn't read SOC value, rc=%d\n", rc); return; Loading @@ -2801,6 +2802,8 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) * to prevent overcharing. */ if ((batt_status == TERMINATE_CHARGE) && (pval.intval == 100)) { chg->cc_soc_ref = 0; chg->last_cc_soc = 0; alarm_start_relative(&chg->chg_termination_alarm, ms_to_ktime(CHG_TERM_WA_ENTRY_DELAY_MS)); } else if (pval.intval < 100) { Loading @@ -2809,6 +2812,7 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) * we exit the TERMINATE_CHARGE state and soc drops below 100% */ chg->cc_soc_ref = 0; chg->last_cc_soc = 0; } } Loading Loading @@ -4160,7 +4164,8 @@ static void smblib_chg_termination_work(struct work_struct *work) if (rc < 0 || !pval.intval) goto out; rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CAPACITY, &pval); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); if (rc < 0 || (pval.intval < 100)) { vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); goto out; Loading Loading @@ -4192,6 +4197,18 @@ static void smblib_chg_termination_work(struct work_struct *work) goto out; } /* * In BSM a sudden jump in CC_SOC is not expected. If seen, its a * good_ocv or updated capacity, reject it. */ if (chg->last_cc_soc && pval.intval > (chg->last_cc_soc + 100)) { /* CC_SOC has increased by 1% from last time */ chg->cc_soc_ref = pval.intval; smblib_dbg(chg, PR_MISC, "cc_soc jumped(%d->%d), reset cc_soc_ref\n", chg->last_cc_soc, pval.intval); } chg->last_cc_soc = pval.intval; /* * Suspend/Unsuspend USB input to keep cc_soc within the 0.5% to 0.75% * overshoot range of the cc_soc value at termination, to prevent Loading drivers/power/supply/qcom/smb5-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,7 @@ struct smb_charger { bool fcc_stepper_enable; int charge_full_cc; int cc_soc_ref; int last_cc_soc; /* workaround flag */ u32 wa_flags; Loading Loading
drivers/power/supply/qcom/qpnp-fg-gen3.c +9 −0 Original line number Diff line number Diff line Loading @@ -936,6 +936,11 @@ static int fg_get_prop_capacity(struct fg_chip *chip, int *val) return 0; } static int fg_get_prop_real_capacity(struct fg_chip *chip, int *val) { return fg_get_msoc(chip, val); } #define DEFAULT_BATT_TYPE "Unknown Battery" #define MISSING_BATT_TYPE "Missing Battery" #define LOADING_BATT_TYPE "Loading Battery" Loading Loading @@ -4105,6 +4110,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CC_STEP_SEL: pval->intval = chip->ttf.cc_step.sel; break; case POWER_SUPPLY_PROP_REAL_CAPACITY: rc = fg_get_prop_real_capacity(chip, &pval->intval); break; default: pr_err("unsupported property %d\n", psp); rc = -EINVAL; Loading Loading @@ -4308,6 +4316,7 @@ static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, POWER_SUPPLY_PROP_CC_STEP, POWER_SUPPLY_PROP_CC_STEP_SEL, POWER_SUPPLY_PROP_REAL_CAPACITY, }; static const struct power_supply_desc fg_psy_desc = { Loading
drivers/power/supply/qcom/qpnp-qg.c +13 −0 Original line number Diff line number Diff line Loading @@ -1547,6 +1547,15 @@ static int qg_get_battery_capacity(struct qpnp_qg *chip, int *soc) return 0; } static int qg_get_battery_capacity_real(struct qpnp_qg *chip, int *soc) { mutex_lock(&chip->soc_lock); *soc = chip->msoc; mutex_unlock(&chip->soc_lock); return 0; } static int qg_get_charge_counter(struct qpnp_qg *chip, int *charge_counter) { int rc, cc_soc = 0; Loading Loading @@ -1707,6 +1716,9 @@ static int qg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY: rc = qg_get_battery_capacity(chip, &pval->intval); break; case POWER_SUPPLY_PROP_REAL_CAPACITY: rc = qg_get_battery_capacity_real(chip, &pval->intval); break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: rc = qg_get_battery_voltage(chip, &pval->intval); break; Loading Loading @@ -1826,6 +1838,7 @@ static int qg_property_is_writeable(struct power_supply *psy, static enum power_supply_property qg_psy_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_REAL_CAPACITY, POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_OCV, Loading
drivers/power/supply/qcom/smb5-lib.c +19 −2 Original line number Diff line number Diff line Loading @@ -2787,7 +2787,8 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) union power_supply_propval pval = {0, }; int rc = 0; rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CAPACITY, &pval); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); if (rc < 0) { smblib_err(chg, "Couldn't read SOC value, rc=%d\n", rc); return; Loading @@ -2801,6 +2802,8 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) * to prevent overcharing. */ if ((batt_status == TERMINATE_CHARGE) && (pval.intval == 100)) { chg->cc_soc_ref = 0; chg->last_cc_soc = 0; alarm_start_relative(&chg->chg_termination_alarm, ms_to_ktime(CHG_TERM_WA_ENTRY_DELAY_MS)); } else if (pval.intval < 100) { Loading @@ -2809,6 +2812,7 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) * we exit the TERMINATE_CHARGE state and soc drops below 100% */ chg->cc_soc_ref = 0; chg->last_cc_soc = 0; } } Loading Loading @@ -4160,7 +4164,8 @@ static void smblib_chg_termination_work(struct work_struct *work) if (rc < 0 || !pval.intval) goto out; rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CAPACITY, &pval); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); if (rc < 0 || (pval.intval < 100)) { vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); goto out; Loading Loading @@ -4192,6 +4197,18 @@ static void smblib_chg_termination_work(struct work_struct *work) goto out; } /* * In BSM a sudden jump in CC_SOC is not expected. If seen, its a * good_ocv or updated capacity, reject it. */ if (chg->last_cc_soc && pval.intval > (chg->last_cc_soc + 100)) { /* CC_SOC has increased by 1% from last time */ chg->cc_soc_ref = pval.intval; smblib_dbg(chg, PR_MISC, "cc_soc jumped(%d->%d), reset cc_soc_ref\n", chg->last_cc_soc, pval.intval); } chg->last_cc_soc = pval.intval; /* * Suspend/Unsuspend USB input to keep cc_soc within the 0.5% to 0.75% * overshoot range of the cc_soc value at termination, to prevent Loading
drivers/power/supply/qcom/smb5-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,7 @@ struct smb_charger { bool fcc_stepper_enable; int charge_full_cc; int cc_soc_ref; int last_cc_soc; /* workaround flag */ u32 wa_flags; Loading