mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
rk3368 lcdc: add CABC mode config
Signed-off-by: hjc <hjc@rock-chips.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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*/
|
||||
|
||||
3
include/linux/rk_screen.h
Executable file → Normal file
3
include/linux/rk_screen.h
Executable file → Normal file
@@ -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
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user