diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-03-15 12:27:27 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-03-15 12:42:11 -0700 |
commit | c72f66c050b7754c36436583272965b9ca4fd850 (patch) | |
tree | 8f532eeb86274628a542d38ccd2bc6012a958e38 /util | |
parent | 38d1b2e8bad5b9d4698963dbb63684aacbd23ec0 (diff) | |
download | chrome-ec-c72f66c050b7754c36436583272965b9ca4fd850.tar.gz |
Add wake signal to PCH
This works similar to SCI/SMI events, but triggers a separate
level-sensitive signal to the PCH instead.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:8514
TEST=manual
From EC console:
gpioget PCH_WAKEn --> should be 1
hostevent wake 0x1
close lid switch (with magnet)
hostevent -> should show wake mask 0x1, raw events 0x1
gpioget PCH_WAKEn --> should be 0
hostevent clear 0x1
hostevent -> should show raw events 0
gpioget PCH_WAKEn --> should be 1
Change-Id: I29832c1dc30239a98987578f07dfeb25791dde11
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/util/ectool.c b/util/ectool.c index a7c7c2cbc6..e3d24b1abd 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -28,10 +28,14 @@ const char help_str[] = " Prints SCI mask for EC host events\n" " eventgetsmimask\n" " Prints SMI mask for EC host events\n" + " eventgetwakemask\n" + " Prints wake mask for EC host events\n" " eventsetscimask <mask>\n" " Sets the SCI mask for EC host events\n" " eventsetsmimask <mask>\n" " Sets the SMI mask for EC host events\n" + " eventsetwakemask <mask>\n" + " Sets the wake mask for EC host events\n" " flashinfo\n" " Prints information on the EC flash\n" " flashread <offset> <size> <outfile>\n" @@ -1001,7 +1005,7 @@ int cmd_host_event_get_raw(int argc, char *argv[]) int cmd_host_event_get_smi_mask(int argc, char *argv[]) { - struct lpc_response_host_event_get_smi_mask r; + struct lpc_response_host_event_mask r; int rv; rv = ec_command(EC_LPC_COMMAND_HOST_EVENT_GET_SMI_MASK, @@ -1016,7 +1020,7 @@ int cmd_host_event_get_smi_mask(int argc, char *argv[]) int cmd_host_event_get_sci_mask(int argc, char *argv[]) { - struct lpc_response_host_event_get_sci_mask r; + struct lpc_response_host_event_mask r; int rv; rv = ec_command(EC_LPC_COMMAND_HOST_EVENT_GET_SCI_MASK, @@ -1029,9 +1033,24 @@ int cmd_host_event_get_sci_mask(int argc, char *argv[]) } +int cmd_host_event_get_wake_mask(int argc, char *argv[]) +{ + struct lpc_response_host_event_mask r; + int rv; + + rv = ec_command(EC_LPC_COMMAND_HOST_EVENT_GET_WAKE_MASK, + NULL, 0, &r, sizeof(r)); + if (rv) + return rv; + + printf("Current host event wake mask: 0x%08x\n", r.mask); + return 0; +} + + int cmd_host_event_set_smi_mask(int argc, char *argv[]) { - struct lpc_params_host_event_set_smi_mask p; + struct lpc_params_host_event_mask p; char *e; int rv; @@ -1058,7 +1077,7 @@ int cmd_host_event_set_smi_mask(int argc, char *argv[]) int cmd_host_event_set_sci_mask(int argc, char *argv[]) { - struct lpc_params_host_event_set_sci_mask p; + struct lpc_params_host_event_mask p; char *e; int rv; @@ -1083,9 +1102,36 @@ int cmd_host_event_set_sci_mask(int argc, char *argv[]) } +int cmd_host_event_set_wake_mask(int argc, char *argv[]) +{ + struct lpc_params_host_event_mask p; + char *e; + int rv; + + if (argc != 1) { + fprintf(stderr, + "Usage: eventwakemask <mask>\n"); + return -1; + } + p.mask = strtol(argv[0], &e, 0); + if (e && *e) { + fprintf(stderr, "Bad mask.\n"); + return -1; + } + + rv = ec_command(EC_LPC_COMMAND_HOST_EVENT_SET_WAKE_MASK, + &p, sizeof(p), NULL, 0); + if (rv) + return rv; + + printf("Mask set.\n"); + return 0; +} + + int cmd_host_event_clear(int argc, char *argv[]) { - struct lpc_params_host_event_clear p; + struct lpc_params_host_event_mask p; char *e; int rv; @@ -1193,8 +1239,10 @@ const struct command commands[] = { {"eventget", cmd_host_event_get_raw}, {"eventgetscimask", cmd_host_event_get_sci_mask}, {"eventgetsmimask", cmd_host_event_get_smi_mask}, + {"eventgetwakemask", cmd_host_event_get_wake_mask}, {"eventsetscimask", cmd_host_event_set_sci_mask}, {"eventsetsmimask", cmd_host_event_set_smi_mask}, + {"eventsetwakemask", cmd_host_event_set_wake_mask}, {"flasherase", cmd_flash_erase}, {"flashread", cmd_flash_read}, {"flashwrite", cmd_flash_write}, |