diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-12-20 14:15:23 (GMT) |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2015-01-14 13:56:38 (GMT) |
commit | 40f1b87ce7f84a7ff74fd519dc2c75b333068815 (patch) | |
tree | 82f8ffb8a94df6f7b3266553ac4b0171335fde15 | |
parent | f300068ddd85914dbec48d9ef2381b6f3ad92fc3 (diff) | |
download | u-boot-40f1b87ce7f84a7ff74fd519dc2c75b333068815.tar.xz |
sunxi: video: Give hotplug-detect (hpd) signal some time to show up
When using a hdmi powered hdmi to vga dongle, and cold booting a sunxi
device, the hpd detect code would not see the dongle (until a warm reboot),
because the dongle needs some time to boot.
Testing has shown that this dongle needs 213ms to respond on a cold boot,
so wait up to 300ms for a hpd signal to show up before giving up.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Anatolij Gustschin <agust@denx.de>
-rw-r--r-- | drivers/video/sunxi_display.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c index 795835d..5a14785 100644 --- a/drivers/video/sunxi_display.c +++ b/drivers/video/sunxi_display.c @@ -48,6 +48,7 @@ static int sunxi_hdmi_hpd_detect(void) (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; struct sunxi_hdmi_reg * const hdmi = (struct sunxi_hdmi_reg *)SUNXI_HDMI_BASE; + unsigned long tmo = timer_get_us() + 300000; /* Set pll3 to 300MHz */ clock_set_pll3(300000000); @@ -68,9 +69,12 @@ static int sunxi_hdmi_hpd_detect(void) writel(SUNXI_HDMI_CTRL_ENABLE, &hdmi->ctrl); writel(SUNXI_HDMI_PAD_CTRL0_HDP, &hdmi->pad_ctrl0); - udelay(1000); + while (timer_get_us() < tmo) { + if (readl(&hdmi->hpd) & SUNXI_HDMI_HPD_DETECT) + return 1; + } - return (readl(&hdmi->hpd) & SUNXI_HDMI_HPD_DETECT) ? 1 : 0; + return 0; } static void sunxi_hdmi_shutdown(void) |