Loading drivers/power/supply/qcom/smb5-lib.c +19 −2 Original line number Diff line number Diff line Loading @@ -4473,7 +4473,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 @@ -4487,6 +4488,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 @@ -4495,6 +4498,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 @@ -6288,7 +6292,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 @@ -6321,6 +6326,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 @@ -520,6 +520,7 @@ struct smb_charger { bool aicl_max_reached; int charge_full_cc; int cc_soc_ref; int last_cc_soc; int dr_mode; int usbin_forced_max_uv; int init_thermal_ua; Loading Loading
drivers/power/supply/qcom/smb5-lib.c +19 −2 Original line number Diff line number Diff line Loading @@ -4473,7 +4473,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 @@ -4487,6 +4488,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 @@ -4495,6 +4498,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 @@ -6288,7 +6292,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 @@ -6321,6 +6326,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 @@ -520,6 +520,7 @@ struct smb_charger { bool aicl_max_reached; int charge_full_cc; int cc_soc_ref; int last_cc_soc; int dr_mode; int usbin_forced_max_uv; int init_thermal_ua; Loading