summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2019-10-23 11:14:23 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-06 21:22:04 +0000
commit09fc255bb504d474ccfc93686c0da176fd2e2b32 (patch)
tree140dc477a8040c8a47f8d3e104dafbd5cf7639c3
parentdb19b33d8317aae2f30b9f1e7e0d845fcf99a07f (diff)
downloadchrome-ec-09fc255bb504d474ccfc93686c0da176fd2e2b32.tar.gz
servo_v4: Use the correct voltage threshold on the flipped CC direction
In the DTS mode, servo pulls up CC lines with different Rp values. When detecting DUT Rd value, servo senses the CC voltage values, and checks it using some table of voltage thresholds. The tables assume CC1 is the primary CC and CC2 is the alternative CC. When servo emulates the flipped CC scenario, should use the correct colume to check the voltage thresholds. BRANCH=servo BUG=b:136014621, b:140876537 TEST=Configed servo to emulate the flipped scenario in dts mode: > cc srcdts cc2 Verified it detect the correct Rd values in DUT (CC0 and CC1 are 2, i.e. TYPEC_CC_VOLT_RD): > tcpc 1 state Port C1, Ena - CC:1, CC0:2, CC1:2 Alert: 0x00 Mask: 0x007d Power Status: 0x48 Mask: 0x00 Without this patch, it detected wrong Rd values in DUT (CC0 is 2, i.e. TYPEC_CC_VOLT_RD, but CC1 is 0, i.e. TYPEC_CC_VOLT_OPEN): > tcpc 1 state Port C1, Ena - CC:1, CC0:2, CC1:0 Alert: 0x00 Mask: 0x007d Power Status: 0x48 Mask: 0x00 Change-Id: Iaf089356230f24f871636956780cb5652fec5c42 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1876800 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 8418697eb78692882b05da42059226e3dbfce159) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1902090
-rw-r--r--board/servo_v4/usb_pd_policy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c
index 08c2d5042c..ddc529ece0 100644
--- a/board/servo_v4/usb_pd_policy.c
+++ b/board/servo_v4/usb_pd_policy.c
@@ -370,7 +370,8 @@ int pd_tcpc_cc_nc(int port, int cc_volt, int cc_sel)
if (cc_config & CC_DISABLE_DTS)
nc = cc_volt >= pd_src_vnc[rp_index];
else
- nc = cc_volt >= pd_src_vnc_dts[rp_index][cc_sel];
+ nc = cc_volt >= pd_src_vnc_dts[rp_index][
+ cc_config & CC_POLARITY ? !cc_sel : cc_sel];
return nc;
}
@@ -396,7 +397,8 @@ int pd_tcpc_cc_ra(int port, int cc_volt, int cc_sel)
if (cc_config & CC_DISABLE_DTS)
ra = cc_volt < pd_src_rd_threshold[rp_index];
else
- ra = cc_volt < pd_src_rd_threshold_dts[rp_index][cc_sel];
+ ra = cc_volt < pd_src_rd_threshold_dts[rp_index][
+ cc_config & CC_POLARITY ? !cc_sel : cc_sel];
return ra;
}