diff options
author | Diana Z <dzigterman@chromium.org> | 2020-11-16 14:06:35 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-18 18:16:20 +0000 |
commit | 511500d64d7f781c7363b2262bc2783883d26d99 (patch) | |
tree | 97986e3816a67cc26255b1f22fc532cde24c63ab /driver/tcpm/it83xx.c | |
parent | ae7a3b0270447ddd484c444b171c1c44656683e7 (diff) | |
download | chrome-ec-511500d64d7f781c7363b2262bc2783883d26d99.tar.gz |
TCPC: Change SOP' disable interface
Add the ability to enable or disable SOP' traffic through a new
parameter. Name the function for "enable" to match other EC
conventions.
BRANCH=None
BUG=b:168560801
TEST=make -j buildall
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ife52e7d7d098825ab2163c70a4c59510da958876
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542864
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'driver/tcpm/it83xx.c')
-rw-r--r-- | driver/tcpm/it83xx.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c index adeda27b3f..5a46742be9 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -556,10 +556,15 @@ static int it83xx_tcpm_set_polarity(int port, enum tcpc_cc_polarity polarity) return EC_SUCCESS; } -__maybe_unused static int it83xx_tcpm_decode_sop_prime_disable(int port) +__maybe_unused static int it83xx_tcpm_decode_sop_prime_enable(int port, + bool enable) { - IT83XX_USBPD_PDMSR(port) &= ~(USBPD_REG_MASK_SOPP_ENABLE | - USBPD_REG_MASK_SOPPP_ENABLE); + if (enable) + IT83XX_USBPD_PDMSR(port) |= (USBPD_REG_MASK_SOPP_ENABLE | + USBPD_REG_MASK_SOPPP_ENABLE); + else + IT83XX_USBPD_PDMSR(port) &= ~(USBPD_REG_MASK_SOPP_ENABLE | + USBPD_REG_MASK_SOPPP_ENABLE); return EC_SUCCESS; } @@ -592,7 +597,8 @@ static int it83xx_tcpm_set_vconn(int port, int enable) if (!enable) { /* Disable tcpc receive SOP' and SOP'' packet */ if (IS_ENABLED(CONFIG_USB_PD_DECODE_SOP)) - it83xx_tcpm_decode_sop_prime_disable(port); + it83xx_tcpm_decode_sop_prime_enable(port, + false); /* * We need to make sure cc voltage detector is enabled * after vconn is turned off to avoid the potential risk @@ -831,7 +837,7 @@ const struct tcpm_drv it83xx_tcpm_drv = { .set_cc = &it83xx_tcpm_set_cc, .set_polarity = &it83xx_tcpm_set_polarity, #ifdef CONFIG_USB_PD_DECODE_SOP - .sop_prime_disable = &it83xx_tcpm_decode_sop_prime_disable, + .sop_prime_enable = &it83xx_tcpm_decode_sop_prime_enable, #endif .set_vconn = &it83xx_tcpm_set_vconn, .set_msg_header = &it83xx_tcpm_set_msg_header, |