diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2023-02-23 15:04:48 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-17 18:19:39 +0000 |
commit | 74108a6ab365a110d70b4064ec2d99fa7ea9b73e (patch) | |
tree | 6195364b58322e9241c2868d09e5f4f98e2dc936 /test | |
parent | 230aa1bc412c8c40137d8980873be9eedc986d74 (diff) | |
download | chrome-ec-74108a6ab365a110d70b4064ec2d99fa7ea9b73e.tar.gz |
USB-PD: Make sink automatically enter EPR mode
Currently, EPR mode is entered only by 'pd' console command.
This CL makes sink ports enter EPR mode automatically.
PE_FLAGS_EPR_EXPLICIT_EXIT is cleared when soft reset is sent, a source
is disconnected, or EPR is entered again.
BUG=b:257320026,b:274929940
BRANCH=None
TEST=On Agah, plug AC, observe automatic entry to EPR. Then type 'pd 1
epr exit' and observe EPR mode is not re-entered. Then replug AC and
observe the port enters EPR automatically.
TEST=make run-usb_pd_console
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: Ie2b94323ba404d44ee70756e1893c065c34911fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4421425
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/usb_pd_console.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/usb_pd_console.c b/test/usb_pd_console.c index a835a643f8..119fe7131d 100644 --- a/test/usb_pd_console.c +++ b/test/usb_pd_console.c @@ -35,6 +35,7 @@ static bool pe_get_current_state_called; static bool pe_get_flags_called; static bool pe_is_explicit_contract_called; static bool pe_snk_in_epr_mode_called; +static bool pe_snk_epr_explicit_exit_called; static bool pd_get_dual_role_called; static bool board_get_usb_pd_port_count_called; static bool pd_srccaps_dump_called; @@ -86,6 +87,11 @@ bool pe_snk_in_epr_mode(int port) return true; } +void pe_snk_epr_explicit_exit(int port) +{ + pe_snk_epr_explicit_exit_called = true; +} + const char *pe_get_current_state(int port) { pe_get_current_state_called = true; @@ -726,18 +732,22 @@ static int test_command_pd_epr(void) request = 0; pd_get_power_role_called = false; pd_get_power_role_return = PD_ROLE_SINK; + pe_snk_epr_explicit_exit_called = false; TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); TEST_ASSERT(pd_get_power_role_called); TEST_ASSERT(request == DPM_REQUEST_EPR_MODE_ENTRY); + TEST_ASSERT(!pe_snk_epr_explicit_exit_called); /* Return SUCCESS with request==DPM_REQUEST_EPR_MODE_EXIT. */ argv[3] = "exit"; request = 0; pd_get_power_role_called = false; pd_get_power_role_return = PD_ROLE_SINK; + pe_snk_epr_explicit_exit_called = false; TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); TEST_ASSERT(pd_get_power_role_called); TEST_ASSERT(request == DPM_REQUEST_EPR_MODE_EXIT); + TEST_ASSERT(pe_snk_epr_explicit_exit_called); /* Return EC_ERROR_PARAM3 for invalid sub-command. */ argv[3] = "start"; |