summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuibin Chang <Ruibin.Chang@ite.com.tw>2018-08-15 18:16:34 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-29 01:37:55 -0700
commit2c520a2a424bf57e7e626273d0c5b5dfc6acd1d6 (patch)
treeb1e823be4c6968b0341ea3472790692a87bbcfe6
parent5496a29d847d4fc2383ec68a6b371b3fa0e445e0 (diff)
downloadchrome-ec-2c520a2a424bf57e7e626273d0c5b5dfc6acd1d6.tar.gz
common:pd: GRL-USB-PD TDA2.2.9 test fail issue
When our SRC port is in SRC_READY state, the SNK send GET_SRC_CAP to us. Our SRC port sends SRC_CAP, but it doesn't wait power request just transit to SRC_READY state immediately. According to 8.3.3.2 SRC state diagram of PD3.0 spec, when SRC pd port receive GET_SRC_CAP in SRC_READY state, it should send SRC_CAP and then transit to SRC_NEGOCIATE state for waiting power request from SNK. With this modify it can solve GRL-USB-PD compliance TDA2.2.9 test fail issue. BUG=none BRANCH=none TEST=GRL-USB-PD compliance test. Change-Id: I1fe0c59e5a08863b360bbb3731c3620a4f23c1bf Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/1170722 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/usb_pd_protocol.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 79f66aa57b..c0dc2be3d0 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1512,10 +1512,14 @@ static void handle_ctrl_request(int port, uint16_t head,
/* Nothing else to do */
break;
case PD_CTRL_GET_SOURCE_CAP:
- res = send_source_cap(port);
- if ((res >= 0) &&
- (pd[port].task_state == PD_STATE_SRC_DISCOVERY))
- set_state(port, PD_STATE_SRC_NEGOCIATE);
+ if (pd[port].task_state == PD_STATE_SRC_READY)
+ set_state(port, PD_STATE_SRC_DISCOVERY);
+ else {
+ res = send_source_cap(port);
+ if ((res >= 0) &&
+ (pd[port].task_state == PD_STATE_SRC_DISCOVERY))
+ set_state(port, PD_STATE_SRC_NEGOCIATE);
+ }
break;
case PD_CTRL_GET_SINK_CAP:
#ifdef CONFIG_USB_PD_DUAL_ROLE