diff options
author | Edward O'Callaghan <quasisec@google.com> | 2020-01-20 18:21:13 +1100 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2020-02-07 03:33:43 +0000 |
commit | b40c6009141e2c6a6f886584ea6d5b7e4fe69347 (patch) | |
tree | 5d6b5f636398cea92bce4becb10e4bd70afe0436 /src/mainboard/google/hatch/variants/puff | |
parent | 2806ec971e11cccee86927ddde6ace3a34319cfb (diff) | |
download | coreboot-b40c6009141e2c6a6f886584ea6d5b7e4fe69347.tar.xz |
mainboard/hatch: Fix puff DP output on cold boots
Wait for HPD DP unless HDMI is plugged.
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.
Similar to that of b:72387533 however our DP&HDMI are beind a MST.
See commit d182b63347c744c on how this was done for mainboard/fizz.
BUG=b:147992492
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: I19d40056e58f1737f87fd07d62b07a723a63d610
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38475
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'src/mainboard/google/hatch/variants/puff')
-rw-r--r-- | src/mainboard/google/hatch/variants/puff/mainboard.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mainboard/google/hatch/variants/puff/mainboard.c b/src/mainboard/google/hatch/variants/puff/mainboard.c index 9c2b5fb033..7354ce92cc 100644 --- a/src/mainboard/google/hatch/variants/puff/mainboard.c +++ b/src/mainboard/google/hatch/variants/puff/mainboard.c @@ -15,8 +15,50 @@ #include <baseboard/variants.h> #include <chip.h> +#include <delay.h> #include <device/device.h> #include <ec/google/chromeec/ec.h> +#include <gpio.h> +#include <timer.h> + +#define GPIO_HDMI_HPD GPP_E13 +#define GPIO_DP_HPD GPP_E14 + +/* 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"); + 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 variant_ramstage_init(void) +{ + static const long display_timeout_ms = 3000; + + /* This is reconfigured back to whatever FSP-S expects by + gpio_configure_pads. */ + gpio_input(GPIO_HDMI_HPD); + gpio_input(GPIO_DP_HPD); + if (display_init_required() + && !gpio_get(GPIO_HDMI_HPD) + && !gpio_get(GPIO_DP_HPD)) { + /* This has to be done before FSP-S runs. */ + if (google_chromeec_wait_for_displayport(display_timeout_ms)) + wait_for_hpd(GPIO_DP_HPD, display_timeout_ms); + } +} /* * For type-C chargers, set PL2 to 90% of max power to account for |