diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-06-27 11:27:48 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-04 05:43:46 -0700 |
commit | dcd973e2f44cd475587aaf3cdd37e14add2ef280 (patch) | |
tree | ecb331648ab42e7e1b91a3d465d87f20f49fa86d /common | |
parent | 62c0a7e74cac24cc24a3d0f1876bed598eb8e2a5 (diff) | |
download | chrome-ec-dcd973e2f44cd475587aaf3cdd37e14add2ef280.tar.gz |
USB PD: Don't restore the default power state.
Now, the PD state machine will try and issue a Soft Reset if the port
was previously in an explicit contract prior to the EC resetting.
However, there was a bug where the state machine would actually restore
the default power role instead of the actual power role that was stored
in in battery-backed RAM.
This commit fixes that bug by simply setting the default power role if
and only if it hasn't been set already by going down the Soft Reset code
path.
BUG=None
BRANCH=None
TEST=flash nocturne, verify that soft reset path works.
Change-Id: Ia2baeda2674c6febf4c8c04496a131698099dcdc
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1117368
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_protocol.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 567d9240d9..e9525cb547 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2228,8 +2228,6 @@ void pd_task(void *u) usb_mux_init(port); #endif - /* Initialize PD protocol state variables for each port. */ - pd_set_power_role(port, PD_ROLE_DEFAULT(port)); #ifdef CONFIG_USB_PD_DUAL_ROLE /* * If there's an explicit contract in place, let's restore the data and @@ -2265,7 +2263,11 @@ void pd_task(void *u) } } #endif /* defined(CONFIG_USB_PD_DUAL_ROLE) */ + /* Set the power role if we haven't already. */ + if (this_state != PD_STATE_SOFT_RESET) + pd_set_power_role(port, PD_ROLE_DEFAULT(port)); + /* Initialize PD protocol state variables for each port. */ pd[port].vdm_state = VDM_STATE_DONE; set_state(port, this_state); #ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT |