diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/s3c-fb.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 8ea974dd92c5..f9aca9d13d1b 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -1027,6 +1027,28 @@ static struct fb_ops s3c_fb_ops = { | |||
1027 | }; | 1027 | }; |
1028 | 1028 | ||
1029 | /** | 1029 | /** |
1030 | * s3c_fb_missing_pixclock() - calculates pixel clock | ||
1031 | * @mode: The video mode to change. | ||
1032 | * | ||
1033 | * Calculate the pixel clock when none has been given through platform data. | ||
1034 | */ | ||
1035 | static void __devinit s3c_fb_missing_pixclock(struct fb_videomode *mode) | ||
1036 | { | ||
1037 | u64 pixclk = 1000000000000ULL; | ||
1038 | u32 div; | ||
1039 | |||
1040 | div = mode->left_margin + mode->hsync_len + mode->right_margin + | ||
1041 | mode->xres; | ||
1042 | div *= mode->upper_margin + mode->vsync_len + mode->lower_margin + | ||
1043 | mode->yres; | ||
1044 | div *= mode->refresh ? : 60; | ||
1045 | |||
1046 | do_div(pixclk, div); | ||
1047 | |||
1048 | mode->pixclock = pixclk; | ||
1049 | } | ||
1050 | |||
1051 | /** | ||
1030 | * s3c_fb_alloc_memory() - allocate display memory for framebuffer window | 1052 | * s3c_fb_alloc_memory() - allocate display memory for framebuffer window |
1031 | * @sfb: The base resources for the hardware. | 1053 | * @sfb: The base resources for the hardware. |
1032 | * @win: The window to initialise memory for. | 1054 | * @win: The window to initialise memory for. |
@@ -1364,6 +1386,9 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev) | |||
1364 | if (!pd->win[win]) | 1386 | if (!pd->win[win]) |
1365 | continue; | 1387 | continue; |
1366 | 1388 | ||
1389 | if (!pd->win[win]->win_mode.pixclock) | ||
1390 | s3c_fb_missing_pixclock(&pd->win[win]->win_mode); | ||
1391 | |||
1367 | ret = s3c_fb_probe_win(sfb, win, fbdrv->win[win], | 1392 | ret = s3c_fb_probe_win(sfb, win, fbdrv->win[win], |
1368 | &sfb->windows[win]); | 1393 | &sfb->windows[win]); |
1369 | if (ret < 0) { | 1394 | if (ret < 0) { |