From c48408f0baf852671d8c87f1f64890201335e1df Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Tue, 26 Jul 2016 11:07:52 +0200 Subject: [PATCH] pd: support CCD provided by an external chip When the case close debug (CCD) feature is provided by an external chip (e.g security chip or TCPC), we still need to be able to detect debug accessory with Rd/Rd (by setting Rp/Rp when VBUS is detected without seeing Rp). Add a CONFIG_CASE_CLOSED_DEBUG_EXTERNAL configuration parameter for this case. Signed-off-by: Vincent Palatin BRANCH=none BUG=chrome-os-partner:55410 TEST=manual:on Kevin, enable CONFIG_CASE_CLOSED_DEBUG_EXTERNAL, plug a SuzyQ (with Rd/Rd) and verify that the device in debug mode when transitioning to S5. Change-Id: Ie04a000a7b0eb670e3808f7bca1180298dfcd9db Reviewed-on: https://chromium-review.googlesource.com/363400 Commit-Ready: Vincent Palatin Tested-by: Vincent Palatin Reviewed-by: Shawn N --- common/usb_pd_protocol.c | 6 ++++-- include/config.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 2b6d39fd82..ff88980f5f 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -234,7 +234,8 @@ static inline int pd_is_vbus_present(int port) static int pd_snk_debug_acc_toggle(int port) { -#ifdef CONFIG_CASE_CLOSED_DEBUG +#if defined(CONFIG_CASE_CLOSED_DEBUG) || \ +defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL) /* * when we are in SNK_DISCONNECTED and we see VBUS appearing * (without having seen Rp before), that might be a powered debug @@ -249,7 +250,8 @@ static int pd_snk_debug_acc_toggle(int port) static int pd_debug_acc_plugged(int port) { -#ifdef CONFIG_CASE_CLOSED_DEBUG +#if defined(CONFIG_CASE_CLOSED_DEBUG) || \ +defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL) return pd[port].task_state == PD_STATE_SRC_ACCESSORY; #else /* Debug accessories not supported */ diff --git a/include/config.h b/include/config.h index d868d5671e..d3b15932cf 100644 --- a/include/config.h +++ b/include/config.h @@ -312,9 +312,11 @@ #undef CONFIG_BUTTON_COUNT /* - * Enable case close debug (CCD) mode. + * Enable case close debug (CCD) mode in the EC. */ #undef CONFIG_CASE_CLOSED_DEBUG +/* The case close debug (CCD) feature is provided by an external chip. */ +#undef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL /* * Capsense chip has buttons, too.