summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2019-12-05 13:27:51 -0700
committerCommit Bot <commit-bot@chromium.org>2019-12-06 00:16:45 +0000
commitcbdbbd39df55ecd582fbcd4f566015bcc2c72770 (patch)
tree1cdb9e7c8739759e03f668ed89b31e3ec296ecaa /common/usb_pd_protocol.c
parenta018043265ecb3466863ff9020ab25d552105c61 (diff)
downloadchrome-ec-cbdbbd39df55ecd582fbcd4f566015bcc2c72770.tar.gz
usbc: Move PPC overcurrent functions to usb_common.c
Share single copy of PPC overcurrent functions between TCPMv1 and TCPMv2. BUG=none BRANCH=none TEST=build Change-Id: I70e25e8580f6bbfebe6269552cd186f3bb981ede Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1954305 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index cee2c5ca0f..ff7d6eb045 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -5035,57 +5035,6 @@ void pd_update_contract(int port)
#endif /* CONFIG_USB_PD_DUAL_ROLE */
-#ifdef CONFIG_USBC_PPC
-static void pd_send_hard_reset(int port)
-{
- task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_SEND_HARD_RESET, 0);
-}
-
-static uint32_t port_oc_reset_req;
-
-static void re_enable_ports(void)
-{
- uint32_t ports = atomic_read_clear(&port_oc_reset_req);
-
- while (ports) {
- int port = __fls(ports);
-
- ports &= ~BIT(port);
-
- /*
- * Let the board know that the overcurrent is
- * over since we're going to attempt re-enabling
- * the port.
- */
- board_overcurrent_event(port, 0);
-
- pd_send_hard_reset(port);
- /*
- * TODO(b/117854867): PD3.0 to send an alert message
- * indicating OCP after explicit contract.
- */
- }
-}
-DECLARE_DEFERRED(re_enable_ports);
-
-void pd_handle_overcurrent(int port)
-{
- /* Keep track of the overcurrent events. */
- CPRINTS("C%d: overcurrent!", port);
-#ifdef CONFIG_USB_PD_LOGGING
- pd_log_event(PD_EVENT_PS_FAULT, PD_LOG_PORT_SIZE(port, 0), PS_FAULT_OCP,
- NULL);
-#endif /* defined(CONFIG_USB_PD_LOGGING) */
- ppc_add_oc_event(port);
- /* Let the board specific code know about the OC event. */
- board_overcurrent_event(port, 1);
-
- /* Wait 1s before trying to re-enable the port. */
- atomic_or(&port_oc_reset_req, BIT(port));
- hook_call_deferred(&re_enable_ports_data, SECOND);
-}
-#endif /* defined(CONFIG_USBC_PPC) */
-
static int command_pd(int argc, char **argv)
{
int port;