From cebf8734d96d8c6a44185ee1b7d38b4d42efd36a Mon Sep 17 00:00:00 2001 From: Shelley Chen Date: Thu, 26 May 2016 11:13:40 -0700 Subject: [PATCH] kevin: rk3399: ectool interface for EC RTC alarm Only way to set alarm previously was through rtcalarm command on EC console. Implemented interface through ectool so that the AP can set it as well. BUG=chrome-os-partner:52218 BRANCH=None TEST=from AP console, run ectool rtcalarm Should see [event set 0x02000000] from EC console in approximately seconds. Change-Id: I3202b826cb994dbca456b8b9c22bbca4dbe2766a Signed-off-by: Shelley Chen Reviewed-on: https://chromium-review.googlesource.com/347493 Reviewed-by: Vadim Bendebury --- chip/npcx/system.c | 11 +++++++++++ util/ectool.c | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/chip/npcx/system.c b/chip/npcx/system.c index 46547ff737..0411892214 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -762,6 +762,17 @@ DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_VALUE, system_rtc_set_value, EC_VER_MASK(0)); +static int system_rtc_set_alarm(struct host_cmd_handler_args *args) +{ + const struct ec_params_rtc *p = args->params; + + system_set_rtc_alarm(p->time, 0); + return EC_RES_SUCCESS; +} +DECLARE_HOST_COMMAND(EC_CMD_RTC_SET_ALARM, + system_rtc_set_alarm, + EC_VER_MASK(0)); + #ifdef CONFIG_EXTERNAL_STORAGE void system_jump_to_booter(void) { diff --git a/util/ectool.c b/util/ectool.c index f5787efcf2..a1210466f5 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -187,6 +187,8 @@ const char help_str[] = " Reads a pattern from the EC via LPC\n" " reboot_ec [at-shutdown]\n" " Reboot EC to RO or RW\n" + " rtcalarm \n" + " Set real-time clock alarm to go off in seconds\n" " rtcget\n" " Print real-time clock\n" " rtcset