summaryrefslogtreecommitdiff
path: root/include/charge_state.h
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-11-23 10:15:33 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-30 20:30:11 -0800
commit55b87f4847394935d05cdefab2dc18dff9d6fa0e (patch)
tree7e626bfb4467e738cc8898fb8912d341a3f9c131 /include/charge_state.h
parent925ecb4fd225142304e00b020d20dbbf32d27828 (diff)
downloadchrome-ec-55b87f4847394935d05cdefab2dc18dff9d6fa0e.tar.gz
charge_state: Change CHARGE_MAX_SLEEP_USEC to 1 minute
CHARGE_MAX_SLEEP_USEC was originally set to 1 minute (i.e. equal to POLL_PERIOD_VERY_LONG) in CL:191767. However, during re-factoring in CL:193876 it got changed to 1 second as charge_state_v1 used this value. Looking at the way CHARGE_MAX_SLEEP_USEC is used, value of 1 minute makes more sense because sleep_usec could be set to POLL_PERIOD_VERY_LONG when device is off or suspended. With the current logic in suspend/off state, sleep_usec is set to POLL_PERIOD_VERY_LONG and immediately gets reset to CHARGE_MAX_SLEEP_USEC in charger_task. This change fixes the above behavior by defining CHARGE_MAX_SLEEP_USEC as 1 minute. As a side-effect of this, we might not wake up early enough in case of critical battery. Thus, check if we need to shutdown on critical battery and adjust sleep time accordingly. BUG=b:69695376 BRANCH=None TEST=make -j buildall Change-Id: Ieba7279dc4b02c3d64022c3c5ac09fb869a3632d Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/788181 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include/charge_state.h')
-rw-r--r--include/charge_state.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/charge_state.h b/include/charge_state.h
index fb1a41527a..bcf9071d6b 100644
--- a/include/charge_state.h
+++ b/include/charge_state.h
@@ -19,7 +19,7 @@
#define CHARGE_POLL_PERIOD_CHARGE (MSEC * 250)
#define CHARGE_POLL_PERIOD_SHORT (MSEC * 100)
#define CHARGE_MIN_SLEEP_USEC (MSEC * 50)
-#define CHARGE_MAX_SLEEP_USEC SECOND
+#define CHARGE_MAX_SLEEP_USEC MINUTE
/* Power states */
enum charge_state {