diff options
author | wen zhang <zhangwen6@huaqin.corp-partner.google.com> | 2022-05-09 17:29:13 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-17 03:33:32 +0000 |
commit | 1a2d2a5222f487e87ac1281aaf967cc7b2bbe006 (patch) | |
tree | 12eac5d4712d5920f3548a5b165368332dec7932 | |
parent | d308cf90aa908fb02b1de500d6397246dedabebf (diff) | |
download | chrome-ec-1a2d2a5222f487e87ac1281aaf967cc7b2bbe006.tar.gz |
katsu: support AC connect/disconnect wake source
Enable the AC connect/disconnect events to wake up host
BUG=b:230778126
BRANCH=kukui
TEST=1.manually test pass
2.autotest-power_WakeSources pass
Change-Id: I8dc5c67b925c5696a1f20c4dad2fb140dcd76a34
Signed-off-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3631794
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Reviewed-by: Xuxin Xiong <xuxinxiong@huaqin.corp-partner.google.com>
(cherry picked from commit 6101ae964969d6d6e9b307531c3d6f218aca93d8)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3636626
Reviewed-by: zanxi chen <chenzanxi@huaqin.corp-partner.google.com>
-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 4dc5a09f07..88d3797860 100644 --- a/board/katsu/board.c +++ b/board/katsu/board.c @@ -219,12 +219,21 @@ 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; else usb_c_extpower_present = tcpm_get_vbus_level(CHARGE_PORT_USB_C); + 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 6b46893729..b056642a7d 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 |