From 5a28fcc34d08d551bc17b50b5d6f072f5c0b027a Mon Sep 17 00:00:00 2001 From: Haijian Ma Date: Mon, 5 Aug 2019 10:40:53 +0800 Subject: [PATCH] charging: fixed logic error When count =1 and charger also present, it will run count reset and cancel charger check work, so add charger present condition. Change-Id: I4a6b871cc23a18b8f9412d16f35949c610cc17e3 Signed-off-by: Haijian Ma Reviewed-on: https://gerrit.mot.com/1396760 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yonghua Yan Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c index 4ba6381e97eb..8c45dbce978c 100644 --- a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c +++ b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c @@ -2915,9 +2915,11 @@ static void mmi_heartbeat_work(struct work_struct *work) mmi_info(chip, "APSD = %d, rerun_apsd_count = %d\n", apsd, rerun_apsd_count); } - } else if (rerun_apsd_count) { + } else if (rerun_apsd_count && !chg_stat.charger_present) { rerun_apsd_count = 0; cancel_delayed_work(&chip->charger_check_work); + mmi_info(chip, "reset rerun_apsd_count = %d\n", + rerun_apsd_count); } mmi_chrg_rate_check(chip);