diff options
author | Edward Hill <ecgh@chromium.org> | 2018-08-27 18:33:01 -0600 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-09-18 15:38:18 +0000 |
commit | 832107384ef71a5b04db3aaed320d2655dd7a3af (patch) | |
tree | 4bdaeccbcc97fb6d9a24fe03fc2e62a58cb6220e | |
parent | 7de15bc5ff5e788fcd6c7288b48c466dab956139 (diff) | |
download | chrome-ec-832107384ef71a5b04db3aaed320d2655dd7a3af.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>
Reviewed-on: https://chromium-review.googlesource.com/1230995
Reviewed-by: Martin Roth <martinroth@chromium.org>
Commit-Queue: Martin Roth <martinroth@chromium.org>
Tested-by: Martin Roth <martinroth@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index f21f0a739f..0c3ea13aad 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. */ @@ -2140,10 +2150,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 } @@ -3828,9 +3837,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); |