summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-11-27 11:03:16 -0700
committerCommit Bot <commit-bot@chromium.org>2019-12-05 20:58:28 +0000
commit3dd62a63e18927d6f9c87fef6b5160d3f49d88d7 (patch)
tree416ea77919ba5bd4c1b277c2d92795ca4590c612 /common/usb_pd_protocol.c
parentbf0057e2bff9a68dc9a9f00d660193143d8233c0 (diff)
downloadchrome-ec-3dd62a63e18927d6f9c87fef6b5160d3f49d88d7.tar.gz
tcpci: POWER_CTRL auto discharge disconnect init
Change TCPCI to use HOOK_USB_PD_CONNECT/DISCONNECT to set/clear TCPC_REG_POWER_CTRL_AUTO_DISCHARGE_DISCONNECT according to the TCPCI spec. Change the definition of HOOK_USB_PD_CONNECT to occur after CC and VBus are stable. BUG=b:144126745,chromium:951683 BRANCH=none TEST=Charger attach/pull with AP not running Change-Id: I625efbba80f190322e3e92de6318b710b3ce7ade Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1940777
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index d4f6f0c06b..cee2c5ca0f 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -28,7 +28,6 @@
#include "usb_pd_tcpm.h"
#include "usb_pd_tcpc.h"
#include "usbc_ppc.h"
-#include "tcpm.h"
#include "version.h"
#include "vboot.h"
@@ -841,10 +840,10 @@ static inline void set_state(int port, enum pd_states next_state)
/* Invalidate message IDs. */
invalidate_last_message_id(port);
-#ifdef CONFIG_COMMON_RUNTIME
+
/* detect USB PD cc disconnect */
- hook_notify(HOOK_USB_PD_DISCONNECT);
-#endif
+ if (IS_ENABLED(CONFIG_COMMON_RUNTIME))
+ hook_notify(HOOK_USB_PD_DISCONNECT);
}
#ifdef CONFIG_LOW_POWER_IDLE
@@ -3314,9 +3313,6 @@ void pd_task(void *u)
break;
/* Debounce complete */
- if (IS_ENABLED(CONFIG_COMMON_RUNTIME))
- hook_notify(HOOK_USB_PD_CONNECT);
-
#ifdef CONFIG_USBC_PPC
/*
* If the port is latched off, just continue to
@@ -3400,6 +3396,10 @@ void pd_task(void *u)
PD_FLAGS_CHECK_DR_ROLE;
hard_reset_count = 0;
timeout = 5*MSEC;
+
+ if (IS_ENABLED(CONFIG_COMMON_RUNTIME))
+ hook_notify(HOOK_USB_PD_CONNECT);
+
set_state(port, PD_STATE_SRC_STARTUP);
}
/*
@@ -3965,8 +3965,6 @@ void pd_task(void *u)
}
/* We are attached */
- if (IS_ENABLED(CONFIG_COMMON_RUNTIME))
- hook_notify(HOOK_USB_PD_CONNECT);
pd[port].polarity = get_snk_polarity(cc1, cc2);
set_polarity(port, pd[port].polarity);
/* reset message ID on connection */
@@ -4001,6 +3999,8 @@ void pd_task(void *u)
&pd_usb_billboard_deferred_data,
PD_T_AME);
}
+ if (IS_ENABLED(CONFIG_COMMON_RUNTIME))
+ hook_notify(HOOK_USB_PD_CONNECT);
break;
case PD_STATE_SNK_HARD_RESET_RECOVER:
if (pd[port].last_state != pd[port].task_state)