diff mbox series

video: meson: add HDMI fail-save FullHD option

Message ID 20210115081139.567155-1-art@khadas.com
State Changes Requested, archived
Delegated to: Neil Armstrong
Headers show
Series video: meson: add HDMI fail-save FullHD option | expand

Commit Message

Art Nikpal Jan. 15, 2021, 8:11 a.m. UTC
add VIDEO_MESON_HDMI_FAIL_SAVE_FULL_HD configuration option

ABOUT:

Force setup FullHD display mode, if proper timing cant readed.
from display! Its happens for some 4K display, which send
unsupported high timings, but same time can works as FullHD!
Also its will be useful for suspended or disconnected displays.

NOTE: this option disabled by default

Signed-off-by: Artem Lapkin <art@khadas.com>
---
 drivers/video/meson/Kconfig     | 10 ++++++++++
 drivers/video/meson/meson_vpu.c | 19 +++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/video/meson/Kconfig b/drivers/video/meson/Kconfig
index 0c9ddeb8..55d67700 100644
--- a/drivers/video/meson/Kconfig
+++ b/drivers/video/meson/Kconfig
@@ -10,3 +10,13 @@  config VIDEO_MESON
 	select DISPLAY
 	help
 	  Enable Amlogic Meson Video Processing Unit video support.
+
+config VIDEO_MESON_HDMI_FAIL_SAVE_FULL_HD
+	bool "Enable HDMI fail-save FullHD mode"
+	depends on VIDEO_MESON
+	default n
+	help
+	  Force setup FullHD display mode, if proper timing cant readed.
+	  from display! Its happens for some 4K display, which send
+	  unsupported high timings, but same time can works as FullHD!
+	  Also its will be useful for suspended or disconnected displays
diff --git a/drivers/video/meson/meson_vpu.c b/drivers/video/meson/meson_vpu.c
index 4868839f..af677a45 100644
--- a/drivers/video/meson/meson_vpu.c
+++ b/drivers/video/meson/meson_vpu.c
@@ -52,8 +52,23 @@  static int meson_vpu_setup_mode(struct udevice *dev, struct udevice *disp)
 	if (disp) {
 		ret = display_read_timing(disp, &timing);
 		if (ret) {
-			debug("%s: Failed to read timings\n", __func__);
-			goto cvbs;
+			if (IS_ENABLED(CONFIG_VIDEO_MESON_HDMI_FAIL_SAVE_FULL_HD)) {
+				printf("DISPLAY: setup failsave FullHD mode\n");
+				timing.pixelclock.typ = 148500000;
+				timing.hactive.typ = 1920;
+				timing.hfront_porch.typ = 88;
+				timing.hback_porch.typ = 148;
+				timing.hsync_len.typ = 44;
+				timing.vactive.typ = 1080;
+				timing.vfront_porch.typ = 4;
+				timing.vback_porch.typ = 36;
+				timing.vsync_len.typ = 5;
+				timing.flags = 10;
+				timing.hdmi_monitor = true;
+			} else {
+				debug("%s: Failed to read timings\n", __func__);
+				goto cvbs;
+			}
 		}
 
 		uc_priv->xsize = timing.hactive.typ;