summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.