diff options
author | Shelley Chen <shchen@chromium.org> | 2016-05-26 11:13:40 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-05-27 13:47:02 -0700 |
commit | cebf8734d96d8c6a44185ee1b7d38b4d42efd36a (patch) | |
tree | 9cd0599cdb625af60b94115f33e0cf29c9ad2b82 /util | |
parent | 641b02a46c323a4560e9e6ff75478680ff9a6e7d (diff) | |
download | chrome-ec-cebf8734d96d8c6a44185ee1b7d38b4d42efd36a.tar.gz |
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 <sec>
Should see [event set 0x02000000] from EC
console in approximately <sec> seconds.
Change-Id: I3202b826cb994dbca456b8b9c22bbca4dbe2766a
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347493
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 27 |
1 files changed, 27 insertions, 0 deletions
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 <RO|RW|cold|hibernate|disable-jump> [at-shutdown]\n" " Reboot EC to RO or RW\n" + " rtcalarm <sec>\n" + " Set real-time clock alarm to go off in <sec> seconds\n" " rtcget\n" " Print real-time clock\n" " rtcset <time>\n" @@ -5962,6 +5964,30 @@ int cmd_rtc_set(int argc, char *argv[]) return 0; } +int cmd_rtc_set_alarm(int argc, char *argv[]) +{ + struct ec_params_rtc p; + char *e; + int rv; + + if (argc != 2) { + fprintf(stderr, "Usage: %s <sec>\n", argv[0]); + return -1; + } + p.time = strtol(argv[1], &e, 0); + if (e && *e) { + fprintf(stderr, "Bad time.\n"); + return -1; + } + + rv = ec_command(EC_CMD_RTC_SET_ALARM, 0, &p, sizeof(p), NULL, 0); + if (rv < 0) + return rv; + + printf("Alarm Set to go off in %d secs.\n", p.time); + return 0; +} + int cmd_console(int argc, char *argv[]) { char *out = (char *)ec_inbuf; @@ -6736,6 +6762,7 @@ const struct command commands[] = { {"pwmsetduty", cmd_pwm_set_duty}, {"readtest", cmd_read_test}, {"reboot_ec", cmd_reboot_ec}, + {"rtcalarm", cmd_rtc_set_alarm}, {"rtcget", cmd_rtc_get}, {"rtcset", cmd_rtc_set}, {"rwhashpd", cmd_rw_hash_pd}, |