From 7fa6d703897701d76e4ca67b5f8299378527c226 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 7 Sep 2017 13:49:39 -0700 Subject: pd: Remove support for debug accessories that provide VBUS + Rd Reworked suzy-q and suzy-qable all provide Rp, so there is no need for special detection handling in S5. Also, CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS is no longer relevant, since we no longer take special action when VBUS is seen without Rp. BUG=chromium:737755 BRANCH=None TEST=On kevin, verify reworked suzy-q and suzy-qable are detected in S5. Also, verify zinger works in S5 on reef. Signed-off-by: Shawn Nematbakhsh Change-Id: I50967bd6415d964a038b2e7d134374132eda11ec Reviewed-on: https://chromium-review.googlesource.com/656067 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Vincent Palatin Reviewed-on: https://chromium-review.googlesource.com/739993 --- board/eve/board.h | 1 - board/pyro/board.h | 1 - board/reef/board.h | 1 - board/snappy/board.h | 1 - common/usb_pd_protocol.c | 41 +++-------------------------------------- include/config.h | 3 --- 6 files changed, 3 insertions(+), 45 deletions(-) diff --git a/board/eve/board.h b/board/eve/board.h index 2299bf189f..7235ea163d 100644 --- a/board/eve/board.h +++ b/board/eve/board.h @@ -124,7 +124,6 @@ #define CONFIG_USB_PD_LOG_SIZE 512 #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 #define CONFIG_USB_PD_PORT_COUNT 2 -#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_FW_VERSION #define CONFIG_USB_PD_TCPM_MUX diff --git a/board/pyro/board.h b/board/pyro/board.h index 2f8b90a9b8..0ddfb2b572 100644 --- a/board/pyro/board.h +++ b/board/pyro/board.h @@ -89,7 +89,6 @@ #define CONFIG_USB_PD_LOG_SIZE 512 #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 #define CONFIG_USB_PD_PORT_COUNT 2 -#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPC_FW_VERSION diff --git a/board/reef/board.h b/board/reef/board.h index 00e30eba6a..d30a158d36 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -93,7 +93,6 @@ #define CONFIG_USB_PD_LOG_SIZE 512 #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 #define CONFIG_USB_PD_PORT_COUNT 2 -#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPC_FW_VERSION diff --git a/board/snappy/board.h b/board/snappy/board.h index 2a832fdef2..c6673ae719 100644 --- a/board/snappy/board.h +++ b/board/snappy/board.h @@ -88,7 +88,6 @@ #define CONFIG_USB_PD_LOG_SIZE 512 #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 #define CONFIG_USB_PD_PORT_COUNT 2 -#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS #define CONFIG_USB_PD_VBUS_DETECT_CHARGER #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPC_FW_VERSION diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 323e42c54d..31c56c87db 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -247,36 +247,6 @@ static inline int pd_is_vbus_present(int port) #endif } -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; -#endif -} - static int pd_debug_acc_plugged(int port) { #ifdef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL @@ -2197,14 +2167,9 @@ void pd_task(void) break; } - /* - * If no source detected, check for role toggle. - * If VBUS is detected, and we are in the debug - * accessory toggle state, then allow toggling. - */ - if ((drp_state == PD_DRP_TOGGLE_ON && - get_time().val >= next_role_swap) || - pd_snk_debug_acc_toggle(port)) { + /* If no source detected, check for role toggle. */ + if (drp_state == PD_DRP_TOGGLE_ON && + get_time().val >= next_role_swap) { /* Swap roles to source */ pd[port].power_role = PD_ROLE_SOURCE; set_state(port, PD_STATE_SRC_DISCONNECTED); diff --git a/include/config.h b/include/config.h index 52918490b0..d461e2e770 100644 --- a/include/config.h +++ b/include/config.h @@ -2101,9 +2101,6 @@ /* 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 -- cgit v1.2.1