From 5da8903539b59b75c0244c9d076759fdf2e04349 Mon Sep 17 00:00:00 2001 From: Huang Jiachai Date: Wed, 30 Mar 2016 15:21:43 +0800 Subject: [PATCH] video: rockchip: fb: add parse screen physical size Change-Id: I98ad62b55d268150ff256407b6bdf06a8ad14a37 Signed-off-by: Huang Jiachai --- drivers/video/of_display_timing.c | 6 +++++- drivers/video/rockchip/rk_fb.c | 4 ++++ include/video/display_timing.h | 8 +++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 6c2fc91aae0b..e393412faf66 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -112,7 +112,11 @@ static int of_parse_display_timing(const struct device_node *np, if (!of_property_read_u32(np, "out-face", &val)) dt->face = val; if (!of_property_read_u32(np, "color-mode", &val)) - dt->color_mode = val; + dt->color_mode = val; + if (!of_property_read_u32(np, "screen-width", &val)) + dt->screen_widt = val; + if (!of_property_read_u32(np, "screen-hight", &val)) + dt->screen_hight = val; prop = of_find_property(np, "dsp-lut", &length); if (prop) { dt->dsp_lut = kzalloc(length, GFP_KERNEL); diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 8e703de9db2a..d7aad15415d2 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -495,6 +495,8 @@ int rk_fb_video_mode_from_timing(const struct display_timing *dt, screen->lvds_format = dt->lvds_format; screen->face = dt->face; screen->color_mode = dt->color_mode; + screen->width = dt->screen_widt; + screen->height = dt->screen_hight; screen->dsp_lut = dt->dsp_lut; screen->cabc_lut = dt->cabc_lut; screen->cabc_gamma_base = dt->cabc_gamma_base; @@ -4174,6 +4176,8 @@ int rk_fb_register(struct rk_lcdc_driver *dev_drv, fbi->fix = def_fix; sprintf(fbi->fix.id, "fb%d", rk_fb->num_fb); fb_videomode_to_var(&fbi->var, &dev_drv->cur_screen->mode); + fbi->var.width = dev_drv->cur_screen->width; + fbi->var.height = dev_drv->cur_screen->height; fbi->var.grayscale |= (fbi->var.xres << 8) + (fbi->var.yres << 20); #if defined(CONFIG_LOGO_LINUX_BMP) diff --git a/include/video/display_timing.h b/include/video/display_timing.h index 82e7adc68c89..0ff62c5e16f8 100644 --- a/include/video/display_timing.h +++ b/include/video/display_timing.h @@ -78,9 +78,11 @@ struct display_timing { enum display_flags flags; /* display flags */ #if defined(CONFIG_FB_ROCKCHIP) u16 screen_type; /*screen type*/ - u16 lvds_format; /*lvds data format*/ - u16 face; /*display output interface*/ - u16 color_mode; /*input color mode: RGB/YUV*/ + u16 screen_widt; /* screen physical size */ + u16 screen_hight; + u16 lvds_format; /*lvds data format for lvds screen*/ + u16 face; /*display output interface format:24bit 18bit 16bit*/ + u16 color_mode; /* input color mode: RGB or YUV */ u32 *dsp_lut; u32 *cabc_lut; u32 *cabc_gamma_base; -- 2.34.1