From cb6e62073ed90d1e9eedfcbebcf31719187a5368 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Mon, 21 Oct 2013 16:13:51 +0200 Subject: [PATCH] karo: tx6: fix initialization of panel_info --- board/karo/tx6/tx6qdl.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/board/karo/tx6/tx6qdl.c b/board/karo/tx6/tx6qdl.c index 3cd37d7a3a..349f48ff3b 100644 --- a/board/karo/tx6/tx6qdl.c +++ b/board/karo/tx6/tx6qdl.c @@ -845,10 +845,14 @@ void lcd_ctrl_init(void *lcdbase) p = &fb_mode; debug("Using video mode from FDT\n"); vm += strlen(vm); - if (fb_mode.xres < panel_info.vl_col) - panel_info.vl_col = fb_mode.xres; - if (fb_mode.yres < panel_info.vl_row) - panel_info.vl_row = fb_mode.yres; + if (fb_mode.xres > panel_info.vl_col || + fb_mode.yres > panel_info.vl_row) { + printf("video resolution from DT: %dx%d exceeds hardware limits: %dx%d\n", + fb_mode.xres, fb_mode.yres, + panel_info.vl_col, panel_info.vl_row); + lcd_enabled = 0; + return; + } } if (p->name != NULL) debug("Trying compiled-in video modes\n"); @@ -953,6 +957,25 @@ void lcd_ctrl_init(void *lcdbase) printf("\n"); return; } + if (p->xres > panel_info.vl_col || p->yres > panel_info.vl_row) { + printf("video resolution: %dx%d exceeds hardware limits: %dx%d\n", + p->xres, p->yres, panel_info.vl_col, panel_info.vl_row); + lcd_enabled = 0; + return; + } + panel_info.vl_col = p->xres; + panel_info.vl_row = p->yres; + + switch(color_depth) { + case 8: + panel_info.vl_bpix = LCD_COLOR8; + break; + case 16: + panel_info.vl_bpix = LCD_COLOR16; + break; + default: + panel_info.vl_bpix = LCD_COLOR24; + } p->pixclock = KHZ2PICOS(refresh * (p->xres + p->left_margin + p->right_margin + p->hsync_len) * -- 2.39.2