diff options
author | Wai-Hong Tam <waihong@google.com> | 2019-10-23 11:14:23 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-06 19:30:25 +0000 |
commit | 8418697eb78692882b05da42059226e3dbfce159 (patch) | |
tree | b76799aaf1194efa27672c8b35ae417774280c72 /board/servo_v4 | |
parent | 14b13d302e715c23909ed5de5e6cfffc2e5c9f44 (diff) | |
download | chrome-ec-8418697eb78692882b05da42059226e3dbfce159.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>
Diffstat (limited to 'board/servo_v4')
-rw-r--r-- | board/servo_v4/usb_pd_policy.c | 6 |
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 1f42b1829a..bb171053bd 100644 --- a/board/servo_v4/usb_pd_policy.c +++ b/board/servo_v4/usb_pd_policy.c @@ -385,7 +385,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; } @@ -411,7 +412,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; } |