rk3368 lcdc: add CABC mode config
authorhjc <hjc@rock-chips.com>
Fri, 9 Jan 2015 06:44:04 +0000 (14:44 +0800)
committerhjc <hjc@rock-chips.com>
Mon, 23 Mar 2015 07:22:31 +0000 (15:22 +0800)
Signed-off-by: hjc <hjc@rock-chips.com>
drivers/video/of_display_timing.c
drivers/video/rockchip/rk_fb.c
drivers/video/rockchip/rkfb_sysfs.c
include/linux/rk_fb.h
include/linux/rk_screen.h [changed mode: 0755->0644]
include/video/display_timing.h

index 405dbd68a0d45b8c0f5c960f0496e6b432f1d00b..6522edabfa51d0f8b7ad831a01303d43f5e9017f 100644 (file)
@@ -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) {
index d1d1d3f5e93e189e25b4506ba7b1f9fb8258680c..b9e15c4ebf6bb8ae7a93d54d6265777637d82477 100755 (executable)
@@ -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;
index ffbc0fc3df1cce9eb4ce96cb86fd58fb1a70d2e0..74ff5c9fdd58549650b178771a865096d1591c61 100644 (file)
@@ -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),
index e2ace9ca2c846a0aaac2342c9be99bace77ad659..fbc7642aab2449ae22aa222fc397fc5d4a1a8e3d 100755 (executable)
@@ -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*/
old mode 100755 (executable)
new mode 100644 (file)
index 9b59ad8..4c4b778
@@ -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
index 6c5585a6316c6b8e6219dd7151b402c0df02ebc4..82723915e2b3394fd9e26cd56a1d72d66d73e11b 100644 (file)
@@ -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
 };