From: yxj Date: Sat, 27 Apr 2013 03:39:38 +0000 (+0800) Subject: rk fb:reset fb parameters in fb close X-Git-Tag: firefly_0821_release~7207 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5fcb712a27267ab9fa9168954ad53079d5d19066;p=firefly-linux-kernel-4.4.55.git rk fb:reset fb parameters in fb close --- diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 4fd861dd15e3..9a88e441eec5 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -135,6 +135,35 @@ static int rk_fb_open(struct fb_info *info,int user) static int rk_fb_close(struct fb_info *info,int user) { + struct rk_lcdc_device_driver * dev_drv = (struct rk_lcdc_device_driver * )info->par; + struct layer_par *par = NULL; + int layer_id = dev_drv->fb_get_layer(dev_drv,info->fix.id); + if(layer_id >= 0) + { + par = dev_drv->layer_par[layer_id]; + info->fix.smem_start = par->reserved; + + info->var.xres = dev_drv->cur_screen->x_res; + info->var.yres = dev_drv->cur_screen->y_res; + info->var.grayscale |= (info->var.xres<<8) + (info->var.yres<<20); +#ifdef CONFIG_LOGO_LINUX_BMP + info->var.bits_per_pixel = 32; +#else + info->var.bits_per_pixel = 16; +#endif + info->fix.line_length = (info->var.xres)*(info->var.bits_per_pixel>>3); + info->var.xres_virtual = info->var.xres; + info->var.yres_virtual = info->var.yres; + info->var.width = dev_drv->cur_screen->width; + info->var.height = dev_drv->cur_screen->height; + info->var.pixclock = dev_drv->pixclock; + info->var.left_margin = dev_drv->cur_screen->left_margin; + info->var.right_margin = dev_drv->cur_screen->right_margin; + info->var.upper_margin = dev_drv->cur_screen->upper_margin; + info->var.lower_margin = dev_drv->cur_screen->lower_margin; + info->var.vsync_len = dev_drv->cur_screen->vsync_len; + info->var.hsync_len = dev_drv->cur_screen->hsync_len; + } /*struct rk_lcdc_device_driver * dev_drv = (struct rk_lcdc_device_driver * )info->par; int layer_id; CHK_SUSPEND(dev_drv); @@ -1040,6 +1069,9 @@ int rk_fb_disp_scale(u8 scale_x, u8 scale_y,u8 lcdc_id) static int rk_request_fb_buffer(struct fb_info *fbi,int fb_id) { + struct rk_lcdc_device_driver * dev_drv = (struct rk_lcdc_device_driver * )fbi->par; + struct layer_par *par = NULL; + int layer_id; struct resource *res; struct resource *mem; int ret = 0; @@ -1082,6 +1114,14 @@ static int rk_request_fb_buffer(struct fb_info *fbi,int fb_id) printk("fb%d:phy:%lx>>vir:%p>>len:0x%x\n",fb_id, fbi->fix.smem_start,fbi->screen_base,fbi->fix.smem_len); } + + layer_id = dev_drv->fb_get_layer(dev_drv,fbi->fix.id); + if(layer_id >= 0) + { + par = dev_drv->layer_par[layer_id]; + par->reserved = fbi->fix.smem_start; + } + return ret; } diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index 4903854f2285..04c266906c4d 100644 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -229,6 +229,7 @@ struct layer_par { u32 uv_addr; u8 fmt_cfg; u8 swap_rb; + u32 reserved; };