summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-09-07 14:56:08 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-10-05 10:36:14 -0700
commit1e72cc1f5719d5c5df6dbe76a8c86f60a525fe1a (patch)
treea0b90021330e7f8495f351d65e69504a1548f7af /common
parent7dc3066837aaaa565af5df2e1433d7564d43220b (diff)
downloadchrome-ec-1e72cc1f5719d5c5df6dbe76a8c86f60a525fe1a.tar.gz
cleanup: pd: Remove CONFIG_CASE_CLOSED_DEBUG
CONFIG_CASE_CLOSED_DEBUG (CCD functionality implemented by EC) is no longer used in conjunction with CONFIG_USB_POWER_DELIVERY, and the common routines are only used by one board. BUG=chromium:737755 BRANCH=None TEST=`make buildall -j` Change-Id: Idc3d2fccef6cbec2af786cef634d752a02a0e859 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/656315 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/build.mk1
-rw-r--r--common/case_closed_debug.c72
-rw-r--r--common/usb_pd_protocol.c26
3 files changed, 6 insertions, 93 deletions
diff --git a/common/build.mk b/common/build.mk
index 1600bcfbea..6ef6c25889 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -33,7 +33,6 @@ common-$(CONFIG_BLUETOOTH_LE)+=bluetooth_le.o
common-$(CONFIG_BLUETOOTH_LE_STACK)+=btle_hci_controller.o btle_ll.o
common-$(CONFIG_BUTTON_COUNT)+=button.o
common-$(CONFIG_CAPSENSE)+=capsense.o
-common-$(CONFIG_CASE_CLOSED_DEBUG)+=case_closed_debug.o
common-$(CONFIG_CASE_CLOSED_DEBUG_V1)+=ccd_config.o
common-$(CONFIG_CHARGE_MANAGER)+=charge_manager.o
common-$(CONFIG_CHARGE_RAMP)+=charge_ramp.o
diff --git a/common/case_closed_debug.c b/common/case_closed_debug.c
deleted file mode 100644
index e35ed89fe9..0000000000
--- a/common/case_closed_debug.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Case Closed Debug common implementation
- */
-
-#include "case_closed_debug.h"
-
-#include "common.h"
-#include "usb_api.h"
-#include "usb_console.h"
-#include "usb_spi.h"
-
-#if !defined(CONFIG_USB)
-#error "CONFIG_USB must be defined to use Case Closed Debugging"
-#endif
-
-#if !defined(CONFIG_USB_CONSOLE)
-#error "CONFIG_USB_CONSOLE must be defined to use Case Closed Debugging"
-#endif
-
-#if !defined(CONFIG_USB_INHIBIT_INIT)
-#error "CONFIG_USB_INHIBIT_INIT must be defined to use Case Closed Debugging"
-#endif
-
-#if defined(CONFIG_USB_SPI)
-USB_SPI_CONFIG(ccd_usb_spi, USB_IFACE_SPI, USB_EP_SPI);
-#endif
-
-static enum ccd_mode current_mode = CCD_MODE_COUNT;
-
-void ccd_set_mode(enum ccd_mode new_mode)
-{
- if (new_mode == current_mode)
- return;
-
-#ifndef CONFIG_USB_SELECT_PHY
- if (current_mode != CCD_MODE_DISABLED)
-#endif
- usb_release();
-
- current_mode = new_mode;
-
- /*
- * The forwarding of the local console over USB is read-only
- * if we are not in the fully enabled mode.
- */
- usb_console_enable(new_mode != CCD_MODE_DISABLED,
- new_mode != CCD_MODE_ENABLED);
-
-#if defined(CONFIG_USB_SPI)
- usb_spi_enable(&ccd_usb_spi, new_mode == CCD_MODE_ENABLED);
-#endif
-
-#ifdef CONFIG_USB_SELECT_PHY
- ccd_phy_init(new_mode != CCD_MODE_DISABLED);
-#else
- if (new_mode != CCD_MODE_DISABLED)
- usb_init();
-#endif
-}
-
-enum ccd_mode ccd_get_mode(void)
-{
- return current_mode;
-}
-
-int ccd_ext_is_enabled(void)
-{
- return ccd_get_mode() == CCD_MODE_ENABLED;
-}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index ffbf9d8956..ac6c081d31 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -257,8 +257,7 @@ static inline int pd_is_vbus_present(int port)
static int pd_debug_acc_plugged(int port)
{
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || \
-defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL)
+#ifdef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
return pd[port].task_state == PD_STATE_SRC_ACCESSORY ||
pd[port].task_state == PD_STATE_SNK_ACCESSORY;
#else
@@ -1950,15 +1949,12 @@ void pd_task(void *u)
/* Set the USB muxes and the default USB role */
pd_set_data_role(port, CONFIG_USB_PD_DEBUG_DR);
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || defined(CONFIG_USB_PD_DTS)
+#ifdef CONFIG_USB_PD_DTS
if (new_cc_state == PD_CC_DEBUG_ACC) {
ccd_set_mode(system_is_locked() ?
CCD_MODE_PARTIAL :
CCD_MODE_ENABLED);
- }
-#endif
-#ifdef CONFIG_USB_PD_DTS
- if (new_cc_state == PD_CC_DEBUG_ACC) {
+
/* Enable Vbus */
pd_set_power_supply_ready(port);
/* Captive cable, CC1 always */
@@ -1992,7 +1988,7 @@ void pd_task(void *u)
(cc1 != TYPEC_CC_VOLT_RD ||
cc2 != TYPEC_CC_VOLT_RD))) {
set_state(port, PD_STATE_SRC_DISCONNECTED);
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || defined(CONFIG_USB_PD_DTS)
+#ifdef CONFIG_USB_PD_DTS
ccd_set_mode(CCD_MODE_DISABLED);
#endif
timeout = 10*MSEC;
@@ -2467,16 +2463,9 @@ void pd_task(void *u)
&pd_usb_billboard_deferred_data,
PD_T_AME);
}
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || \
-defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL)
- else if (new_cc_state == PD_CC_DEBUG_ACC) {
-#ifdef CONFIG_CASE_CLOSED_DEBUG
- ccd_set_mode(system_is_locked() ?
- CCD_MODE_PARTIAL :
- CCD_MODE_ENABLED);
-#endif
+#ifdef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
+ else if (new_cc_state == PD_CC_DEBUG_ACC)
set_state(port, PD_STATE_SNK_ACCESSORY);
- }
break;
case PD_STATE_SNK_ACCESSORY:
/* debug accessory state */
@@ -2487,9 +2476,6 @@ defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL)
/* If accessory becomes detached */
if (!cc_is_rp(cc1) || !cc_is_rp(cc2)) {
set_state(port, PD_STATE_SNK_DISCONNECTED);
-#ifdef CONFIG_CASE_CLOSED_DEBUG
- ccd_set_mode(CCD_MODE_DISABLED);
-#endif
timeout = 10*MSEC;
}
#endif