summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2016-08-12 17:33:39 +0200
committerchrome-bot <chrome-bot@chromium.org>2016-08-16 00:58:08 -0700
commitb23470dab7878f3a93475369db4c43468e960dbf (patch)
treefd6a5ff45feb42369eae09cb3bbc68423b5ff077
parent2813413f3546462d7313be4e7430415999785b76 (diff)
downloadchrome-ec-b23470dab7878f3a93475369db4c43468e960dbf.tar.gz
pd: fix CC values in usb PD unittests
The if conditions to simulate the CC line levels had a couple of typos. Use a more realistic value for those corner cases. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=make run-usb_pd Change-Id: Ia924ee4cfe4512a7543cfcae4d532c9a250d9c8d Reviewed-on: https://chromium-review.googlesource.com/368720 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--test/usb_pd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/usb_pd.c b/test/usb_pd.c
index 2a8f73a684..ea68c66599 100644
--- a/test/usb_pd.c
+++ b/test/usb_pd.c
@@ -36,13 +36,11 @@ int pd_adc_read(int port, int cc)
pd_port[port].partner_role == PD_ROLE_SOURCE)
/* we are sink connected to source, return Rp/Open */
return (pd_port[port].partner_polarity == cc) ? 1700 : 0;
- else if (pd_port[port].host_mode &&
- pd_port[port].partner_role == PD_ROLE_SINK)
- /* both sources */
+ else if (pd_port[port].host_mode)
+ /* no sink on the other side, both CC are opened */
return 3000;
- else if (!pd_port[port].host_mode &&
- pd_port[port].partner_role == PD_ROLE_SOURCE)
- /* both sinks */
+ else if (!pd_port[port].host_mode)
+ /* no source on the other side, both CC are opened */
return 0;
/* should never get here */