static void lpc_resume(void) { /* Mask all host events until the host unmasks them itself. */ lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, 0); lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, 0); lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, 0); /* Store port 80 event so we know where resume happened */ port_80_write(PORT_80_EVENT_RESUME); }
static void lpc_resume(void) { #ifdef CONFIG_POWER_S0IX if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_ON)) #endif { /* Mask all host events until the host unmasks them itself. */ lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, 0); lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, 0); lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, 0); } /* Store port 80 event so we know where resume happened */ port_80_write(PORT_80_EVENT_RESUME); }
static int host_event_set_wake_mask(struct host_cmd_handler_args *args) { const struct ec_params_host_event_mask *p = args->params; lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, p->mask); return EC_RES_SUCCESS; }
/* * In AP S0ix & S3 -> S0 transitions, * the chipset_resume hook is called. * * During S0ix exit, the wake mask for lid open is disabled. * All pending events are cleared * */ void lpc_disable_wake_mask_for_lid_open(void) { if ((chipset_in_state(CHIPSET_STATE_STANDBY | CHIPSET_STATE_ON)) || chipset_in_state(CHIPSET_STATE_ON)) { lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, 0); lpc_clear_host_events(); } }
/* * In AP S0 -> S3 & S0ix transitions, * the chipset_suspend is called. * * The chipset_in_state(CHIPSET_STATE_STANDBY | CHIPSET_STATE_ON) * is used to detect the S0ix transiton. * * During S0ix entry, the wake mask for lid open is enabled. * */ void lpc_enable_wake_mask_for_lid_open(void) { if ((chipset_in_state(CHIPSET_STATE_STANDBY | CHIPSET_STATE_ON)) || chipset_in_state(CHIPSET_STATE_STANDBY)) { uint32_t mask = 0; mask = ((lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE)) | EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN)); lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, mask); } }
/* * In AP S0ix & S3 -> S0 transitions, * the chipset_resume hook is called. * * During S0ix exit, the wake mask for lid open is disabled. * All pending events are cleared */ void lpc_disable_wake_mask_for_lid_open(void) { if (chipset_in_state(CHIPSET_STATE_STANDBY | CHIPSET_STATE_ON)) { uint32_t mask; mask = lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE) & ~EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN); lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, mask); lpc_clear_host_events(); } }
static int command_host_event(int argc, char **argv) { /* Handle sub-commands */ if (argc == 3) { char *e; int i = strtoi(argv[2], &e, 0); if (*e) return EC_ERROR_PARAM2; if (!strcasecmp(argv[1], "set")) host_set_events(i); else if (!strcasecmp(argv[1], "clear")) host_clear_events(i); else if (!strcasecmp(argv[1], "clearb")) host_clear_events_b(i); #ifdef CONFIG_LPC else if (!strcasecmp(argv[1], "smi")) lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, i); else if (!strcasecmp(argv[1], "sci")) lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, i); else if (!strcasecmp(argv[1], "wake")) lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, i); #endif else return EC_ERROR_PARAM1; } /* Print current SMI/SCI status */ ccprintf("Events: 0x%08x\n", host_get_events()); ccprintf("Events-B: 0x%08x\n", events_copy_b); #ifdef CONFIG_LPC ccprintf("SMI mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_SMI)); ccprintf("SCI mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_SCI)); ccprintf("Wake mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE)); #endif return EC_SUCCESS; }