summaryrefslogtreecommitdiff
path: root/common/host_event_commands.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-03-15 12:27:27 -0700
committerRandall Spangler <rspangler@chromium.org>2012-03-15 12:42:11 -0700
commitc72f66c050b7754c36436583272965b9ca4fd850 (patch)
tree8f532eeb86274628a542d38ccd2bc6012a958e38 /common/host_event_commands.c
parent38d1b2e8bad5b9d4698963dbb63684aacbd23ec0 (diff)
downloadchrome-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 'common/host_event_commands.c')
-rw-r--r--common/host_event_commands.c67
1 files changed, 49 insertions, 18 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index 058234ad6c..955f062728 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -33,10 +33,13 @@ static int command_host_event(int argc, char **argv)
lpc_clear_host_events(i);
} else if (!strcasecmp(argv[1], "smi")) {
uart_printf("Setting SMI mask to 0x%08x\n", i);
- lpc_set_host_event_mask(0, i);
+ lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, i);
} else if (!strcasecmp(argv[1], "sci")) {
uart_printf("Setting SCI mask to 0x%08x\n", i);
- lpc_set_host_event_mask(1, i);
+ lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, i);
+ } else if (!strcasecmp(argv[1], "wake")) {
+ uart_printf("Setting wake mask to 0x%08x\n", i);
+ lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, i);
} else {
uart_puts("Unknown sub-command\n");
return EC_ERROR_INVAL;
@@ -45,8 +48,12 @@ static int command_host_event(int argc, char **argv)
/* Print current SMI/SCI status */
uart_printf("Raw host events: 0x%08x\n", lpc_get_host_events());
- uart_printf("SMI mask: 0x%08x\n", lpc_get_host_event_mask(0));
- uart_printf("SCI mask: 0x%08x\n", lpc_get_host_event_mask(1));
+ uart_printf("SMI mask: 0x%08x\n",
+ lpc_get_host_event_mask(LPC_HOST_EVENT_SMI));
+ uart_printf("SCI mask: 0x%08x\n",
+ lpc_get_host_event_mask(LPC_HOST_EVENT_SCI));
+ uart_printf("Wake mask: 0x%08x\n",
+ lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE));
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(hostevent, command_host_event);
@@ -56,10 +63,10 @@ DECLARE_CONSOLE_COMMAND(hostevent, command_host_event);
static enum lpc_status host_event_get_smi_mask(uint8_t *data)
{
- struct lpc_response_host_event_get_smi_mask *r =
- (struct lpc_response_host_event_get_smi_mask *)data;
+ struct lpc_response_host_event_mask *r =
+ (struct lpc_response_host_event_mask *)data;
- r->mask = lpc_get_host_event_mask(0);
+ r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SMI);
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_SMI_MASK,
@@ -68,22 +75,34 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_SMI_MASK,
static enum lpc_status host_event_get_sci_mask(uint8_t *data)
{
- struct lpc_response_host_event_get_sci_mask *r =
- (struct lpc_response_host_event_get_sci_mask *)data;
+ struct lpc_response_host_event_mask *r =
+ (struct lpc_response_host_event_mask *)data;
- r->mask = lpc_get_host_event_mask(1);
+ r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SCI);
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_SCI_MASK,
host_event_get_sci_mask);
+static enum lpc_status host_event_get_wake_mask(uint8_t *data)
+{
+ struct lpc_response_host_event_mask *r =
+ (struct lpc_response_host_event_mask *)data;
+
+ r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE);
+ return EC_LPC_RESULT_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_WAKE_MASK,
+ host_event_get_wake_mask);
+
+
static enum lpc_status host_event_set_smi_mask(uint8_t *data)
{
- const struct lpc_params_host_event_set_smi_mask *p =
- (const struct lpc_params_host_event_set_smi_mask *)data;
+ const struct lpc_params_host_event_mask *p =
+ (const struct lpc_params_host_event_mask *)data;
- lpc_set_host_event_mask(0, p->mask);
+ lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, p->mask);
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_SMI_MASK,
@@ -92,20 +111,32 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_SMI_MASK,
static enum lpc_status host_event_set_sci_mask(uint8_t *data)
{
- const struct lpc_params_host_event_set_sci_mask *p =
- (const struct lpc_params_host_event_set_sci_mask *)data;
+ const struct lpc_params_host_event_mask *p =
+ (const struct lpc_params_host_event_mask *)data;
- lpc_set_host_event_mask(1, p->mask);
+ lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, p->mask);
return EC_LPC_RESULT_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_SCI_MASK,
host_event_set_sci_mask);
+static enum lpc_status host_event_set_wake_mask(uint8_t *data)
+{
+ const struct lpc_params_host_event_mask *p =
+ (const struct lpc_params_host_event_mask *)data;
+
+ lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, p->mask);
+ return EC_LPC_RESULT_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_WAKE_MASK,
+ host_event_set_wake_mask);
+
+
static enum lpc_status host_event_clear(uint8_t *data)
{
- const struct lpc_params_host_event_clear *p =
- (const struct lpc_params_host_event_clear *)data;
+ const struct lpc_params_host_event_mask *p =
+ (const struct lpc_params_host_event_mask *)data;
lpc_clear_host_events(p->mask);
return EC_LPC_RESULT_SUCCESS;