diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-12-25 12:52:04 (GMT) |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2015-01-14 13:56:39 (GMT) |
commit | 49d2703dd88d5d68d63b52cd4811ed853408ea4c (patch) | |
tree | 8feda3a4e9f03428624303fee904452e08c012da /drivers/video/sunxi_display.c | |
parent | 3ffbe477da2c21b54a8b89202519d49c26967561 (diff) | |
download | u-boot-49d2703dd88d5d68d63b52cd4811ed853408ea4c.tar.xz |
sunxi: video: Fallback from HDMI to VGA on boards with VGA
If a board has no LCD, but does have VGA fallback to VGA when no HDMI cable
is connected (unless hpd=0).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'drivers/video/sunxi_display.c')
-rw-r--r-- | drivers/video/sunxi_display.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c index eda04f7..5d5efd6 100644 --- a/drivers/video/sunxi_display.c +++ b/drivers/video/sunxi_display.c @@ -846,36 +846,43 @@ void *video_hw_init(void) printf("Unknown monitor: '%s', falling back to '%s'\n", mon, sunxi_get_mon_desc(sunxi_display.monitor)); +#ifdef CONFIG_VIDEO_HDMI + /* If HDMI/DVI is selected do HPD & EDID, and handle fallback */ + if (sunxi_display.monitor == sunxi_monitor_dvi || + sunxi_display.monitor == sunxi_monitor_hdmi) { + /* Always call hdp_detect, as it also enables clocks, etc. */ + ret = sunxi_hdmi_hpd_detect(); + if (ret) { + printf("HDMI connected: "); + if (edid && sunxi_hdmi_edid_get_mode(&custom) == 0) + mode = &custom; + } else if (hpd) { + sunxi_hdmi_shutdown(); + /* Fallback to lcd / vga / none */ + if (lcd_mode[0]) { + sunxi_display.monitor = sunxi_monitor_lcd; + } else { +#ifdef CONFIG_VIDEO_VGA_VIA_LCD + sunxi_display.monitor = sunxi_monitor_vga; +#else + sunxi_display.monitor = sunxi_monitor_none; +#endif + } + } /* else continue with hdmi/dvi without a cable connected */ + } +#endif + switch (sunxi_display.monitor) { case sunxi_monitor_none: return NULL; case sunxi_monitor_dvi: case sunxi_monitor_hdmi: -#ifndef CONFIG_VIDEO_HDMI +#ifdef CONFIG_VIDEO_HDMI + break; +#else printf("HDMI/DVI not supported on this board\n"); sunxi_display.monitor = sunxi_monitor_none; return NULL; -#else - /* Always call hdp_detect, as it also enables clocks, etc. */ - ret = sunxi_hdmi_hpd_detect(); - if (ret) { - printf("HDMI connected: "); - if (edid && sunxi_hdmi_edid_get_mode(&custom) == 0) - mode = &custom; - break; - } - if (!hpd) - break; /* User has requested to ignore hpd */ - - sunxi_hdmi_shutdown(); - - if (lcd_mode[0] == 0) { - sunxi_display.monitor = sunxi_monitor_none; - return NULL; /* No LCD, bail */ - } - - /* Fall back / through to LCD */ - sunxi_display.monitor = sunxi_monitor_lcd; #endif case sunxi_monitor_lcd: if (lcd_mode[0]) { |