[PATCH] video: meson: add HDMI fail-save FullHD option

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 --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;

Hi,
On 15/01/2021 09:11, Artem Lapkin wrote:
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.
Thanks ! It was in my TODO list....
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 --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
I don't think it's necessary to have an option for that.
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;
So, 1080p is not a good idea for DVI screens, only for HDMI displays. And I don't think it's the right place, since when I will add support for DSI output, it won't work.
So it should go in the meson_dw_hdmi, but you'll need to add a read_timing() callback instead of the read_edid, that would do the same as display_read_timing() but return a fallback mode if edid_get_timing_validate() fails.
You could get the info about HDMI or DVI in timing->hdmi_monitor, then you should return 1024x768 for DVI and 1080p for HDMI displays, but you'll need to fix the edid_get_timing_validate to check for HDMI stuff before validating the timings.
Neil
}
}
uc_priv->xsize = timing.hactive.typ;
participants (2)
-
Artem Lapkin
-
Neil Armstrong