From 9519f45eeac5f69aab4d37d9b6348cc5037c599c Mon Sep 17 00:00:00 2001 From: Yonghua Yan Date: Thu, 30 May 2019 20:27:13 +0800 Subject: [PATCH] power: Rerun AICL if charging disable/enable It is found that the USB settled ICL drop down when battery charging is disabled for full charge, but the ICL does not adaptively increase for incremental system load or recharge. In that case, it draws current from battery even a charger is attached. In order to recover from that situation, rerun AICL is an effective way to recover the USB ICL. Change-Id: Ic08691817bb51276187db558cdd5addd07fc85f0 Signed-off-by: Yonghua Yan Reviewed-on: https://gerrit.mot.com/1364085 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Kenneth Kessler Submit-Approved: Jira Key --- drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c index cbafe9b9a2d6..ec75726b0d33 100644 --- a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c +++ b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c @@ -2223,6 +2223,7 @@ static void mmi_basic_charge_sm(struct smb_mmi_charger *chip, struct mmi_temp_zone *zone; struct mmi_sm_params *prm = &chip->sm_param[BASE_BATT]; bool voltage_full; + bool is_chg_dis = get_effective_result(chip->chg_dis_votable); static int demo_full_soc = 100; mmi_info(chip, "SMBMMI: batt_mv = %d, batt_ma %d, batt_soc %d," @@ -2400,6 +2401,13 @@ static void mmi_basic_charge_sm(struct smb_mmi_charger *chip, vote(chip->fcc_votable, MMI_HB_VOTER, true, (target_fcc >= 0) ? (target_fcc * 1000) : 0); + /* Rerun AICL to recover USB ICL from recharge */ + if (is_chg_dis != get_effective_result(chip->chg_dis_votable)) { + power_supply_set_property(chip->qcom_psy, + POWER_SUPPLY_PROP_RERUN_AICL, + NULL); + } + if (prm->pres_temp_zone == ZONE_HOT) { prm->batt_health = POWER_SUPPLY_HEALTH_OVERHEAT; } else if (prm->pres_temp_zone == ZONE_COLD) {