Add the following extra modes: 1280x720@50 1920x1080@60 1920x1200@60
And allow selecting them by setting (and then saving and rebooting) a hdmi_mode env variable to the name of the mode. Also make the reserved fb mem slightly larger to allow 1920x1200 to work. Signed-off-by: Hans de Goede <hdego...@redhat.com> --- drivers/video/sunxi_display.c | 91 +++++++++++++++++++++++++++++++++++++----- include/configs/sunxi-common.h | 2 +- 2 files changed, 81 insertions(+), 12 deletions(-) diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c index 3060bee..349e36c 100644 --- a/drivers/video/sunxi_display.c +++ b/drivers/video/sunxi_display.c @@ -355,15 +355,14 @@ retry: } } -void *video_hw_init(void) +static void video_get_mode(char *modestr, struct fb_videomode *mode) { - static GraphicDevice *graphic_device = &sunxi_display.graphic_device; - /* - * Vesa standard 1024x768@60 - * 65.0 1024 1032 1176 1344 768 771 777 806 -hsync -vsync - */ - struct fb_videomode mode = { - .name = "1024x768", + const struct fb_videomode modes[] = { { + /* + * Vesa standard 1024x768@60 + * 65.0 1024 1032 1176 1344 768 771 777 806 -hsync -vsync + */ + .name = "1024x768@60", .refresh = 60, .xres = 1024, .yres = 768, @@ -377,7 +376,76 @@ void *video_hw_init(void) .sync = 0, .vmode = 0, .flag = 0, - }; + } , { + .name = "1280x720@50", + .refresh = 50, + .xres = 1280, + .yres = 720, + .pixclock = 74250, + .left_margin = 440, + .right_margin = 220, + .upper_margin = 20, + .lower_margin = 5, + .hsync_len = 40, + .vsync_len = 5, + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .vmode = FB_VMODE_NONINTERLACED, + .flag = 0, + } , { + .name = "1920x1080@60", + .refresh = 60, + .xres = 1920, + .yres = 1080, + .pixclock = 148500, + .left_margin = 88, + .right_margin = 148, + .upper_margin = 36, + .lower_margin = 4, + .hsync_len = 44, + .vsync_len = 5, + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .vmode = FB_VMODE_NONINTERLACED, + .flag = 0, + } , { + .name = "1920x1200@60", + .refresh = 60, + .xres = 1920, + .yres = 1200, + .pixclock = 154000, + .left_margin = 48, + .right_margin = 80, + .upper_margin = 26, + .lower_margin = 3, + .hsync_len = 32, + .vsync_len = 6, + .sync = FB_SYNC_HOR_HIGH_ACT, + .vmode = FB_VMODE_NONINTERLACED, + .flag = 0, + } }; + int i; + + if (!modestr) { + *mode = modes[0]; + return; + } + + for (i = 0; i < ARRAY_SIZE(modes); i++) { + if (strcmp(modes[i].name, modestr) == 0) + break; + } + if (i >= ARRAY_SIZE(modes)) { + eprintf("Mode %s not available, falling back to %s\n", + modestr, modes[0].name); + i = 0; + } + + *mode = modes[i]; +} + +void *video_hw_init(void) +{ + static GraphicDevice *graphic_device = &sunxi_display.graphic_device; + struct fb_videomode mode; int ret; memset(&sunxi_display, 0, sizeof(struct sunxi_display)); @@ -390,10 +458,11 @@ void *video_hw_init(void) if (!ret) return NULL; - printf("HDMI connected.\n"); sunxi_display.enabled = true; + video_get_mode(getenv("hdmi_mode"), &mode); + + printf("HDMI connected, setting up a %s console.\n", mode.name); - printf("Setting up a %s console.\n", mode.name); sunxi_engines_init(); sunxi_mode_set(&mode, gd->fb_base - CONFIG_SYS_SDRAM_BASE); diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 7b958f8..a6cdffb 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -202,7 +202,7 @@ * The amount of RAM that is reserved for the FB. This will not show up as * RAM to the kernel, but will be reclaimed by a KMS driver in future. */ -#define CONFIG_SUNXI_FB_SIZE (8 << 20) +#define CONFIG_SUNXI_FB_SIZE (9 << 20) /* Do we want to initialize a simple FB? */ #define CONFIG_VIDEO_DT_SIMPLEFB -- 2.1.0 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot