summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-08-27 18:33:01 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-09-17 13:17:32 -0700
commit205ad4a23d805ebf997a00f0acf850a45da6fb72 (patch)
tree72e65304db6653d4976abc62dffe2621afd97724
parent0941ed98c2b6edfb0013a2c913bc0d863eac63f0 (diff)
downloadchrome-ec-205ad4a23d805ebf997a00f0acf850a45da6fb72.tar.gz
pd: Replace pd_set_drp_toggle() with exit_low_power_mode()
Replace pd_set_drp_toggle(port, 0) with exit_low_power_mode() that calls reset_device_and_notify() to ensure TCPC is out of standby. BRANCH=none BUG=b:111663127 TEST=PD and TCPC low power still work on Grunt Change-Id: I1a8f858040514e138e5bc712a998d1e8fc28e21f Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1194348 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/usb_pd_protocol.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 5c46774d85..f3acc7c3f4 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -485,6 +485,16 @@ void pd_wait_for_wakeup(int port)
task_wait_event_mask(TASK_EVENT_PD_AWAKE, -1);
}
}
+
+/* This is only called from the PD tasks that owns the port. */
+static void exit_low_power_mode(int port)
+{
+ if (pd[port].flags & PD_FLAGS_LPM_ENGAGED)
+ reset_device_and_notify(port);
+ else
+ request_low_power_mode(port, 0);
+}
+
#else /* !CONFIG_USB_PD_TCPC_LOW_POWER */
/* We don't need to notify anyone if low power mode isn't involved. */
@@ -2145,10 +2155,9 @@ static void pd_update_dual_role_config(int port)
tcpm_set_cc(port, TYPEC_CC_RP);
}
-#if defined(CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE) && \
- defined(CONFIG_USB_PD_TCPC_LOW_POWER)
+#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
/* When switching drp mode, make sure tcpc is out of standby mode */
- pd_set_drp_toggle(port, 0);
+ exit_low_power_mode(port);
#endif
}
@@ -3833,9 +3842,10 @@ void pd_task(void *u)
/* Anything else, keep toggling */
next_state = PD_STATE_DRP_AUTO_TOGGLE;
- if (next_state != PD_STATE_DRP_AUTO_TOGGLE) {
- pd_set_drp_toggle(port, 0);
- }
+#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
+ if (next_state != PD_STATE_DRP_AUTO_TOGGLE)
+ exit_low_power_mode(port);
+#endif
if (next_state == PD_STATE_SNK_DISCONNECTED) {
tcpm_set_cc(port, TYPEC_CC_RD);