]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0075-video-da8xx-fb-calculate-pixel-clock-period-for-the-.patch
linux-ti33x-psp 3.2: add fixed for cssp, fbset and OPP50
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / beaglebone / 0075-video-da8xx-fb-calculate-pixel-clock-period-for-the-.patch
1 From e12d15eadf15f8119729a65ecca79529b4fe3863 Mon Sep 17 00:00:00 2001
2 From: "Manjunathappa, Prakash" <prakash.pm@ti.com>
3 Date: Wed, 4 Jul 2012 17:10:16 +0530
4 Subject: [PATCH 75/79] video:da8xx-fb: calculate pixel clock period for the
5  panel
7 Patch calculates pixel clock period in pico seconds and updates
8 the same in variable screen information structure. fbset utility
9 uses this information.
10 This patch is from upstream backport, bearing commit id
11 12fa8350244d73b6111ec9bc6c2fd5d49fa601b5.
13 Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
14 Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
15 Signed-off-by: Patil, Rachna <rachna@ti.com>
16 ---
17  drivers/video/da8xx-fb.c |   19 ++++++++++++++++++-
18  1 file changed, 18 insertions(+), 1 deletion(-)
20 diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
21 index 010a8bc..ddc251e 100644
22 --- a/drivers/video/da8xx-fb.c
23 +++ b/drivers/video/da8xx-fb.c
24 @@ -37,6 +37,7 @@
25  #include <linux/lcm.h>
26  #include <video/da8xx-fb.h>
27  #include <asm/mach-types.h>
28 +#include <asm/div64.h>
29  
30  #define DRIVER_NAME "da8xx_lcdc"
31  
32 @@ -192,7 +193,6 @@ static struct fb_var_screeninfo da8xx_fb_var __devinitdata = {
33         .activate = 0,
34         .height = -1,
35         .width = -1,
36 -       .pixclock = 33333,/*Pico Sec*/
37         .accel_flags = 0,
38         .left_margin = LEFT_MARGIN,
39         .right_margin = RIGHT_MARGIN,
40 @@ -1267,6 +1267,22 @@ static struct fb_ops da8xx_fb_ops = {
41         .fb_blank = cfb_blank,
42  };
43  
44 +/* Calculate and return pixel clock period in pico seconds */
45 +static unsigned int da8xxfb_pixel_clk_period(struct da8xx_fb_par *par)
46 +{
47 +       unsigned int lcd_clk, div;
48 +       unsigned int configured_pix_clk;
49 +       unsigned long long pix_clk_period_picosec = 1000000000000ULL;
50 +
51 +       lcd_clk = clk_get_rate(par->lcdc_clk);
52 +       div = lcd_clk / par->pxl_clk;
53 +       configured_pix_clk = (lcd_clk / div);
54 +
55 +       do_div(pix_clk_period_picosec, configured_pix_clk);
56 +
57 +       return pix_clk_period_picosec;
58 +}
59 +
60  static int __devinit fb_probe(struct platform_device *device)
61  {
62         struct da8xx_lcdc_platform_data *fb_pdata =
63 @@ -1437,6 +1453,7 @@ static int __devinit fb_probe(struct platform_device *device)
64  
65         da8xx_fb_var.hsync_len = lcdc_info->hsw;
66         da8xx_fb_var.vsync_len = lcdc_info->vsw;
67 +       da8xx_fb_var.pixclock = da8xxfb_pixel_clk_period(par);
68  
69         da8xx_fb_var.right_margin = lcdc_info->hfp;
70         da8xx_fb_var.left_margin  = lcdc_info->hbp;
71 -- 
72 1.7.10