summaryrefslogtreecommitdiff
path: root/common/main.c
diff options
context:
space:
mode:
authorWealian Liao <whliao@nuvoton.corp-partner.google.com>2020-10-29 01:55:56 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-12 02:35:14 +0000
commit88b780027ddfc0afa55c4cf3c6d5606d7676cbca (patch)
tree32aac28aa0a1c737aecea4162b43a7599a035bef /common/main.c
parent72106b0e0997ac8d0df70335471659372466133b (diff)
downloadchrome-ec-88b780027ddfc0afa55c4cf3c6d5606d7676cbca.tar.gz
npcx/system: LCT compensate for MTC in PSL_hibernate
NPCX chip uses the MTC module as the RTC counter. However, in PSL hibernate, MTC will stop counting. NPCX9 supports the LCT module which could count continuously when VCC1 power is off. The CL uses LCT to compensate for the MTC counter value after PSL hibernate wake-up. The LCT maximum counting value is 16 weeks. BRANCH=none BUG=b:165777478, b:171919875 TEST=pass "make buildall" TEST=Check the RTC value in the following scenario: 1. "hibernate" and wake up EC by PSL input. 2. "hibernate 30" and wake up EC after timeout. 3. "hibernate 30" and wake up EC by PSL input before timeout. Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I39e370a437f40749acbd3a35a8b37ebec70f1bf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2506864 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/main.c')
-rw-r--r--common/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/main.c b/common/main.c
index c1228d0a7a..2e9fe5a444 100644
--- a/common/main.c
+++ b/common/main.c
@@ -124,6 +124,10 @@ test_mockable __keep int main(void)
*/
timer_init();
+ /* Compensate the elapsed time for the RTC. */
+ if (IS_ENABLED(CONFIG_HIBERNATE_PSL_COMPENSATE_RTC))
+ system_compensate_rtc();
+
/* Main initialization stage. Modules may enable interrupts here. */
cpu_init();