struct fb_info *fbi = dev_get_drvdata(dev);
struct rk_lcdc_device_driver * dev_drv =
(struct rk_lcdc_device_driver * )fbi->par;
- int layer_id = get_fb_layer_id(&fbi->fix);
+ int layer_id = dev_drv->fb_get_layer(dev_drv,fbi->fix.id);
if(dev_drv->get_disp_info)
dev_drv->get_disp_info(dev_drv,layer_id);
struct fb_info *fbi = dev_get_drvdata(dev);
struct rk_lcdc_device_driver * dev_drv =
(struct rk_lcdc_device_driver * )fbi->par;
- int layer_id = get_fb_layer_id(&fbi->fix);
+ int layer_id = dev_drv->fb_get_layer(dev_drv,fbi->fix.id);
int state = dev_drv->get_layer_state(dev_drv,layer_id);
return snprintf(buf, PAGE_SIZE, "%s\n",state?"enabled":"disabled");
const char *buf, size_t count)
{
struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+ int layer_id = dev_drv->fb_get_layer(dev_drv,fbi->fix.id);
int state;
int ret;
ret = kstrtoint(buf, 0, &state);
{
return ret;
}
- if(state)
+ dev_drv->open(dev_drv,layer_id,state);
+ return count;
+}
+
+static ssize_t show_overlay(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+ int ovl;
+ ovl = dev_drv->ovl_mgr(dev_drv,0,0);
+ if(ovl < 0)
{
- fbi->fbops->fb_open(fbi,1);
+ return ovl;
+ }
+
+ return snprintf(buf, PAGE_SIZE, "%s\n",
+ ovl?"win0 on the top of win1":"win1 on the top of win0");
+
+}
+static ssize_t set_overlay(struct device *dev,struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+ int ovl;
+ int ret;
+ ret = kstrtoint(buf, 0, &ovl);
+ if(ret)
+ {
+ return ret;
+ }
+ ret = dev_drv->ovl_mgr(dev_drv,ovl,1);
+ if(ret < 0)
+ {
+ return ret;
+ }
+
+ return count;
+}
+
+
+static ssize_t show_fps(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+ int fps;
+ fps = dev_drv->fps_mgr(dev_drv,0,0);
+ if(fps < 0)
+ {
+ return fps;
+ }
+
+ return snprintf(buf, PAGE_SIZE, "fps:%d\n",fps);
+
+}
+
+static ssize_t set_fps(struct device *dev,struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+ int fps;
+ int ret;
+ ret = kstrtoint(buf, 0, &fps);
+ if(ret)
+ {
+ return ret;
+ }
+ ret = dev_drv->fps_mgr(dev_drv,fps,1);
+ if(ret < 0)
+ {
+ return ret;
+ }
+
+ return count;
+}
+
+static ssize_t show_fb_win_map(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int ret;
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+
+ mutex_lock(&dev_drv->fb_win_id_mutex);
+ ret = snprintf(buf, PAGE_SIZE,"fb0:win%d\nfb1:win%d\nfb2:win%d\n",dev_drv->fb0_win_id,dev_drv->fb1_win_id,
+ dev_drv->fb2_win_id);
+ mutex_unlock(&dev_drv->fb_win_id_mutex);
+
+ return ret;
+
+}
+
+static ssize_t set_fb_win_map(struct device *dev,struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+ int order;
+ int ret;
+ ret = kstrtoint(buf, 0, &order);
+ if((order != FB0_WIN2_FB1_WIN1_FB2_WIN0) && (order != FB0_WIN1_FB1_WIN2_FB2_WIN0 ) &&
+ (order != FB0_WIN2_FB1_WIN0_FB2_WIN1) && (order != FB0_WIN0_FB1_WIN2_FB2_WIN1 ) &&
+ (order != FB0_WIN0_FB1_WIN1_FB2_WIN2) && (order != FB0_WIN1_FB1_WIN0_FB2_WIN2 ))
+ {
+ printk(KERN_ERR "un support map\nyou can use the following order: \
+ \n201:\nfb0-win1\nfb1-win0\nfb2-win2\n \
+ \n210:\nfb0-win0\nfb1-win1\nfb2-win2\n \
+ \n120:\nfb0-win0\nfb1-win2\nfb2-win1\n \
+ \n102:\nfb0-win2\nfb1-win0\nfb2-win1\n \
+ \n021:\nfb0-win1\nfb1-win2\nfb2-win0\n \
+ \n012:\nfb0-win2\nfb1-win1\nfb2-win0\n");
+ return count;
}
else
{
- fbi->fbops->fb_release(fbi,1);
+ dev_drv->fb_layer_remap(dev_drv,order);
+ }
+
+ return count;
+
+
+}
+
+static ssize_t show_dsp_lut(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+
+}
+static ssize_t set_dsp_lut(struct device *dev,struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int dsp_lut[256];
+ char *start = buf;
+ int i=256,temp;
+ int space_max = 10;
+
+ struct fb_info *fbi = dev_get_drvdata(dev);
+ struct rk_lcdc_device_driver * dev_drv =
+ (struct rk_lcdc_device_driver * )fbi->par;
+
+ for(i=0;i<256;i++)
+ {
+ temp = i;
+ dsp_lut[i] = temp + (temp<<8) + (temp<<16); //init by default value
}
+ printk("%s\n",start);
+ for(i=0;i<256;i++)
+ {
+ temp = simple_strtoul(start,NULL,10);
+ do
+ {
+ start++;
+ space_max--;
+ }while ((*start != ' ')&&space_max);
+
+ if(!space_max)
+ break;
+ else
+ start++;
+ }
+
+ dev_drv->set_dsp_lut(dev_drv,dsp_lut);
+
return count;
+
}
static struct device_attribute rkfb_attrs[] = {
__ATTR(disp_info, S_IRUGO, show_disp_info, NULL),
__ATTR(screen_info, S_IRUGO, show_screen_info, NULL),
__ATTR(enable, S_IRUGO | S_IWUSR, show_fb_state, set_fb_state),
+ __ATTR(overlay, S_IRUGO | S_IWUSR, show_overlay, set_overlay),
+ __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),
};
int rkfb_create_sysfs(struct fb_info *fbi)