diff options
-rw-r--r-- | common/device_event.c | 5 | ||||
-rw-r--r-- | common/peripheral_charger.c | 9 | ||||
-rw-r--r-- | include/device_event.h | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/common/device_event.c b/common/device_event.c index 0e86b00f32..f7944ae930 100644 --- a/common/device_event.c +++ b/common/device_event.c @@ -78,6 +78,11 @@ static void device_set_enabled_events(uint32_t mask) device_enabled_events = mask; } +void device_enable_event(enum ec_device_event event) +{ + atomic_or(&device_enabled_events, EC_DEVICE_EVENT_MASK(event)); +} + /*****************************************************************************/ /* Console commands */ diff --git a/common/peripheral_charger.c b/common/peripheral_charger.c index 73bd5e32b8..0b467afc6e 100644 --- a/common/peripheral_charger.c +++ b/common/peripheral_charger.c @@ -449,6 +449,15 @@ void pchg_irq(enum gpio_signal signal) } } + +static void pchg_suspend_complete(void) +{ + CPRINTS("%s", __func__); + device_enable_event(EC_DEVICE_EVENT_WLC); +} +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND_COMPLETE, pchg_suspend_complete, + HOOK_PRIO_DEFAULT); + static void pchg_startup(void) { struct pchg *ctx; diff --git a/include/device_event.h b/include/device_event.h index debec00d52..7a6403e51d 100644 --- a/include/device_event.h +++ b/include/device_event.h @@ -43,4 +43,11 @@ static inline void device_set_single_event(int event) device_set_events(EC_DEVICE_EVENT_MASK(event)); } +/** + * Enable device event. + * + * @param event Event to enable (EC_DEVICE_EVENT_*) + */ +void device_enable_event(enum ec_device_event event); + #endif /* __CROS_EC_DEVICE_EVENT_H */ |