diff options
author | Peter Chi <peter_chi@wistron.corp-partner.google.com> | 2022-04-22 19:12:27 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-20 23:26:18 +0000 |
commit | aa949e591d8261a387315f211492062a4779cf4e (patch) | |
tree | e2b654c1217d15b372aa19ebd6df6bc9141e010a /board | |
parent | 0f17ba667757ad1db1e67ffac96f0a7e52905fe1 (diff) | |
download | chrome-ec-aa949e591d8261a387315f211492062a4779cf4e.tar.gz |
crota: add power share support
We need add feture for power share in S5/G3 state.
BUG=b:230074336, b:230083233
BRANCH=none
TEST=make -j BOARD=crota
Signed-off-by: Peter Chi <peter_chi@wistron.corp-partner.google.com>
Change-Id: Ic95887aeffea90b35159056af121f81513975ab2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3602116
Commit-Queue: Boris Mittelberg <bmbm@google.com>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/crota/board.c | 23 | ||||
-rw-r--r-- | board/crota/board.h | 1 |
2 files changed, 23 insertions, 1 deletions
diff --git a/board/crota/board.c b/board/crota/board.c index 5861203523..855eeabb81 100644 --- a/board/crota/board.c +++ b/board/crota/board.c @@ -10,6 +10,7 @@ #include "common.h" #include "compile_time_macros.h" #include "console.h" +#include "extpower.h" #include "gpio.h" #include "gpio_signal.h" #include "hooks.h" @@ -54,4 +55,24 @@ static void board_chipset_suspend(void) gpio_set_level(GPIO_EC_KB_BL_EN_L, 1); } -DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
\ No newline at end of file +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); + +#ifdef CONFIG_USB_PORT_POWER_DUMB_CUSTOM_HOOK +static void usb_port_startup(void) +{ + gpio_set_level(GPIO_EN_PP5000_USBA_R, 1); +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, usb_port_startup, HOOK_PRIO_DEFAULT); + +static void usba_power(void) +{ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) { + if (extpower_is_present()) + gpio_set_level(GPIO_EN_PP5000_USBA_R, 1); + else + gpio_set_level(GPIO_EN_PP5000_USBA_R, 0); + } +} +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, usba_power, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_AC_CHANGE, usba_power, HOOK_PRIO_DEFAULT); +#endif /* CONFIG_USB_PORT_POWER_DUMB_CUSTOM_HOOK */ diff --git a/board/crota/board.h b/board/crota/board.h index bf850795ef..71b6171507 100644 --- a/board/crota/board.h +++ b/board/crota/board.h @@ -61,6 +61,7 @@ /* USB Type A Features */ #define USB_PORT_COUNT 1 #define CONFIG_USB_PORT_POWER_DUMB +#define CONFIG_USB_PORT_POWER_DUMB_CUSTOM_HOOK /* USB Type C and USB PD defines */ #define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY |