summaryrefslogtreecommitdiff
path: root/driver/tcpm/it83xx.c
diff options
context:
space:
mode:
authorRuibin Chang <ruibin.chang@ite.com.tw>2020-03-16 14:45:07 +0800
committerCommit Bot <commit-bot@chromium.org>2020-03-18 05:24:57 +0000
commitf36f4247041b3781d27de40c2017b3d6b577cc6a (patch)
treefde3070611b32f4b1c0368a4adc3c83d352fbcdb /driver/tcpm/it83xx.c
parente2521fe6b22c6b267c453b9a02b036f51baaf95f (diff)
downloadchrome-ec-f36f4247041b3781d27de40c2017b3d6b577cc6a.tar.gz
driver/tcpm/it83xx: set cc polarity correctly
TCPM select POLARITY_CC1_DTS or POLARITY_CC2_DTS, it83xx driver always set CC2 polarity to register. We should set CC1 polarity to register for POLARITY_CC1_DTS, So I add a if condition to set cc polarity correctly. BUG=none BRANCH=none TEST=1.on board ampton with driver it83xx, plug-in debug accessory SNK, check cc polarity register setting same as enum case by console. 2.on board it8xxx2_pdevb with driver it8xxx2, plug-in debug accessory SNK, check cc polarity register setting same as enum case by console. Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: Ic42a1bf290e695040fd7f53e7f3b38ec829dd614 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2100560 Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Diffstat (limited to 'driver/tcpm/it83xx.c')
-rw-r--r--driver/tcpm/it83xx.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index e026503a51..2bbf0d18c4 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -483,7 +483,11 @@ static int it83xx_tcpm_set_cc(int port, int pull)
static int it83xx_tcpm_set_polarity(int port, enum tcpc_cc_polarity polarity)
{
- it83xx_select_polarity(port, polarity);
+ enum usbpd_cc_pin cc_pin =
+ (polarity == POLARITY_CC1 || polarity == POLARITY_CC1_DTS) ?
+ USBPD_CC_PIN_1 : USBPD_CC_PIN_2;
+
+ it83xx_select_polarity(port, cc_pin);
return EC_SUCCESS;
}