summaryrefslogtreecommitdiff
path: root/src/ec/google/chromeec
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-02-16 17:50:06 -0800
committerPatrick Georgi <pgeorgi@google.com>2018-03-06 08:50:51 +0000
commitd182b63347c744cabd674d4df64a2bfd3e9eef0e (patch)
tree0e9713f7f15c0f38a832568c3574e003b339017e /src/ec/google/chromeec
parent50f06a14cdcdd072720e684096e31b14f9fa2321 (diff)
downloadcoreboot-d182b63347c744cabd674d4df64a2bfd3e9eef0e.tar.xz
mainboard/google/fizz: Check HDMI HPD and DisplayPort HPD
Some type-c monitors do not immediately assert HPD. If we continue to boot without HPD asserted, Depthcharge fails to show pictures on a monitor even if HPD is asserted later. Also, if an HDMI monitor is connected, no wait is needed. If only an HDMI monitor is connected, currently the API always loops until the stopwatch expires. This patch will make the AP skip DisplayPort wait loop if it detects an HDMI monitor. And if an HDMI monitor is not detected, the AP will wait for DisplayPort mode (like before) but also its HPD signal. This patch also extends the wait loop time-out to 3 seconds. BUG=b:72387533 BRANCH=none TEST=Verify firmware screen is displayed even when a type-c monitor does not immediately assert HPD. Verify if HDMI monitor is connected, AP does not wait (and firmware screen is displayed on HDMI monitor). Change-Id: I0e1afdffbebf4caf35bbb792e7f4637fae89fa49 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://review.coreboot.org/23816 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/ec/google/chromeec')
-rw-r--r--src/ec/google/chromeec/ec.c23
-rw-r--r--src/ec/google/chromeec/ec.h2
2 files changed, 16 insertions, 9 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 28625e4096..efe22e2ab9 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -986,25 +986,32 @@ int google_chromeec_pd_get_amode(uint16_t svid)
return 0;
}
-const static long wait_for_display_timeout_ms = 2000;
#define USB_SID_DISPLAYPORT 0xff01
-void google_chromeec_wait_for_display(void)
+/**
+ * Wait for DisplayPort to be ready
+ *
+ * @param timeout Wait aborts after <timeout> ms.
+ * @return 1: Success or 0: Timeout.
+ */
+int google_chromeec_wait_for_displayport(long timeout)
{
struct stopwatch sw;
- printk(BIOS_INFO, "Waiting for display\n");
- stopwatch_init_msecs_expire(&sw, wait_for_display_timeout_ms);
+ printk(BIOS_INFO, "Waiting for DisplayPort\n");
+ stopwatch_init_msecs_expire(&sw, timeout);
while (google_chromeec_pd_get_amode(USB_SID_DISPLAYPORT) != 1) {
if (stopwatch_expired(&sw)) {
printk(BIOS_WARNING,
- "Display not ready after %ldms. Abort.\n",
- wait_for_display_timeout_ms);
- return;
+ "DisplayPort not ready after %ldms. Abort.\n",
+ timeout);
+ return 0;
}
mdelay(200);
}
- printk(BIOS_INFO, "Display ready after %lu ms\n",
+ printk(BIOS_INFO, "DisplayPort ready after %lu ms\n",
stopwatch_duration_msecs(&sw));
+
+ return 1;
}
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h
index 1ff07b7117..24c892291a 100644
--- a/src/ec/google/chromeec/ec.h
+++ b/src/ec/google/chromeec/ec.h
@@ -37,7 +37,7 @@ bool google_chromeec_is_uhepi_supported(void);
int google_ec_running_ro(void);
void google_chromeec_init(void);
int google_chromeec_pd_get_amode(uint16_t svid);
-void google_chromeec_wait_for_display(void);
+int google_chromeec_wait_for_displayport(long timeout);
/* Device events */
uint64_t google_chromeec_get_device_enabled_events(void);