karo: tx6: make pixelclock overridable via DT or 'video_mode'
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 9 May 2019 13:39:46 +0000 (15:39 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 9 May 2019 13:39:46 +0000 (15:39 +0200)
board/karo/tx6/tx6qdl.c
board/karo/tx6/tx6ul.c

index b4a6fa9..b1b9f54 100644 (file)
@@ -1296,10 +1296,13 @@ void lcd_ctrl_init(void *lcdbase)
                panel_info.vl_bpix = LCD_COLOR32;
        }
 
-       p->pixclock = KHZ2PICOS(refresh *
-               (p->xres + p->left_margin + p->right_margin + p->hsync_len) *
-               (p->yres + p->upper_margin + p->lower_margin + p->vsync_len) /
-                               1000);
+       if (refresh_set || p->pixclock == 0)
+               p->pixclock = KHZ2PICOS(refresh *
+                                       (p->xres + p->left_margin +
+                                        p->right_margin + p->hsync_len) *
+                                       (p->yres + p->upper_margin +
+                                        p->lower_margin + p->vsync_len) /
+                                       1000);
        debug("Pixel clock set to %lu.%03lu MHz\n",
              PICOS2KHZ(p->pixclock) / 1000, PICOS2KHZ(p->pixclock) % 1000);
 
index 6d3022a..bdb1980 100644 (file)
@@ -1240,10 +1240,13 @@ void lcd_ctrl_init(void *lcdbase)
                panel_info.vl_bpix = LCD_COLOR32;
        }
 
-       p->pixclock = KHZ2PICOS(refresh *
-               (p->xres + p->left_margin + p->right_margin + p->hsync_len) *
-               (p->yres + p->upper_margin + p->lower_margin + p->vsync_len) /
-                               1000);
+       if (refresh_set || p->pixclock == 0)
+               p->pixclock = KHZ2PICOS(refresh *
+                                       (p->xres + p->left_margin +
+                                        p->right_margin + p->hsync_len) *
+                                       (p->yres + p->upper_margin +
+                                        p->lower_margin + p->vsync_len) /
+                                       1000);
        debug("Pixel clock set to %lu.%03lu MHz\n",
              PICOS2KHZ(p->pixclock) / 1000, PICOS2KHZ(p->pixclock) % 1000);