mb/google/dedede: Wait for HPD on dibbi variants
Some Type-C monitors do not immediately assert HPD. If we enter FSP-S
before HDP is asserted, display initialisation may fail. So wait for
HPD.
This is similar to commit b40c600914
("mainboard/hatch: Fix puff DP
output on cold boots") on puff, except we don't use
google_chromeec_wait_for_displayport() since that EC command was removed
for TCPMv2 (https://crrev.com/c/4221975). Instead we use the HPD signals
only. By waiting for any HPD signal (Type-C or HDMI), we skip waiting if
HDMI is connected, which is the same behaviour as puff and fizz.
TEST=On dibbi, connect a display via a Type-C to HDMI dongle and check
the dev and recovery screens are now displayed correctly. Also check the
logs in the following cases:
Cold reboot in dev mode, Type-C to HDMI dongle:
HPD ready after 800 ms
Warm reboot in dev mode, Type-C to HDMI dongle:
HPD ready after 0 ms
Cold/warm reboot in dev mode, direct Type-C:
HPD ready after 0 ms
Cold/warm reboot in dev mode, direct HDMI:
HPD ready after 0 ms
Cold/warm reboot in dev mode, no display:
HPD not ready after 3000 ms. Abort.
Change-Id: Id4657b5d5a95a68ecbd9efcf3585cf96ad1e13e1
Signed-off-by: Reka Norman <rekanorman@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78294
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sam McNally <sammc@google.com>
This commit is contained in:
parent
7c193b9480
commit
e486082dfb
|
@ -3,12 +3,15 @@
|
|||
#include <acpi/acpi.h>
|
||||
#include <acpi/acpigen.h>
|
||||
#include <baseboard/variants.h>
|
||||
#include <bootmode.h>
|
||||
#include <console/console.h>
|
||||
#include <delay.h>
|
||||
#include <device/device.h>
|
||||
#include <drivers/tpm/cr50.h>
|
||||
#include <ec/ec.h>
|
||||
#include <security/tpm/tss.h>
|
||||
#include <soc/soc_chip.h>
|
||||
#include <timer.h>
|
||||
#include <vb2_api.h>
|
||||
|
||||
static void mainboard_update_soc_chip_config(void)
|
||||
|
@ -30,12 +33,62 @@ static void mainboard_update_soc_chip_config(void)
|
|||
}
|
||||
}
|
||||
|
||||
static bool any_hpd_ready(const gpio_t *gpios, size_t num_gpios)
|
||||
{
|
||||
for (size_t i = 0; i < num_gpios; i++) {
|
||||
if (gpio_get(gpios[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void mainboard_wait_for_hpd(void)
|
||||
{
|
||||
static const long display_timeout_ms = 3000;
|
||||
struct stopwatch sw;
|
||||
size_t num_gpios;
|
||||
const gpio_t *hpd_gpios = variant_hpd_gpios(&num_gpios);
|
||||
|
||||
if (num_gpios == 0) {
|
||||
printk(BIOS_WARNING, "No HPD GPIOs, skip waiting\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printk(BIOS_INFO, "Waiting for HPD\n");
|
||||
|
||||
/* Pins will be configured back by gpio_configure_pads. */
|
||||
for (size_t i = 0; i < num_gpios; i++) {
|
||||
gpio_input(hpd_gpios[i]);
|
||||
}
|
||||
|
||||
stopwatch_init_msecs_expire(&sw, display_timeout_ms);
|
||||
while (!any_hpd_ready(hpd_gpios, num_gpios)) {
|
||||
if (stopwatch_expired(&sw)) {
|
||||
printk(BIOS_WARNING,
|
||||
"HPD not ready after %ld ms. Abort.\n",
|
||||
display_timeout_ms);
|
||||
return;
|
||||
}
|
||||
mdelay(200);
|
||||
}
|
||||
printk(BIOS_INFO, "HPD ready after %lld ms\n",
|
||||
stopwatch_duration_msecs(&sw));
|
||||
}
|
||||
|
||||
static void mainboard_init(void *chip_info)
|
||||
{
|
||||
const struct pad_config *base_pads;
|
||||
const struct pad_config *override_pads;
|
||||
size_t base_num, override_num;
|
||||
|
||||
/*
|
||||
* For chromeboxes, wait for DP HPD to be asserted before
|
||||
* entering FSP-S, otherwise display init may fail.
|
||||
*/
|
||||
if (!CONFIG(SYSTEM_TYPE_LAPTOP) && display_init_required())
|
||||
mainboard_wait_for_hpd();
|
||||
|
||||
base_pads = baseboard_gpio_table(&base_num);
|
||||
override_pads = variant_override_gpio_table(&override_num);
|
||||
|
||||
|
|
|
@ -489,3 +489,9 @@ static const struct cros_gpio cros_gpios[] = {
|
|||
};
|
||||
|
||||
DECLARE_WEAK_CROS_GPIOS(cros_gpios);
|
||||
|
||||
const gpio_t *__weak variant_hpd_gpios(size_t *num)
|
||||
{
|
||||
*num = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ const struct pad_config *variant_early_gpio_table(size_t *num);
|
|||
const struct pad_config *variant_sleep_gpio_table(size_t *num);
|
||||
const struct pad_config *variant_override_gpio_table(size_t *num);
|
||||
const struct pad_config *variant_romstage_gpio_table(size_t *num);
|
||||
const gpio_t *variant_hpd_gpios(size_t *num);
|
||||
|
||||
enum s0ix_entry {
|
||||
S0IX_EXIT,
|
||||
|
|
|
@ -87,3 +87,18 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
|
|||
*num = ARRAY_SIZE(gpio_table);
|
||||
return gpio_table;
|
||||
}
|
||||
|
||||
static const gpio_t hpd_gpios[] = {
|
||||
/* HDMI1 */
|
||||
GPP_A17,
|
||||
/* USB C0 */
|
||||
GPP_B23,
|
||||
/* USB C1 */
|
||||
GPP_A16,
|
||||
};
|
||||
|
||||
const gpio_t *variant_hpd_gpios(size_t *num)
|
||||
{
|
||||
*num = ARRAY_SIZE(hpd_gpios);
|
||||
return hpd_gpios;
|
||||
}
|
||||
|
|
|
@ -91,3 +91,18 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
|
|||
*num = ARRAY_SIZE(gpio_table);
|
||||
return gpio_table;
|
||||
}
|
||||
|
||||
static const gpio_t hpd_gpios[] = {
|
||||
/* HDMI1 */
|
||||
GPP_A17,
|
||||
/* HDMI2 */
|
||||
GPP_A16,
|
||||
/* USB C0 */
|
||||
GPP_B23,
|
||||
};
|
||||
|
||||
const gpio_t *variant_hpd_gpios(size_t *num)
|
||||
{
|
||||
*num = ARRAY_SIZE(hpd_gpios);
|
||||
return hpd_gpios;
|
||||
}
|
||||
|
|
|
@ -91,3 +91,18 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
|
|||
*num = ARRAY_SIZE(gpio_table);
|
||||
return gpio_table;
|
||||
}
|
||||
|
||||
static const gpio_t hpd_gpios[] = {
|
||||
/* HDMI1 */
|
||||
GPP_A17,
|
||||
/* HDMI2 */
|
||||
GPP_A16,
|
||||
/* USB C0 */
|
||||
GPP_B23,
|
||||
};
|
||||
|
||||
const gpio_t *variant_hpd_gpios(size_t *num)
|
||||
{
|
||||
*num = ARRAY_SIZE(hpd_gpios);
|
||||
return hpd_gpios;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue