Loading drivers/power/supply/qcom/qpnp-fg-gen4.c +9 −0 Original line number Diff line number Diff line Loading @@ -959,6 +959,11 @@ static int fg_gen4_get_prop_capacity(struct fg_dev *fg, int *val) return 0; } static int fg_gen4_get_prop_real_capacity(struct fg_dev *fg, int *val) { return fg_get_msoc(fg, val); } static int fg_gen4_get_prop_capacity_raw(struct fg_gen4_chip *chip, int *val) { struct fg_dev *fg = &chip->fg; Loading Loading @@ -4202,6 +4207,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY: rc = fg_gen4_get_prop_capacity(fg, &pval->intval); break; case POWER_SUPPLY_PROP_REAL_CAPACITY: rc = fg_gen4_get_prop_real_capacity(fg, &pval->intval); break; case POWER_SUPPLY_PROP_CAPACITY_RAW: rc = fg_gen4_get_prop_capacity_raw(chip, &pval->intval); break; Loading Loading @@ -4445,6 +4453,7 @@ static int fg_property_is_writeable(struct power_supply *psy, static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_REAL_CAPACITY, POWER_SUPPLY_PROP_CAPACITY_RAW, POWER_SUPPLY_PROP_CC_SOC, POWER_SUPPLY_PROP_TEMP, Loading drivers/power/supply/qcom/qpnp-qg.c +13 −0 Original line number Diff line number Diff line Loading @@ -1583,6 +1583,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 @@ -1836,6 +1845,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 @@ -1956,6 +1968,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 @@ -4612,7 +4612,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 @@ -4626,6 +4627,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 @@ -4634,6 +4637,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 @@ -6420,7 +6424,8 @@ static void smblib_chg_termination_work(struct work_struct *work) if ((rc < 0) || !input_present) 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); vote(chg->dc_suspend_votable, CHG_TERMINATION_VOTER, false, 0); Loading Loading @@ -6453,6 +6458,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 @@ -505,6 +505,7 @@ struct smb_charger { bool aicl_max_reached; int charge_full_cc; int cc_soc_ref; int last_cc_soc; int usbin_forced_max_uv; int init_thermal_ua; Loading Loading
drivers/power/supply/qcom/qpnp-fg-gen4.c +9 −0 Original line number Diff line number Diff line Loading @@ -959,6 +959,11 @@ static int fg_gen4_get_prop_capacity(struct fg_dev *fg, int *val) return 0; } static int fg_gen4_get_prop_real_capacity(struct fg_dev *fg, int *val) { return fg_get_msoc(fg, val); } static int fg_gen4_get_prop_capacity_raw(struct fg_gen4_chip *chip, int *val) { struct fg_dev *fg = &chip->fg; Loading Loading @@ -4202,6 +4207,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY: rc = fg_gen4_get_prop_capacity(fg, &pval->intval); break; case POWER_SUPPLY_PROP_REAL_CAPACITY: rc = fg_gen4_get_prop_real_capacity(fg, &pval->intval); break; case POWER_SUPPLY_PROP_CAPACITY_RAW: rc = fg_gen4_get_prop_capacity_raw(chip, &pval->intval); break; Loading Loading @@ -4445,6 +4453,7 @@ static int fg_property_is_writeable(struct power_supply *psy, static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_REAL_CAPACITY, POWER_SUPPLY_PROP_CAPACITY_RAW, POWER_SUPPLY_PROP_CC_SOC, POWER_SUPPLY_PROP_TEMP, Loading
drivers/power/supply/qcom/qpnp-qg.c +13 −0 Original line number Diff line number Diff line Loading @@ -1583,6 +1583,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 @@ -1836,6 +1845,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 @@ -1956,6 +1968,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 @@ -4612,7 +4612,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 @@ -4626,6 +4627,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 @@ -4634,6 +4637,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 @@ -6420,7 +6424,8 @@ static void smblib_chg_termination_work(struct work_struct *work) if ((rc < 0) || !input_present) 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); vote(chg->dc_suspend_votable, CHG_TERMINATION_VOTER, false, 0); Loading Loading @@ -6453,6 +6458,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 @@ -505,6 +505,7 @@ struct smb_charger { bool aicl_max_reached; int charge_full_cc; int cc_soc_ref; int last_cc_soc; int usbin_forced_max_uv; int init_thermal_ua; Loading