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>
This commit is contained in:
Hans de Goede 2014-12-25 13:52:04 +01:00
parent 3ffbe477da
commit 49d2703dd8
2 changed files with 31 additions and 25 deletions

View File

@ -50,8 +50,7 @@ The sunxi u-boot driver supports the following video-mode options:
- hpd=[0|1] - Enable use of the hdmi HotPlug Detect feature - hpd=[0|1] - Enable use of the hdmi HotPlug Detect feature
0: Disabled. Configure dvi/hdmi output even if no cable is detected 0: Disabled. Configure dvi/hdmi output even if no cable is detected
1: Enabled. If a LCD has been configured fallback to the LCD when no cable is 1: Enabled. Fallback to the lcd / vga / none in that order (if available)
detected, if no LCD is configured, disable video ouput.
Defaults to hpd=1. Defaults to hpd=1.
- edid=[0|1] - Enable use of DDC + EDID to get monitor info - edid=[0|1] - Enable use of DDC + EDID to get monitor info

View File

@ -846,36 +846,43 @@ void *video_hw_init(void)
printf("Unknown monitor: '%s', falling back to '%s'\n", printf("Unknown monitor: '%s', falling back to '%s'\n",
mon, sunxi_get_mon_desc(sunxi_display.monitor)); mon, sunxi_get_mon_desc(sunxi_display.monitor));
switch (sunxi_display.monitor) { #ifdef CONFIG_VIDEO_HDMI
case sunxi_monitor_none: /* If HDMI/DVI is selected do HPD & EDID, and handle fallback */
return NULL; if (sunxi_display.monitor == sunxi_monitor_dvi ||
case sunxi_monitor_dvi: sunxi_display.monitor == sunxi_monitor_hdmi) {
case sunxi_monitor_hdmi:
#ifndef CONFIG_VIDEO_HDMI
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. */ /* Always call hdp_detect, as it also enables clocks, etc. */
ret = sunxi_hdmi_hpd_detect(); ret = sunxi_hdmi_hpd_detect();
if (ret) { if (ret) {
printf("HDMI connected: "); printf("HDMI connected: ");
if (edid && sunxi_hdmi_edid_get_mode(&custom) == 0) if (edid && sunxi_hdmi_edid_get_mode(&custom) == 0)
mode = &custom; mode = &custom;
break; } else if (hpd) {
} sunxi_hdmi_shutdown();
if (!hpd) /* Fallback to lcd / vga / none */
break; /* User has requested to ignore hpd */ 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
sunxi_hdmi_shutdown(); switch (sunxi_display.monitor) {
case sunxi_monitor_none:
if (lcd_mode[0] == 0) { return NULL;
sunxi_display.monitor = sunxi_monitor_none; case sunxi_monitor_dvi:
return NULL; /* No LCD, bail */ case sunxi_monitor_hdmi:
} #ifdef CONFIG_VIDEO_HDMI
break;
/* Fall back / through to LCD */ #else
sunxi_display.monitor = sunxi_monitor_lcd; printf("HDMI/DVI not supported on this board\n");
sunxi_display.monitor = sunxi_monitor_none;
return NULL;
#endif #endif
case sunxi_monitor_lcd: case sunxi_monitor_lcd:
if (lcd_mode[0]) { if (lcd_mode[0]) {