From 54f61e084669cb376c81c017afef52da682ac9e0 Mon Sep 17 00:00:00 2001 From: mahj8 Date: Mon, 25 Oct 2021 16:24:36 +0800 Subject: [PATCH] DLKM: UI batt level show 100% when real batt level 0% The unit boot when real batt_soc 0%, the UI batt level show 100%. The root cause is combine soc is 100 when init, and now mmi_combine_battery_soc api return soc is -1, so don't update the combine soc. Change-Id: I9e41b7f68c735b76c384d1cdcf3ffb6735db4f57 Signed-off-by: mahj8 Reviewed-on: https://gerrit.mot.com/2098253 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Lu Chai Reviewed-by: Yonghua Yan Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- drivers/power/mmi_charger/mmi_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/mmi_charger/mmi_charger.c b/drivers/power/mmi_charger/mmi_charger.c index c0b9b4084b65..93e2aa731b16 100644 --- a/drivers/power/mmi_charger/mmi_charger.c +++ b/drivers/power/mmi_charger/mmi_charger.c @@ -1682,7 +1682,7 @@ static int mmi_combine_battery_soc(struct mmi_charger_chip *chip) full += battery->info->batt_full_uah; } - if (full > 0 && remain > 0) { + if (full > 0 && remain >= 0) { soc = remain / full; if (soc > 100) soc = 100;