diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-04-02 12:16:27 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2019-04-02 19:28:25 +0000 |
commit | 8b0464db257283b9610aadd1cc8819a780cf22f7 (patch) | |
tree | ce893f5f7a83a7ce2a1d1e813e2b8d05826ce5ce | |
parent | 7a67d437f26005f00d8c2c4474489c00303d4af9 (diff) | |
download | chrome-ec-8b0464db257283b9610aadd1cc8819a780cf22f7.tar.gz |
Nami: Enable BC12 when FAFT sets recovery via console
This is a workaround. It should be refined before cherry-picking to ToT.
FAFT emulates recovery boot by 'dut-control power_state:rec', which sets
EC_HOST_EVENT_KEYBOARD_RECOVERY via EC console. This patch adds a check
in the command so that BC 1.2 can be enabled in the emulated recovery
mode as well.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b/122896801
BRANCH=nami
TEST=Verify BC1.2 is enabled when 'dut-control power_state:rec' is run.
Change-Id: I120438eea353f66c7a62175d95fcd63bf53e6f45
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1549602
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | board/nami/board.c | 6 | ||||
-rw-r--r-- | common/host_event_commands.c | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/board/nami/board.c b/board/nami/board.c index 57b3d9d1e6..32f03d347b 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -976,7 +976,7 @@ struct keyboard_scan_config keyscan_config = { }, }; -static void bc12_enable(void) +void board_bc12_enable(void) { enum gpio_signal pin; /* This branch is only for 2nd gen.. No need to check SKU or MODEL. */ @@ -1056,7 +1056,7 @@ static void board_init(void) EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)) /* If recovery mode is being entered, enable BC1.2 for a USB * drive. */ - bc12_enable(); + board_bc12_enable(); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -1116,7 +1116,7 @@ int board_check_os_boot_power(void) if (is_low_power_boot_supported()) { if (!limit) /* Power is ready. Enable BC1.2 before booting OS */ - bc12_enable(); + board_bc12_enable(); } return limit; diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 2762a8bd56..7ebecdb482 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -418,6 +418,8 @@ test_mockable void host_throttle_cpu(int throttle) host_set_single_event(EC_HOST_EVENT_THROTTLE_STOP); } +void board_bc12_enable(void); + /*****************************************************************************/ /* Console commands */ static int command_host_event(int argc, char **argv) @@ -429,9 +431,12 @@ static int command_host_event(int argc, char **argv) if (*e) return EC_ERROR_PARAM2; - if (!strcasecmp(argv[1], "set")) + if (!strcasecmp(argv[1], "set")) { host_set_events(i); - else if (!strcasecmp(argv[1], "clear")) + if (host_get_events() & EC_HOST_EVENT_MASK( + EC_HOST_EVENT_KEYBOARD_RECOVERY)) + board_bc12_enable(); + } else if (!strcasecmp(argv[1], "clear")) host_clear_events(i); else if (!strcasecmp(argv[1], "clearb")) host_clear_events_b(i); |