rk fb: init default primary screen and hdmi post scale value that overscan value...
authorzwl <zwl@rock-chips.com>
Fri, 9 May 2014 02:36:35 +0000 (10:36 +0800)
committerzwl <zwl@rock-chips.com>
Fri, 9 May 2014 02:36:51 +0000 (10:36 +0800)
drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c
drivers/video/rockchip/lcdc/rk3288_lcdc.c
drivers/video/rockchip/rk_fb.c
drivers/video/rockchip/rkfb_sysfs.c
drivers/video/rockchip/screen/rk_screen.c
include/linux/rk_fb.h
include/linux/rk_screen.h

index 5cf4cc74362cd500c39293e26e1ae601e5b98797..754e4dd0b78eedf801b9288c9e285021a0ce0e87 100755 (executable)
@@ -146,6 +146,12 @@ int hdmi_set_info(struct rk_screen *screen, unsigned int vic)
     /* Operation function*/
     screen->init = NULL;
     screen->standby = NULL;
+
+       /*Init Default Overscan Value: TODO modify the value according to your need adjust value*/
+       screen->overscan.left = 96;
+       screen->overscan.top = 96;
+       screen->overscan.right = 96;
+       screen->overscan.bottom = 96;
     
     return 0;
 }
index 483bb4cd145a7951350d2a8b8df42009aec60303..a757ccdabcfd733a8ef2f5988bdebf34640ddb89 100755 (executable)
@@ -930,10 +930,10 @@ static int rk3288_load_screen(struct rk_lcdc_driver *dev_drv, bool initscreen)
        h_total = hsync_len + left_margin  + x_res + right_margin;
        v_total = vsync_len + upper_margin + y_res + lower_margin;
 
-       screen->post_dsp_stx = x_res * (100 - dev_drv->overscan.left) / 200;
-       screen->post_dsp_sty = y_res * (100 - dev_drv->overscan.top) / 200;
-       screen->post_xsize = x_res * (dev_drv->overscan.left + dev_drv->overscan.right) / 200;
-       screen->post_ysize = y_res * (dev_drv->overscan.top + dev_drv->overscan.bottom) / 200;
+       screen->post_dsp_stx = x_res * (100 - screen->overscan.left) / 200;
+       screen->post_dsp_sty = y_res * (100 - screen->overscan.top) / 200;
+       screen->post_xsize = x_res * (screen->overscan.left + screen->overscan.right) / 200;
+       screen->post_ysize = y_res * (screen->overscan.top + screen->overscan.bottom) / 200;
        
        spin_lock(&lcdc_dev->reg_lock);
        if (likely(lcdc_dev->clk_on)) {
index a1b7c4cf2e54920be29baf88ee9b3486b2b39701..a79dcbc045c91d79f39909d45959ee2aaa9a5ddc 100755 (executable)
@@ -2839,6 +2839,10 @@ static int init_lcdc_device_driver(struct rk_fb *rk_fb,
        
        screen->screen_id = 0;
        screen->lcdc_id = dev_drv->id;
+       screen->overscan.left = 100;
+       screen->overscan.top = 100;
+       screen->overscan.right = 100;
+       screen->overscan.bottom = 100;
        dev_drv->screen0 = screen;
        dev_drv->cur_screen = screen;
        /* devie use one lcdc + rk61x scaler for dual display*/
@@ -2861,10 +2865,6 @@ static int init_lcdc_device_driver(struct rk_fb *rk_fb,
        mutex_init(&dev_drv->fb_win_id_mutex);
        dev_drv->ops->fb_win_remap(dev_drv, FB_DEFAULT_ORDER);
        dev_drv->first_frame = 1;
-       dev_drv->overscan.left = 100;
-       dev_drv->overscan.top = 100;
-       dev_drv->overscan.right = 100;
-       dev_drv->overscan.bottom = 100;
        rk_disp_pwr_ctr_parse_dt(dev_drv);
        if (dev_drv->prop == PRMRY) {
                rk_fb_set_prmry_screen(screen);
index 12788397ea06a66ef1e278ff786091880f8e35dc..47d10fc89030d316814512b5d235bf45f9a39654 100755 (executable)
@@ -377,11 +377,12 @@ static ssize_t show_scale(struct device *dev,
        struct fb_info *fbi = dev_get_drvdata(dev);
        struct rk_lcdc_driver *dev_drv =
            (struct rk_lcdc_driver *)fbi->par;
+       struct rk_screen *screen = dev_drv->cur_screen;
        return snprintf(buf, PAGE_SIZE, "xscale=%d yscale=%d\nleft=%d top=%d right=%d bottom=%d\n",
-               (dev_drv->overscan.left + dev_drv->overscan.right)/2,
-               (dev_drv->overscan.top + dev_drv->overscan.bottom)/2,
-               dev_drv->overscan.left, dev_drv->overscan.top,
-               dev_drv->overscan.right, dev_drv->overscan.bottom);
+               (screen->overscan.left + screen->overscan.right)/2,
+               (screen->overscan.top + screen->overscan.bottom)/2,
+               screen->overscan.left, screen->overscan.top,
+               screen->overscan.right, screen->overscan.bottom);
 }
 
 static ssize_t set_scale(struct device *dev, struct device_attribute *attr,
@@ -390,53 +391,54 @@ static ssize_t set_scale(struct device *dev, struct device_attribute *attr,
        struct fb_info *fbi = dev_get_drvdata(dev);
        struct rk_lcdc_driver *dev_drv =
            (struct rk_lcdc_driver *)fbi->par;
+       struct rk_screen *screen = dev_drv->cur_screen;
        u32 left, top, right, bottom;
 
        if (!strncmp(buf, "overscan", 8)) {
                sscanf(buf, "overscan %d,%d,%d,%d", &left, &top, &right, &bottom);
                if (left > 0 && left <= 100)
-                       dev_drv->overscan.left = left;
+                       screen->overscan.left = left;
                if (top > 0 && top <= 100)
-                       dev_drv->overscan.top = top;
+                       screen->overscan.top = top;
                if (right > 0 && right <= 100)
-                       dev_drv->overscan.right = right;
+                       screen->overscan.right = right;
                if (bottom > 0 && bottom <= 100)
-                       dev_drv->overscan.bottom = bottom;
+                       screen->overscan.bottom = bottom;
        } else if (!strncmp(buf, "left", 4)) {
                sscanf(buf, "left=%d", &left);
                if (left > 0 && left <= 100)
-                       dev_drv->overscan.left = left;
+                       screen->overscan.left = left;
        } else if (!strncmp(buf, "top", 3)) {
                sscanf(buf, "top=%d", &top);
                if (top > 0 && top <= 100)
-                       dev_drv->overscan.top = top;
+                       screen->overscan.top = top;
        } else if (!strncmp(buf, "right", 5)) {
                sscanf(buf, "right=%d", &right);
                if (right > 0 && right <= 100)
-                       dev_drv->overscan.right = right;
+                       screen->overscan.right = right;
        } else if (!strncmp(buf, "bottom", 6)) {
                sscanf(buf, "bottom=%d", &bottom);
                if (bottom > 0 && bottom <= 100)
-                       dev_drv->overscan.bottom = bottom;
+                       screen->overscan.bottom = bottom;
        } else if (!strncmp(buf, "xscale", 6)) {
                sscanf(buf, "xscale=%d", &left);
                if (left > 0 && left <= 100) {
-                       dev_drv->overscan.left = left;
-                       dev_drv->overscan.right = left;
+                       screen->overscan.left = left;
+                       screen->overscan.right = left;
                }
        } else if (!strncmp(buf, "yscale", 6)) {
                sscanf(buf, "yscale=%d", &left);
                if (left > 0 && left <= 100) {
-                       dev_drv->overscan.top = left;
-                       dev_drv->overscan.bottom = left;
+                       screen->overscan.top = left;
+                       screen->overscan.bottom = left;
                }
        } else {
                sscanf(buf, "%d", &left);
                if (left > 0 && left <= 100) {
-                       dev_drv->overscan.left = left;
-                       dev_drv->overscan.right = left;
-                       dev_drv->overscan.top = left;
-                       dev_drv->overscan.bottom = left;
+                       screen->overscan.left = left;
+                       screen->overscan.right = left;
+                       screen->overscan.top = left;
+                       screen->overscan.bottom = left;
                }
        }
 //     printk("%d %d %d %d\n", dev_drv->overscan.left, dev_drv->overscan.top, dev_drv->overscan.right, dev_drv->overscan.bottom);
index 072a3cb8a1058d0bce65fef788a6d4ed5327a8f5..bd799adcf307b89c7ae0bb63e3b416366cc07016 100755 (executable)
@@ -17,6 +17,10 @@ int rk_fb_set_prmry_screen(struct rk_screen *screen)
        rk_screen->screen_id = screen->screen_id;
        rk_screen->x_mirror = screen->x_mirror;
        rk_screen->y_mirror = screen->y_mirror;
+       rk_screen->overscan.left = screen->overscan.left;
+       rk_screen->overscan.top = screen->overscan.left;
+       rk_screen->overscan.right = screen->overscan.left;
+       rk_screen->overscan.bottom = screen->overscan.left;
        return 0;
 }
 
index 4d57d110daea1b91124f2a577e1a19d9f6bb8c4e..e0655cfa42629a27119997190b22824c1529989a 100755 (executable)
@@ -475,13 +475,6 @@ struct rk_fb_reg_data {
        //int     fence_wait_begin;
 };
 
-struct overscan {
-       unsigned char left;
-       unsigned char top;
-       unsigned char right;
-       unsigned char bottom;
-};
-
 struct rk_lcdc_driver {
        char name[6];
        int id;
@@ -496,7 +489,6 @@ struct rk_lcdc_driver {
        struct rk_screen *screen0;      //some platform have only one lcdc,but extend
        struct rk_screen *screen1;      //two display devices for dual display,such as rk2918,rk2928
        struct rk_screen *cur_screen;   //screen0 is primary screen ,like lcd panel,screen1 is  extend screen,like hdmi
-       struct overscan overscan;
        u32 pixclock;
 
        char fb0_win_id;
index 4888ee88379f539b5554d4952ad8af13a3af82bd..4ee4960d49d5529459b2b1104481dfe3917f0e0a 100755 (executable)
@@ -47,6 +47,12 @@ struct rk29lcd_info {
        int (*io_disable)(void);
 };
 
+struct overscan {
+       unsigned char left;
+       unsigned char top;
+       unsigned char right;
+       unsigned char bottom;
+};
 
 /* Screen description 
 *type:LVDS,RGB,MIPI,MCU
@@ -109,6 +115,7 @@ struct rk_screen {
        int ypos;
        int xsize; //horizontal and vertical display size on he screen,they can be changed by application
        int ysize;
+       struct overscan overscan;
        struct rk_screen *ext_screen;
        /* Operation function*/
        int (*init)(void);