From: zwl Date: Fri, 9 May 2014 02:36:35 +0000 (+0800) Subject: rk fb: init default primary screen and hdmi post scale value that overscan value... X-Git-Tag: firefly_0821_release~5318 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1fe724b4d3665d6a71e5737b557083bf7ce574f1;p=firefly-linux-kernel-4.4.55.git rk fb: init default primary screen and hdmi post scale value that overscan value may use for hdmi --- diff --git a/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c b/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c index 5cf4cc74362c..754e4dd0b78e 100755 --- a/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c +++ b/drivers/video/rockchip/hdmi/rk_hdmi_lcdc.c @@ -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; } diff --git a/drivers/video/rockchip/lcdc/rk3288_lcdc.c b/drivers/video/rockchip/lcdc/rk3288_lcdc.c index 483bb4cd145a..a757ccdabcfd 100755 --- a/drivers/video/rockchip/lcdc/rk3288_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3288_lcdc.c @@ -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)) { diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index a1b7c4cf2e54..a79dcbc045c9 100755 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -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); diff --git a/drivers/video/rockchip/rkfb_sysfs.c b/drivers/video/rockchip/rkfb_sysfs.c index 12788397ea06..47d10fc89030 100755 --- a/drivers/video/rockchip/rkfb_sysfs.c +++ b/drivers/video/rockchip/rkfb_sysfs.c @@ -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); diff --git a/drivers/video/rockchip/screen/rk_screen.c b/drivers/video/rockchip/screen/rk_screen.c index 072a3cb8a105..bd799adcf307 100755 --- a/drivers/video/rockchip/screen/rk_screen.c +++ b/drivers/video/rockchip/screen/rk_screen.c @@ -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; } diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index 4d57d110daea..e0655cfa4262 100755 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -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; diff --git a/include/linux/rk_screen.h b/include/linux/rk_screen.h index 4888ee88379f..4ee4960d49d5 100755 --- a/include/linux/rk_screen.h +++ b/include/linux/rk_screen.h @@ -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);