From a2721a2e518b93d6bf0041dc85be985bd211505a Mon Sep 17 00:00:00 2001 From: "Brian J. Nemec" Date: Tue, 22 Dec 2020 06:25:49 -0800 Subject: USB: Remove DTS identification from USB PD polarity We've added differentiation for DTS polarity and normal device polarity. These values were being passed to the pd[port].polarity fields. This creates problems for the usb_pd_config.h files which operate on the assumption that polarity is a boolean value of 0 or 1. In the case of ternary blocks that follow the format of: 'polarity ? A | B', if polarity is 'POLARITY_CC1_DTS = 2' we are incorrectly identifying it as flipped. Other usages like Servo_v4 which have lookup arrays like: tx_gpio[port][polarity]. In these cases, the DTS polarities point to garbage memory and generate hard-faults. BRANCH=none BUG=b:176154334 TEST=Connect to servo console and run 'cc snkdts' Validate that the servo did not hard-fault, instead loads a valid configuration. Signed-off-by: Brian Nemec Change-Id: If5ed079fee9e91dbf291e1f210762c298948ad1e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600657 Reviewed-by: Denis Brockus --- driver/tcpm/stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/tcpm/stub.c b/driver/tcpm/stub.c index 399676cf5c..db2b272048 100644 --- a/driver/tcpm/stub.c +++ b/driver/tcpm/stub.c @@ -65,7 +65,7 @@ int tcpm_set_cc(int port, int pull) int tcpm_set_polarity(int port, enum tcpc_cc_polarity polarity) { - return tcpc_set_polarity(port, polarity); + return tcpc_set_polarity(port, polarity_rm_dts(polarity)); } int tcpm_set_vconn(int port, int enable) -- cgit v1.2.1