int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event) { u32 host_event; int ret; if (!ec_dev->mkbp_event_supported) { ret = get_keyboard_state_event(ec_dev); if (ret < 0) return ret; if (wake_event) *wake_event = true; return ret; } ret = get_next_event(ec_dev); if (ret < 0) return ret; if (wake_event) { host_event = cros_ec_get_host_event(ec_dev); /* Consider non-host_event as wake event */ *wake_event = !host_event || !!(host_event & ec_dev->host_event_wake_mask); } return ret; }
static int cros_ec_rtc_event(struct notifier_block *nb, unsigned long queued_during_suspend, void *_notify) { struct cros_ec_rtc *cros_ec_rtc; struct rtc_device *rtc; struct cros_ec_device *cros_ec; u32 host_event; cros_ec_rtc = container_of(nb, struct cros_ec_rtc, notifier); rtc = cros_ec_rtc->rtc; cros_ec = cros_ec_rtc->cros_ec; host_event = cros_ec_get_host_event(cros_ec); if (host_event & EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC)) { rtc_update_irq(rtc, 1, RTC_IRQF | RTC_AF); return NOTIFY_OK; } else { return NOTIFY_DONE; } }