From: hjc Date: Fri, 9 Jan 2015 06:44:04 +0000 (+0800) Subject: rk3368 lcdc: add CABC mode config X-Git-Tag: firefly_0821_release~4242 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ff4cb4ac6fc0de81aac2a624a804a5df5513119a;p=firefly-linux-kernel-4.4.55.git rk3368 lcdc: add CABC mode config Signed-off-by: hjc --- diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 405dbd68a0d4..6522edabfa51 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -123,6 +123,15 @@ static struct display_timing *of_get_display_timing(struct device_node *np) ret = of_property_read_u32_array(np, "dsp-lut",dt->dsp_lut, length >> 2); } + prop = of_find_property(np, "cabc-lut", &length); + if (prop) { + dt->cabc_lut = kzalloc(length, GFP_KERNEL); + if (dt->cabc_lut) + ret = of_property_read_u32_array(np, + "cabc-lut", + dt->cabc_lut, + length >> 2); + } #endif if (ret) { diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index d1d1d3f5e93e..b9e15c4ebf6b 100755 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -451,6 +451,7 @@ int rk_fb_video_mode_from_timing(const struct display_timing *dt, screen->face = dt->face; screen->color_mode = dt->color_mode; screen->dsp_lut = dt->dsp_lut; + screen->cabc_lut = dt->cabc_lut; if (dt->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE) screen->pin_dclk = 1; diff --git a/drivers/video/rockchip/rkfb_sysfs.c b/drivers/video/rockchip/rkfb_sysfs.c index ffbc0fc3df1c..74ff5c9fdd58 100644 --- a/drivers/video/rockchip/rkfb_sysfs.c +++ b/drivers/video/rockchip/rkfb_sysfs.c @@ -492,6 +492,50 @@ static ssize_t set_hwc_lut(struct device *dev, struct device_attribute *attr, return count; } +static ssize_t show_cabc_lut(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return 0; +} + +static ssize_t set_cabc_lut(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + int cabc_lut[256]; + const char *start = buf; + int i = 256, temp; + int space_max = 10; + + 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; + + for (i = 0; i < 256; i++) { + temp = i; + /*init by default value*/ + cabc_lut[i] = temp + (temp << 8) + (temp << 16); + } + for (i = 0; i < 256; i++) { + space_max = 10; /*max space number 10*/ + temp = simple_strtoul(start, NULL, 10); + cabc_lut[i] = temp; + do { + start++; + space_max--; + } while ((*start != ' ') && space_max); + + if (!space_max) + break; + else + start++; + } + if (dev_drv->ops->set_cabc_lut) + dev_drv->ops->set_cabc_lut(dev_drv, cabc_lut); + + return count; +} + + static ssize_t show_dsp_lut(struct device *dev, struct device_attribute *attr, char *buf) { @@ -772,6 +816,7 @@ static struct device_attribute rkfb_attrs[] = { __ATTR(fps, S_IRUGO | S_IWUSR, show_fps, set_fps), __ATTR(map, S_IRUGO | S_IWUSR, show_fb_win_map, set_fb_win_map), __ATTR(dsp_lut, S_IRUGO | S_IWUSR, show_dsp_lut, set_dsp_lut), + __ATTR(cabc_lut, S_IRUGO | S_IWUSR, show_cabc_lut, set_cabc_lut), __ATTR(hwc_lut, S_IRUGO | S_IWUSR, show_hwc_lut, set_hwc_lut), __ATTR(cabc, S_IRUGO | S_IWUSR, show_dsp_cabc, set_dsp_cabc), __ATTR(bcsh, S_IRUGO | S_IWUSR, show_dsp_bcsh, set_dsp_bcsh), diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index e2ace9ca2c84..fbc7642aab24 100755 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -449,6 +449,7 @@ struct rk_lcdc_drv_ops { int (*fb_win_remap) (struct rk_lcdc_driver *dev_drv, u16 fb_win_map_order); int (*set_dsp_lut) (struct rk_lcdc_driver *dev_drv, int *lut); + int (*set_cabc_lut)(struct rk_lcdc_driver *dev_drv, int *lut); int (*set_hwc_lut) (struct rk_lcdc_driver *dev_drv, int *hwc_lut, int mode); int (*read_dsp_lut) (struct rk_lcdc_driver *dev_drv, int *lut); int (*lcdc_hdmi_process) (struct rk_lcdc_driver *dev_drv, int mode); /*some lcdc need to some process in hdmi mode*/ diff --git a/include/linux/rk_screen.h b/include/linux/rk_screen.h old mode 100755 new mode 100644 index 9b59ad89a0c1..4c4b77885864 --- a/include/linux/rk_screen.h +++ b/include/linux/rk_screen.h @@ -79,7 +79,8 @@ struct rk_screen { u16 width; u16 height; u8 ft; - int *dsp_lut; + int *dsp_lut; + int *cabc_lut; #if defined(CONFIG_MFD_RK616) || defined(CONFIG_LCDC_RK312X) u32 pll_cfg_val; //bellow are for jettaB diff --git a/include/video/display_timing.h b/include/video/display_timing.h index 6c5585a6316c..82723915e2b3 100644 --- a/include/video/display_timing.h +++ b/include/video/display_timing.h @@ -81,6 +81,7 @@ struct display_timing { u16 face; /*display output interface format:24bit 18bit 16bit*/ u16 color_mode; /* input color mode: RGB or YUV */ u32 *dsp_lut; + u32 *cabc_lut; #endif };