diff options
author | Vic Yang <victoryang@chromium.org> | 2014-08-05 01:54:55 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-07 22:41:35 +0000 |
commit | 68916bc7d8ec14f6703478e0f86b0c9fce40b8a8 (patch) | |
tree | f1745ac5b32084b798cb8614ff639e62a82091f7 | |
parent | 43b75cc5864f7d39212c306fcb31b7f79c430ad2 (diff) | |
download | chrome-ec-68916bc7d8ec14f6703478e0f86b0c9fce40b8a8.tar.gz |
pd: hard reset if we get unexpected PS_RDY
If we are in SNK_DISCOVERY state and get PD_RDY, we are not sure what
the power source is. In this case, instead of happily go to SNK_READY
state, we should do a hard reset to be safe.
BUG=None
TEST=Check PD on samus/zinger still works.
BRANCH=None
Change-Id: I2baca06d45ba41e30d2ccf7a02fb65eb3966e5c1
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210925
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 3e1fd1bf75..45a5f9a1c5 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -671,7 +671,10 @@ static void handle_ctrl_request(int port, uint16_t head, case PD_CTRL_GOTO_MIN: break; case PD_CTRL_PS_RDY: - if (pd[port].role == PD_ROLE_SINK) + if (pd[port].task_state == PD_STATE_SNK_DISCOVERY) + /* Don't know what power source is ready. Reset. */ + set_state(port, PD_STATE_HARD_RESET); + else if (pd[port].role == PD_ROLE_SINK) set_state(port, PD_STATE_SNK_READY); break; case PD_CTRL_REJECT: |