Daisuke Nojiri has uploaded this change for review. ( https://review.coreboot.org/23803
Change subject: Fizz: Check HDMI HPD and DisplayPort HPD ......................................................................
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 HDMI monitor is connected, no wait is needed. If only HDMI monitor is connected, the API always loops until stopwatch expires.
This patch makes google_chromeec_wait_for_display first check HDMI HPD. If it's asserted, it returns immediately. If not, it loops until DP HPD is asserted.
This patch also extends the wait time to 3 seconds.
BUG=b:72387533 BRANCH=none TEST=Verify firmware screen is displayed even when a type-c monitor does not imeediately assert HPD. Verify if HDMI monitor is connected, AP does not wait (and firmware screen is displayed on HDMI monitor).
Change-Id: I8f80c3058b0d4ddc5056d20688e794cd8415da2d Signed-off-by: Daisuke Nojiri dnojiri@chromium.org --- M src/mainboard/google/fizz/ramstage.c 1 file changed, 38 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/23803/1
diff --git a/src/mainboard/google/fizz/ramstage.c b/src/mainboard/google/fizz/ramstage.c index e5215f8..f7520fa 100644 --- a/src/mainboard/google/fizz/ramstage.c +++ b/src/mainboard/google/fizz/ramstage.c @@ -14,15 +14,51 @@ */
#include <bootmode.h> +#include <console/console.h> +#include <delay.h> #include <ec/google/chromeec/ec.h> +#include <gpio.h> +#include <mainboard/google/fizz/gpio.h> +#include <soc/gpio.h> #include <soc/ramstage.h> +#include <timer.h>
#include "gpio.h"
+#define GPIO_HDMI_HPD GPP_E13 +#define GPIO_DP_HPD GPP_E14 + +const static long display_timeout_ms = 3000; + +/* TODO: This can be moved to common directory */ +static void wait_for_hpd(gpio_t gpio, long timeout) +{ + struct stopwatch sw; + + printk(BIOS_INFO, "Waiting for HPD\n"); + gpio_input(gpio); + + stopwatch_init_msecs_expire(&sw, timeout); + while (!gpio_get(gpio)) { + if (stopwatch_expired(&sw)) { + printk(BIOS_WARNING, + "HPD not ready after %ldms. Abort.\n", timeout); + return; + } + mdelay(200); + } + printk(BIOS_INFO, "HPD ready after %lu ms\n", + stopwatch_duration_msecs(&sw)); +} + void mainboard_silicon_init_params(FSP_SIL_UPD *params) { - if (display_init_required()) + gpio_input(GPIO_HDMI_HPD); + if (display_init_required() && !gpio_get(GPIO_HDMI_HPD)) { /* This has to be done before FSP-S runs. */ - google_chromeec_wait_for_display(); + if (google_chromeec_wait_for_displayport(display_timeout_ms)) + wait_for_hpd(GPIO_DP_HPD, display_timeout_ms); + } + gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); }