diff options
-rw-r--r-- | board/katsu/board.c | 9 | ||||
-rw-r--r-- | board/katsu/board.h | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/board/katsu/board.c b/board/katsu/board.c index 5e1147c919..a91f2c4afa 100644 --- a/board/katsu/board.c +++ b/board/katsu/board.c @@ -239,6 +239,7 @@ int extpower_is_present(void) * so exclude such ports. */ int usb_c_extpower_present; + static int prev_usb_c_extpower_present; if (board_vbus_source_enabled(CHARGE_PORT_USB_C)) usb_c_extpower_present = 0; @@ -247,6 +248,14 @@ int extpower_is_present(void) CHARGE_PORT_USB_C, VBUS_PRESENT); + if (prev_usb_c_extpower_present != usb_c_extpower_present) { + if (usb_c_extpower_present) + host_set_single_event(EC_HOST_EVENT_AC_CONNECTED); + else + host_set_single_event(EC_HOST_EVENT_AC_DISCONNECTED); + prev_usb_c_extpower_present = usb_c_extpower_present; + } + return usb_c_extpower_present; } diff --git a/board/katsu/board.h b/board/katsu/board.h index aa6e386d8f..5b40417161 100644 --- a/board/katsu/board.h +++ b/board/katsu/board.h @@ -63,6 +63,13 @@ #define CONFIG_MKBP_EVENT #define CONFIG_MKBP_EVENT_WAKEUP_MASK \ (BIT(EC_MKBP_EVENT_SENSOR_FIFO) | BIT(EC_MKBP_EVENT_HOST_EVENT)) +#undef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK +#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE)) #define PD_OPERATING_POWER_MW 15000 |