diff options
author | Scott Collyer <scollyer@google.com> | 2019-08-01 14:10:07 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-01 08:43:00 +0000 |
commit | c44112f2d8c9d4623970eac033efb4cd84badc1b (patch) | |
tree | cde24738b75f9678a81e6f286fcbb1d53361b02f /common | |
parent | 243e69b71488b31d1b631fceca7d82cc88746f77 (diff) | |
download | chrome-ec-c44112f2d8c9d4623970eac033efb4cd84badc1b.tar.gz |
pd: Don't request LPM in DRP_TOGGLE if cc is not open
Currently, LPM_REQUESTED flag is always set in the DRP_AUTO_TOGGLE
state. This is true even when the next state will be SNK_DISCONNECTED
or SRC_DISCONNECTED. This setting makes sense for SNK_DISCONNECTED as
when the AP is not in S0, then auto toggling will be disabled so the
PD state machine should remain in SNK_DISCONNECTED until something is
attached.
But for the transition from DRP_TOGGLE to SRC_DISCONNECTED
should only happen when either an adapter gets attached while the AP
is in S0, or the chipset enters S0 with an adapter already attached.
This 2nd case is problematic as if LPM_REQUESTED is set and there is
no CC event pending, the PD task will get suspended (wait = -1) and
therefore remain in SRC_DISCONNECTED.
This CL modifies the existing logic to not set LPM_REQUESTED when
something is attached as given by the CC1 and CC2 values.
BUG=b:137697655, b:172985020
BRANCH=none
TEST=Tested both EC reboot and resume from suspend with a USB stick
connected via a type C->A adapter and verified that the PD state
machine advances to PD_STATE_SRC_DISCOVERY as expected and the USB
stick enumerates.
Change-Id: I6afbd642ce38134ddabd20f7dc5e15f937b9810a
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730967
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Scott Collyer <scollyer@chromium.org>
(cherry picked from commit bda667fd25c0247e01bc538be4dd191fb6b3a8cf)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2565223
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Tested-by: Marco Chen <marcochen@chromium.org>
Commit-Queue: Marco Chen <marcochen@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_protocol.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 857a6b7a46..a983dba257 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -4380,10 +4380,13 @@ void pd_task(void *u) #ifdef CONFIG_USB_PD_TCPC_LOW_POWER /* - * Always stay in low power mode since we are waiting - * for a connection. + * The next state is not determined just by what is + * attached, but also depends on DRP_STATE. Regardless + * of next state, if nothing is attached, then always + * request low power mode. */ - pd[port].flags |= PD_FLAGS_LPM_REQUESTED; + if (cc_is_open(cc1, cc2)) + pd[port].flags |= PD_FLAGS_LPM_REQUESTED; #endif if (next_state == PD_STATE_SNK_DISCONNECTED) { |