summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-03-14 16:40:26 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-03-21 21:30:41 +0000
commit5995e93bbaa1155ffd03c37114118a43a3983be1 (patch)
tree6c7e3d9a07bd905871e61fc4e708bc4c2ae33f11
parent3774c1cac5600429a2403567b09b78dcf0cb75a3 (diff)
downloadchrome-ec-5995e93bbaa1155ffd03c37114118a43a3983be1.tar.gz
USB-PD: Avoid discovering identity twice on boot
Some monitors do not like the same mode to be entered twice. They refuse to show any picture when it happens. This patch makes the TCPM check whether the port is a UFP or not before setting PD_FLAGS_CHECK_IDENTITY flag when transitioning from S5 to S3. If not (port is a DFP), it skips setting the flag. Key observations are: - Setting CHECK_IDENTITY there was useful for the following reasons: * In S5 we are in FORCE_SINK. So we might not be able to discover mode (due to the fact that we are a UFP initially when being a SINK). * Once we start, we want to discover the full capabilities. - The use case above is not true if we are a DFP (since we can discover mode immediately) - So it's useful IFF we are a UFP at transition. BUG=b:75958206 BRANCH=none TEST=Verified with a reworked Fizz on USB-C monitor/adapter (LG 27UD88, HP S240n, Dingdong, Hoho) as follows: 1. Plug-in boot 2. Manual recovery 3. Servo reset 4. EC reboot command 5. Warm reboot 6. Power button boot from S5 7. Suspend / resume Change-Id: I97a3fa671582552c029f7da140b55e7724b56ecc Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/963844
-rw-r--r--common/usb_pd_protocol.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 89885c3e84..207ea24f6a 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -3482,8 +3482,20 @@ static void pd_chipset_startup(void)
{
int i;
pd_set_dual_role(PD_DRP_TOGGLE_OFF);
+ /*
+ * Key observations are:
+ * - Setting CHECK_IDENTITY there was useful for the following reasons:
+ * * In S5 we are in FORCE_SINK. So we might not be able to discover
+ * mode (due to the fact that we are a UFP initially when being a
+ * SINK).
+ * * Once we start, we want to discover the full capabilities.
+ * - The use case above is not true if we are a DFP (since we can
+ * discover mode immediately)
+ * - So it's useful IFF we are a UFP at transition.
+ */
for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++)
- pd[i].flags |= PD_FLAGS_CHECK_IDENTITY;
+ if (pd[i].data_role == PD_ROLE_UFP)
+ pd[i].flags |= PD_FLAGS_CHECK_IDENTITY;
CPRINTS("PD:S5->S3");
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, pd_chipset_startup, HOOK_PRIO_DEFAULT);