<p>Daisuke Nojiri has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/23803">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fizz: Check HDMI HPD and DisplayPort HPD<br><br>Some type-c monitors do not immediately assert HPD. If we continue<br>to boot without HPD asserted, Depthcharge fails to show pictures<br>on a monitor even if HPD is asserted later.<br><br>Also, if HDMI monitor is connected, no wait is needed. If only HDMI<br>monitor is connected, the API always loops until stopwatch expires.<br><br>This patch makes google_chromeec_wait_for_display first check HDMI<br>HPD. If it's asserted, it returns immediately. If not, it loops<br>until DP HPD is asserted.<br><br>This patch also extends the wait time to 3 seconds.<br><br>BUG=b:72387533<br>BRANCH=none<br>TEST=Verify firmware screen is displayed even when a type-c monitor<br>does not imeediately assert HPD. Verify if HDMI monitor is connected,<br>AP does not wait (and firmware screen is displayed on HDMI monitor).<br><br>Change-Id: I8f80c3058b0d4ddc5056d20688e794cd8415da2d<br>Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org><br>---<br>M src/mainboard/google/fizz/ramstage.c<br>1 file changed, 38 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/23803/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/mainboard/google/fizz/ramstage.c b/src/mainboard/google/fizz/ramstage.c</span><br><span>index e5215f8..f7520fa 100644</span><br><span>--- a/src/mainboard/google/fizz/ramstage.c</span><br><span>+++ b/src/mainboard/google/fizz/ramstage.c</span><br><span>@@ -14,15 +14,51 @@</span><br><span>  */</span><br><span> </span><br><span> #include <bootmode.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <console/console.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <delay.h></span><br><span> #include <ec/google/chromeec/ec.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <gpio.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <mainboard/google/fizz/gpio.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <soc/gpio.h></span><br><span> #include <soc/ramstage.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <timer.h></span><br><span> </span><br><span> #include "gpio.h"</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define GPIO_HDMI_HPD                GPP_E13</span><br><span style="color: hsl(120, 100%, 40%);">+#define GPIO_DP_HPD            GPP_E14</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+const static long display_timeout_ms = 3000;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* TODO: This can be moved to common directory */</span><br><span style="color: hsl(120, 100%, 40%);">+static void wait_for_hpd(gpio_t gpio, long timeout)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  struct stopwatch sw;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        printk(BIOS_INFO, "Waiting for HPD\n");</span><br><span style="color: hsl(120, 100%, 40%);">+     gpio_input(gpio);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   stopwatch_init_msecs_expire(&sw, timeout);</span><br><span style="color: hsl(120, 100%, 40%);">+        while (!gpio_get(gpio)) {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (stopwatch_expired(&sw)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     printk(BIOS_WARNING,</span><br><span style="color: hsl(120, 100%, 40%);">+                         "HPD not ready after %ldms. Abort.\n", timeout);</span><br><span style="color: hsl(120, 100%, 40%);">+                     return;</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span style="color: hsl(120, 100%, 40%);">+             mdelay(200);</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+     printk(BIOS_INFO, "HPD ready after %lu ms\n",</span><br><span style="color: hsl(120, 100%, 40%);">+              stopwatch_duration_msecs(&sw));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> void mainboard_silicon_init_params(FSP_SIL_UPD *params)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (display_init_required())</span><br><span style="color: hsl(120, 100%, 40%);">+  gpio_input(GPIO_HDMI_HPD);</span><br><span style="color: hsl(120, 100%, 40%);">+    if (display_init_required() && !gpio_get(GPIO_HDMI_HPD)) {</span><br><span>           /* This has to be done before FSP-S runs. */</span><br><span style="color: hsl(0, 100%, 40%);">-            google_chromeec_wait_for_display();</span><br><span style="color: hsl(120, 100%, 40%);">+           if (google_chromeec_wait_for_displayport(display_timeout_ms))</span><br><span style="color: hsl(120, 100%, 40%);">+                 wait_for_hpd(GPIO_DP_HPD, display_timeout_ms);</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table));</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/23803">change 23803</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/23803"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8f80c3058b0d4ddc5056d20688e794cd8415da2d </div>
<div style="display:none"> Gerrit-Change-Number: 23803 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Daisuke Nojiri <dnojiri@chromium.org> </div>