From 07aae424aecf2a0d233fcd374840573c61a88e40 Mon Sep 17 00:00:00 2001 From: Huang Jiachai Date: Mon, 1 Feb 2016 10:02:49 +0800 Subject: [PATCH] video: rockchip: add win property node for application layer Change-Id: I2e96d531d8fd1cf9eda665e4912501e4bec4d954 Signed-off-by: Huang Jiachai --- drivers/video/rockchip/lcdc/rk3368_lcdc.c | 52 ++++++++++++++--------- drivers/video/rockchip/rk_fb.c | 3 ++ drivers/video/rockchip/rkfb_sysfs.c | 18 ++++++++ include/linux/rk_fb.h | 16 +++++++ 4 files changed, 69 insertions(+), 20 deletions(-) diff --git a/drivers/video/rockchip/lcdc/rk3368_lcdc.c b/drivers/video/rockchip/lcdc/rk3368_lcdc.c index 16b7a375c0a7..a1786d5346db 100644 --- a/drivers/video/rockchip/lcdc/rk3368_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3368_lcdc.c @@ -53,30 +53,42 @@ module_param(dbg_thresd, int, S_IRUGO | S_IWUSR); #define EARLY_TIME 500 /*us*/ static struct rk_lcdc_win lcdc_win[] = { [0] = { - .name = "win0", - .id = 0, - .support_3d = false, - }, + .name = "win0", + .id = 0, + .property.feature = SUPPORT_WIN_IDENTIFY | SUPPORT_SCALE | + SUPPORT_YUV, + .property.max_input_x = 4096, + .property.max_input_y = 2304 + }, [1] = { - .name = "win1", - .id = 1, - .support_3d = false, - }, + .name = "win1", + .id = 1, + .property.feature = SUPPORT_WIN_IDENTIFY | SUPPORT_SCALE | + SUPPORT_YUV, + .property.max_input_x = 4096, + .property.max_input_y = 2304 + }, [2] = { - .name = "win2", - .id = 2, - .support_3d = false, - }, + .name = "win2", + .id = 2, + .property.feature = SUPPORT_WIN_IDENTIFY | SUPPORT_MULTI_AREA, + .property.max_input_x = 4096, + .property.max_input_y = 2304 + }, [3] = { - .name = "win3", - .id = 3, - .support_3d = false, - }, + .name = "win3", + .id = 3, + .property.feature = SUPPORT_WIN_IDENTIFY | SUPPORT_MULTI_AREA, + .property.max_input_x = 4096, + .property.max_input_y = 2304 + }, [4] = { - .name = "hwc", - .id = 4, - .support_3d = false, - } + .name = "hwc", + .id = 4, + .property.feature = SUPPORT_WIN_IDENTIFY | SUPPORT_HWC_LAYER, + .property.max_input_x = 128, + .property.max_input_y = 128 + }, }; static int rk3368_lcdc_set_bcsh(struct rk_lcdc_driver *dev_drv, bool enable); diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 9fb1a5eeb20f..04029f75100d 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -3946,6 +3946,9 @@ static int init_lcdc_win(struct rk_lcdc_driver *dev_drv, strcpy(win->name, def_win[i].name); win->id = def_win[i].id; win->support_3d = def_win[i].support_3d; + win->property.feature = def_win[i].property.feature; + win->property.max_input_x = def_win[i].property.max_input_x; + win->property.max_input_y = def_win[i].property.max_input_y; dev_drv->win[i] = win; } diff --git a/drivers/video/rockchip/rkfb_sysfs.c b/drivers/video/rockchip/rkfb_sysfs.c index 99e2dcf4c462..7fc7cd8f80ae 100644 --- a/drivers/video/rockchip/rkfb_sysfs.c +++ b/drivers/video/rockchip/rkfb_sysfs.c @@ -1194,6 +1194,23 @@ static ssize_t show_lcdc_id(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", dev_drv->id); } +static ssize_t show_win_property(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct fb_info *fbi = dev_get_drvdata(dev); + struct rk_fb_par *fb_par = (struct rk_fb_par *)fbi->par; + struct rk_lcdc_driver *dev_drv = fb_par->lcdc_drv; + int win_id = 0; + + win_id = dev_drv->ops->fb_get_win_id(dev_drv, fbi->fix.id); + return snprintf(buf, PAGE_SIZE, + "feature: %d, max_input_x: %d, max_input_y: %d\n", + dev_drv->win[win_id]->property.feature, + dev_drv->win[win_id]->property.max_input_x, + dev_drv->win[win_id]->property.max_input_y); +} + static struct device_attribute rkfb_attrs[] = { __ATTR(phys_addr, S_IRUGO, show_phys, NULL), __ATTR(virt_addr, S_IRUGO, show_virt, NULL), @@ -1213,6 +1230,7 @@ static struct device_attribute rkfb_attrs[] = { __ATTR(bcsh, S_IRUGO | S_IWUSR, show_dsp_bcsh, set_dsp_bcsh), __ATTR(scale, S_IRUGO | S_IWUSR, show_scale, set_scale), __ATTR(lcdcid, S_IRUGO, show_lcdc_id, NULL), + __ATTR(win_property, S_IRUGO, show_win_property, NULL), }; int rkfb_create_sysfs(struct fb_info *fbi) diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index 9601168822ec..dcb9251617ec 100755 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -280,6 +280,21 @@ struct rk_vop_property { u32 max_output_y; }; +enum rk_win_feature { + SUPPORT_WIN_IDENTIFY = BIT(0), + SUPPORT_SCALE = BIT(1), + SUPPORT_YUV = BIT(2), + SUPPORT_YUV10BIT = BIT(3), + SUPPORT_MULTI_AREA = BIT(4), + SUPPORT_HWC_LAYER = BIT(5) +}; + +struct rk_win_property { + u32 feature; + u32 max_input_x; + u32 max_input_y; +}; + struct rk_fb_rgb { struct fb_bitfield red; struct fb_bitfield green; @@ -412,6 +427,7 @@ struct rk_lcdc_win_area { struct rk_lcdc_win { char name[5]; int id; + struct rk_win_property property; bool state; /*on or off*/ bool last_state; /*on or off*/ u32 pseudo_pal[16]; -- 2.34.1