public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] sunxi: video: Fallback from HDMI to VGA on boards with VGA
@ 2014-12-27 17:02 Hans de Goede
  2014-12-29 14:15 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2014-12-27 17:02 UTC (permalink / raw)
  To: u-boot

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>
---
Changes in v2:
-Fix missing "break;" in v1 which caused hdmi output to no longer work
---
 doc/README.video              |  3 +--
 drivers/video/sunxi_display.c | 51 ++++++++++++++++++++++++-------------------
 2 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/doc/README.video b/doc/README.video
index cfe6318..2c55d6a 100644
--- a/doc/README.video
+++ b/doc/README.video
@@ -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
  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
-    detected, if no LCD is configured, disable video ouput.
+ 1: Enabled.  Fallback to the lcd / vga / none in that order (if available)
  Defaults to hpd=1.
 
 - edid=[0|1] - Enable use of DDC + EDID to get monitor info
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 0dd5aa1..929ec17 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -837,36 +837,43 @@ void *video_hw_init(void)
 		printf("Unknown monitor: '%s', falling back to '%s'\n",
 		       mon, 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]) {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH v2] sunxi: video: Fallback from HDMI to VGA on boards with VGA
  2014-12-27 17:02 [U-Boot] [PATCH v2] sunxi: video: Fallback from HDMI to VGA on boards with VGA Hans de Goede
@ 2014-12-29 14:15 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2014-12-29 14:15 UTC (permalink / raw)
  To: u-boot

On Sat, 2014-12-27 at 18:02 +0100, Hans de Goede wrote:
> 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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-29 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-27 17:02 [U-Boot] [PATCH v2] sunxi: video: Fallback from HDMI to VGA on boards with VGA Hans de Goede
2014-12-29 14:15 ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox