diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2016-08-19 12:18:13 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-25 01:46:06 -0700 |
commit | 7e4564a87e2687aa958e4eb92d758359b6a66eee (patch) | |
tree | 76d81968551343ff428c047191b98c22678315f2 | |
parent | 6fefca3d6acc0ea5b5adebabd8593ed17265f5c8 (diff) | |
download | chrome-ec-7e4564a87e2687aa958e4eb92d758359b6a66eee.tar.gz |
tcpm: workaround TCPC takes longer time to update CC status
when TCPC takes a longer time to update its CC status upon
connection, a legacy C-to-A charger or certain Type-C charger
that presents 5V VBUS by default, TCPM could be mistaken the
charger as a debug accessory.
BUG=chrome-os-partner:55980
BRANCH=none
TEST=Manually tested on Reef. PD, Type-C, BC1.2, non-BC1.2,
DP, HDMI are working on both C-ports.
Change-Id: Ic3b0ecd3d14109239d8c0ff0064476595b7f93a0
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/367950
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/reef/board.h | 1 | ||||
-rw-r--r-- | common/usb_pd_protocol.c | 14 | ||||
-rw-r--r-- | include/config.h | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/board/reef/board.h b/board/reef/board.h index 8305e997c9..282e766ecc 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -69,6 +69,7 @@ #define CONFIG_USB_PD_LOG_SIZE 512 #define CONFIG_USB_PD_PORT_COUNT 2 #define CONFIG_USB_PD_PULLUP_1_5A +#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */ #define CONFIG_USB_PD_TCPM_ANX74XX diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 2f07d292e0..38f48fe69e 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -245,12 +245,26 @@ static int pd_snk_debug_acc_toggle(int port) { #if defined(CONFIG_CASE_CLOSED_DEBUG) || \ defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL) +#ifdef CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS + static int possible_debug_acc[CONFIG_USB_PD_PORT_COUNT]; + int vbus = pd_is_vbus_present(port); + int result; + + /* reset debouncing of Rd/Rd debug accessory presence */ + if ((pd[port].last_state != PD_STATE_SNK_DISCONNECTED) || !vbus) + possible_debug_acc[port] = 0; + /* returns if it was possibly present in the previous iteration */ + result = possible_debug_acc[port]; + possible_debug_acc[port] = vbus; + return result; +#else /* !CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS */ /* * when we are in SNK_DISCONNECTED and we see VBUS appearing * (without having seen Rp before), that might be a powered debug * accessory, let's toggle to source to try to detect it. */ return pd_is_vbus_present(port); +#endif /* !CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS */ #else /* Debug accessories not supported, never toggle */ return 0; diff --git a/include/config.h b/include/config.h index 2abb6df74c..40926e47b1 100644 --- a/include/config.h +++ b/include/config.h @@ -1964,6 +1964,9 @@ /* Number of USB PD ports */ #undef CONFIG_USB_PD_PORT_COUNT +/* Workaround TCPC that takes longer time to update CC status */ +#undef CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS + /* Simple DFP, such as power adapter, will not send discovery VDM on connect */ #undef CONFIG_USB_PD_SIMPLE_DFP |