summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Huang <david.huang@quanta.corp-partner.google.com>2022-08-24 10:41:05 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-01 02:23:43 +0000
commite488388c6a4f8518fe1c5ff94b8c8f4884efb603 (patch)
tree90d11f581bd0c6e117eaea53b0897939ccd50590
parentf60eb1f7a9e1805788e7c98182512c0c518ccaec (diff)
downloadchrome-ec-e488388c6a4f8518fe1c5ff94b8c8f4884efb603.tar.gz
common: Not sleep 500ms when already left safe mode
Don not sleep 500ms when ec already left safe mode. BUG=b:226259582 BRANCH=main TEST=Check get battery info don't have 500ms delay in console. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: I740b49e654047800936086a9de33a87c7c46a300 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3853307 Commit-Queue: David Huang <david.huang@quanta.corp-partner.google.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rw-r--r--common/charge_manager.c15
-rw-r--r--common/charge_state_v2.c15
2 files changed, 15 insertions, 15 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 3958e64147..70e0e1540f 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -1240,6 +1240,21 @@ void charge_manager_leave_safe_mode(void)
if (left_safe_mode)
return;
+ /*
+ * Sometimes the fuel gauge will report that it has
+ * sufficient state of charge and remaining capacity,
+ * but in actuality it doesn't. When the EC sees that
+ * information, it trusts it and leaves charge manager
+ * safe mode. Doing so will allow CHARGE_PORT_NONE to
+ * be selected, thereby cutting off the input FETs.
+ * When the battery cannot provide the charge it claims,
+ * the system loses power, shuts down, and the battery
+ * is not charged even though the charger is plugged in.
+ * By waiting 500ms, we can avoid the selection of
+ * CHARGE_PORT_NONE around init time and not cut off the
+ * input FETs.
+ */
+ msleep(500);
CPRINTS("%s()", __func__);
cflush();
left_safe_mode = 1;
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index d4456ecd1f..6cd2858457 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1856,21 +1856,6 @@ void charger_task(void *u)
if (curr.batt.state_of_charge >=
CONFIG_CHARGE_MANAGER_BAT_PCT_SAFE_MODE_EXIT &&
!battery_seems_disconnected) {
- /*
- * Sometimes the fuel gauge will report that it has
- * sufficient state of charge and remaining capacity,
- * but in actuality it doesn't. When the EC sees that
- * information, it trusts it and leaves charge manager
- * safe mode. Doing so will allow CHARGE_PORT_NONE to
- * be selected, thereby cutting off the input FETs.
- * When the battery cannot provide the charge it claims,
- * the system loses power, shuts down, and the battery
- * is not charged even though the charger is plugged in.
- * By waiting 500ms, we can avoid the selection of
- * CHARGE_PORT_NONE around init time and not cut off the
- * input FETs.
- */
- msleep(500);
charge_manager_leave_safe_mode();
}
#endif