summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuibin Chang <Ruibin.Chang@ite.com.tw>2021-12-07 18:33:17 +0800
committerCommit Bot <commit-bot@chromium.org>2021-12-17 04:20:43 +0000
commited62e258393049c8da6ccd3ded8ac67e0cea58eb (patch)
treee20ca78e3cbaadf87296ed5a2d7ffa524b411150
parent0283c73bc51f0e271b848df9db536492a512d906 (diff)
downloadchrome-ec-ed62e258393049c8da6ccd3ded8ac67e0cea58eb.tar.gz
TCPMv2: don't set the sleep mask for TCPC embedded in EC
Don't set the sleep mask for TCPC embedded in EC, ex.ITE it83xx and it8xxx2 series. So I create a overridable tc_update_pd_sleep_mask() function for ITE to implement. BUG=none BRANCH=none TEST=make build all Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I331115d107240da827f5b391fcd3a94a84f086c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3329641 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c13
-rw-r--r--include/usb_tc_sm.h9
2 files changed, 19 insertions, 3 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 9e03875eb0..726958ba03 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -825,6 +825,10 @@ int tc_is_attached_snk(int port)
return IS_ATTACHED_SNK(port);
}
+__overridable void tc_update_pd_sleep_mask(int port)
+{
+}
+
void tc_pd_connection(int port, int en)
{
if (en) {
@@ -836,9 +840,10 @@ void tc_pd_connection(int port, int en)
TC_SET_FLAG(port, TC_FLAGS_PARTNER_PD_CAPABLE);
/* If a PD device is attached then disable deep sleep */
if (IS_ENABLED(CONFIG_LOW_POWER_IDLE) &&
- !IS_ENABLED(CONFIG_USB_PD_TCPC_ON_CHIP)) {
+ IS_ENABLED(CONFIG_USB_PD_TCPC_ON_CHIP))
+ tc_update_pd_sleep_mask(port);
+ else if (IS_ENABLED(CONFIG_LOW_POWER_IDLE))
disable_sleep(SLEEP_MASK_USB_PD);
- }
/*
* Update the mux state, only when the PD capable flag
@@ -852,7 +857,9 @@ void tc_pd_connection(int port, int en)
TC_CLR_FLAG(port, TC_FLAGS_PARTNER_PD_CAPABLE);
/* If a PD device isn't attached then enable deep sleep */
if (IS_ENABLED(CONFIG_LOW_POWER_IDLE) &&
- !IS_ENABLED(CONFIG_USB_PD_TCPC_ON_CHIP)) {
+ IS_ENABLED(CONFIG_USB_PD_TCPC_ON_CHIP))
+ tc_update_pd_sleep_mask(port);
+ else if (IS_ENABLED(CONFIG_LOW_POWER_IDLE)) {
int i;
/* If all ports are not connected, allow the sleep */
diff --git a/include/usb_tc_sm.h b/include/usb_tc_sm.h
index 80a69279a2..4aaacd522b 100644
--- a/include/usb_tc_sm.h
+++ b/include/usb_tc_sm.h
@@ -181,6 +181,15 @@ void tc_request_power_swap(int port);
void tc_pr_swap_complete(int port, bool success);
/**
+ * The Type-C state machine updates the SLEEP_MASK_USB_PD mask for the
+ * case that TCPC wants to set/clear SLEEP_MASK_USB_PD mask only by
+ * itself, ex. TCPC embedded in EC.
+ *
+ * @param port USB_C port number
+ */
+__override_proto void tc_update_pd_sleep_mask(int port);
+
+/**
* Instructs the Attached.SNK to stop drawing power. This function is called
* from the Policy Engine and only has effect if the current Type-C state
* Attached.SNK.