rk30 fb: add sys for debug,add rk_get_lcdc_drv for hdmi
authoryxj <yxj@rock-chips.com>
Thu, 29 Mar 2012 09:05:40 +0000 (17:05 +0800)
committeryxj <yxj@rock-chips.com>
Thu, 29 Mar 2012 09:16:52 +0000 (17:16 +0800)
drivers/video/rockchip/Makefile
drivers/video/rockchip/chips/rk30_lcdc.c
drivers/video/rockchip/rk_fb.c
drivers/video/rockchip/rk_fb.h [deleted file]
drivers/video/rockchip/rkfb_sysfs.c [new file with mode: 0644]
include/linux/rk_fb.h [new file with mode: 0644]

index efd39468e08dc0d70e4999e931ff78f237b775cf..90f3b91aa59151e406b4d12a3cb96abb0636d588 100644 (file)
@@ -1,3 +1,3 @@
-obj-$(CONFIG_FB_ROCKCHIP) += rk_fb.o
+obj-$(CONFIG_FB_ROCKCHIP) += rk_fb.o rkfb_sysfs.o
 obj-$(CONFIG_LCDC_RK30) += chips/rk30_lcdc.o  
 obj-$(CONFIG_RGA_RK30) += rga/
index a4517a590714795e06754782b48e9bb4ab661456..26a7a1af000e481df9083be17cd5e08c4023c3e2 100644 (file)
 
 #include <mach/board.h>
 #include "../../display/screen/screen.h"
-#include "../rk_fb.h"
+#include <linux/rk_fb.h>
 #include "rk30_lcdc.h"
 
 
 
 
+
+
 static int dbg_thresd = 0;
 module_param(dbg_thresd, int, S_IRUGO|S_IWUSR);
 #define DBG(x...) do { if(unlikely(dbg_thresd)) printk(KERN_INFO x); } while (0)
@@ -87,9 +89,10 @@ static int rk30_lcdc_deinit(struct rk30_lcdc_device *lcdc_dev)
        return 0;
 }
 
-int rk30_load_screen(struct rk30_lcdc_device*lcdc_dev, bool initscreen)
+static int rk30_load_screen(struct rk_lcdc_device_driver *dev_drv, bool initscreen)
 {
        int ret = -EINVAL;
+       struct rk30_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk30_lcdc_device,driver);
        rk_screen *screen = lcdc_dev->screen;
        u16 face;
        u16 mcu_total, mcu_rwstart, mcu_csstart, mcu_rwend, mcu_csend;
@@ -549,8 +552,8 @@ static struct rk_lcdc_device_driver lcdc_driver = {
        .set_par                = rk30_lcdc_set_par,
        .blank                  = rk30_lcdc_blank,
        .pan_display            = rk30_lcdc_pan_display,
+       .load_screen            = rk30_load_screen,
 };
-
 static int __devinit rk30_lcdc_probe (struct platform_device *pdev)
 {
        struct rk30_lcdc_device *lcdc_dev=NULL;
@@ -619,7 +622,7 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev)
                printk(KERN_ERR "init rk30 lcdc failed!\n");
                goto err3;
        }
-       ret = rk30_load_screen(lcdc_dev,1);
+       ret = rk30_load_screen(&(lcdc_dev->driver),1);
        if(ret < 0)
        {
                printk(KERN_ERR "rk30 load screen for lcdc0 failed!\n");
index f720b7c36941c3143775954bf4f5e2e8abe583e1..78ba1805afec46da7b18921fd34a510aa4cc62ed 100644 (file)
@@ -30,9 +30,9 @@
 #include <asm/div64.h>
 #include <asm/uaccess.h>
 #include <mach/board.h>
-
 #include "../display/screen/screen.h"
-#include "rk_fb.h"
+#include<linux/rk_fb.h>
+
 
 #if 0
        #define fbprintk(msg...)        printk(msg);
@@ -71,7 +71,7 @@ defautl:we alloc three buffer,one for fb0 and fb2 display ui,one for ipp rotate
         pass the phy addr to fix.smem_start by ioctl
 ****************************************************************************/
 
-static int get_fb_layer_id(struct fb_fix_screeninfo *fix)
+int get_fb_layer_id(struct fb_fix_screeninfo *fix)
 {
        int layer_id;
        if(!strcmp(fix->id,"fb1")||!strcmp(fix->id,"fb3"))
@@ -90,6 +90,17 @@ static int get_fb_layer_id(struct fb_fix_screeninfo *fix)
 
        return layer_id;
 }
+
+/**********************************************************************
+this is for hdmi
+id: lcdc id ,0 for lcdc0 ,1 for lcdc1
+***********************************************************************/
+struct rk_lcdc_device_driver * rk_get_lcdc_drv(int  id)
+{
+       struct rk_fb_inf *inf =  platform_get_drvdata(g_fb_pdev);
+       return inf->lcdc_dev_drv[id];
+       
+}
 static int rk_fb_open(struct fb_info *info,int user)
 {
     struct rk_fb_inf *inf = dev_get_drvdata(info->device);
@@ -655,6 +666,7 @@ int rk_fb_register(struct rk_lcdc_device_driver *dev_drv)
             printk("%s>>fb%d register_framebuffer fail!\n",__func__,fb_inf->num_fb);
             ret = -EINVAL;
         }
+       rkfb_create_sysfs(fbi);
         fb_inf->fb[fb_inf->num_fb] = fbi;
         printk("%s>>>>>%s\n",__func__,fb_inf->fb[fb_inf->num_fb]->fix.id);
         fb_inf->num_fb++;      
diff --git a/drivers/video/rockchip/rk_fb.h b/drivers/video/rockchip/rk_fb.h
deleted file mode 100644 (file)
index 8543391..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/* drivers/video/rk30_fb.h
- *
- * Copyright (C) 2010 ROCKCHIP, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __ARCH_ARM_MACH_RK30_FB_H
-#define __ARCH_ARM_MACH_RK30_FB_H
-
-#define RK30_MAX_LCDC_SUPPORT  4
-#define RK30_MAX_LAYER_SUPPORT 4
-#define RK_MAX_FB_SUPPORT     4
-
-
-
-#define FB0_IOCTL_STOP_TIMER_FLUSH             0x6001
-#define FB0_IOCTL_SET_PANEL                            0x6002
-
-#ifdef CONFIG_FB_WIMO
-#define FB_WIMO_FLAG
-#endif
-#ifdef FB_WIMO_FLAG
-#define FB0_IOCTL_SET_BUF                                      0x6017
-#define FB0_IOCTL_COPY_CURBUF                          0x6018
-#define FB0_IOCTL_CLOSE_BUF                            0x6019
-#endif
-
-#define FB1_IOCTL_GET_PANEL_SIZE               0x5001
-#define FB1_IOCTL_SET_YUV_ADDR                 0x5002
-//#define FB1_TOCTL_SET_MCU_DIR                        0x5003
-#define FB1_IOCTL_SET_ROTATE            0x5003
-#define FB1_IOCTL_SET_I2P_ODD_ADDR      0x5005
-#define FB1_IOCTL_SET_I2P_EVEN_ADDR     0x5006
-#define FB1_IOCTL_SET_WIN0_TOP          0x5018
-
-/********************************************************************
-**              display output interface supported by rk lcdc                       *
-********************************************************************/
-/* */
-#define OUT_P888            0
-#define OUT_P666            1    //
-#define OUT_P565            2    //
-#define OUT_S888x           4
-#define OUT_CCIR656         6
-#define OUT_S888            8
-#define OUT_S888DUMY        12
-#define OUT_P16BPP4         24  //
-#define OUT_D888_P666       0x21  //
-#define OUT_D888_P565       0x22  //
-
-
-/**
- * pixel format definitions,this is copy from android/system/core/include/system/graphics.h
- */
-
-enum {
-    HAL_PIXEL_FORMAT_RGBA_8888          = 1,
-    HAL_PIXEL_FORMAT_RGBX_8888          = 2,
-    HAL_PIXEL_FORMAT_RGB_888            = 3,
-    HAL_PIXEL_FORMAT_RGB_565            = 4,
-    HAL_PIXEL_FORMAT_BGRA_8888          = 5,
-    HAL_PIXEL_FORMAT_RGBA_5551          = 6,
-    HAL_PIXEL_FORMAT_RGBA_4444          = 7,
-
-    /* 0x8 - 0xFF range unavailable */
-
-    /*
-     * 0x100 - 0x1FF
-     *
-     * This range is reserved for pixel formats that are specific to the HAL
-     * implementation.  Implementations can use any value in this range to
-     * communicate video pixel formats between their HAL modules.  These formats
-     * must not have an alpha channel.  Additionally, an EGLimage created from a
-     * gralloc buffer of one of these formats must be supported for use with the
-     * GL_OES_EGL_image_external OpenGL ES extension.
-     */
-
-    /*
-     * Android YUV format:
-     *
-     * This format is exposed outside of the HAL to software decoders and
-     * applications.  EGLImageKHR must support it in conjunction with the
-     * OES_EGL_image_external extension.
-     *
-     * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
-     * by (W/2) x (H/2) Cr and Cb planes.
-     *
-     * This format assumes
-     * - an even width
-     * - an even height
-     * - a horizontal stride multiple of 16 pixels
-     * - a vertical stride equal to the height
-     *
-     *   y_size = stride * height
-     *   c_size = ALIGN(stride/2, 16) * height/2
-     *   size = y_size + c_size * 2
-     *   cr_offset = y_size
-     *   cb_offset = y_size + c_size
-     *
-     */
-    HAL_PIXEL_FORMAT_YV12   = 0x32315659, // YCrCb 4:2:0 Planar
-
-
-
-    /* Legacy formats (deprecated), used by ImageFormat.java */
-    HAL_PIXEL_FORMAT_YCbCr_422_SP       = 0x10, // NV16
-    HAL_PIXEL_FORMAT_YCrCb_420_SP       = 0x11, // NV21
-    HAL_PIXEL_FORMAT_YCbCr_422_I        = 0x14, // YUY2
-    HAL_PIXEL_FORMAT_YCrCb_NV12         = 0x20, // YUY2
-    HAL_PIXEL_FORMAT_YCrCb_NV12_VIDEO   = 0x21, // YUY2
-    HAL_PIXEL_FORMAT_YCrCb_444          = 0x22, //yuv444
-
-
-};
-
-
-//display data format
-enum data_format{
-       ARGB888 = 0,
-       RGB888,
-       RGB565,
-       YUV420 = 4,
-       YUV422,
-       YUV444,
-};
-
-struct rk_fb_rgb {
-       struct fb_bitfield      red;
-       struct fb_bitfield      green;
-       struct fb_bitfield      blue;
-       struct fb_bitfield      transp;
-};
-
-typedef enum _TRSP_MODE
-{
-    TRSP_CLOSE = 0,
-    TRSP_FMREG,
-    TRSP_FMREGEX,
-    TRSP_FMRAM,
-    TRSP_FMRAMEX,
-    TRSP_MASK,
-    TRSP_INVAL
-} TRSP_MODE;
-
-struct layer_par {
-    const char *name;
-    int id;
-    u32        pseudo_pal[16];
-    u32 y_offset;       //yuv/rgb offset  -->LCDC_WINx_YRGB_MSTx
-    u32 c_offset;     //cb cr offset--->LCDC_WINx_CBR_MSTx
-    u32 xpos;         //start point in panel  --->LCDC_WINx_DSP_ST
-    u32 ypos;
-    u16 xsize;        // display window width/height  -->LCDC_WINx_DSP_INFO
-    u16 ysize;          
-    u16 xact;        //origin display window size -->LCDC_WINx_ACT_INFO
-    u16 yact;
-    u16 xvir;       //virtual width/height     -->LCDC_WINx_VIR
-    u16 yvir;
-    unsigned long smem_start;
-    unsigned long cbr_start;  // Cbr memory start address
-    enum data_format format;
-       
-    bool support_3d;
-    
-};
-
-struct rk_lcdc_device_driver{
-       char name[6];
-       int id;
-       struct device  *dev;
-       
-       struct layer_par *layer_par;
-       int num_layer;
-       int fb_index_base;                     //the first fb index of the lcdc device
-       rk_screen *screen;
-       u32 pixclock;
-       int (*ioctl)(struct rk_lcdc_device_driver *dev_drv, unsigned int cmd,unsigned long arg,int layer_id);
-       int (*suspend)(struct layer_par *layer_par);
-       int (*resume)(struct layer_par *layer_par);
-       int (*blank)(struct rk_lcdc_device_driver *dev_drv,int layer_id,int blank_mode);
-       int (*set_par)(struct rk_lcdc_device_driver *dev_drv,int layer_id);
-       int (*pan_display)(struct rk_lcdc_device_driver *dev_drv,int layer_id);
-       
-};
-
-struct rk_fb_inf {
-    struct fb_info *fb[RK_MAX_FB_SUPPORT];
-    int num_fb;
-    
-    struct rk_lcdc_device_driver *lcdc_dev_drv[RK30_MAX_LCDC_SUPPORT];
-    int num_lcdc;
-
-    int video_mode;  //when play video set it to 1
-};
-extern int rk_fb_register(struct rk_lcdc_device_driver *fb_device_driver);
-extern int rk_fb_unregister(struct rk_lcdc_device_driver *fb_device_driver);
-extern int init_lcdc_device_driver(struct rk_lcdc_device_driver *def_drv,
-       struct rk_lcdc_device_driver *dev_drv,int id);
-#endif
diff --git a/drivers/video/rockchip/rkfb_sysfs.c b/drivers/video/rockchip/rkfb_sysfs.c
new file mode 100644 (file)
index 0000000..7e36b2a
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * linux/drivers/video/rockchip/rkfb-sysfs.c
+ *
+ * Copyright (C) 2012 Rockchip Corporation
+ * Author: yxj<yxj@rock-chips.com>
+ *
+ * Some code and ideas taken from 
+ *drivers/video/omap2/omapfb/omapfb-sys.c
+ *driver by Tomi Valkeinen.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/fb.h>
+#include <linux/sysfs.h>
+#include <linux/device.h>
+#include <linux/uaccess.h>
+#include <linux/platform_device.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <asm/div64.h>
+#include "../display/screen/screen.h"
+#include <linux/rk_fb.h>
+
+
+static ssize_t show_screen_info(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;
+       rk_screen * screen = dev_drv->screen;
+       int fps;
+       u64 ft = (u64)(screen->upper_margin + screen->lower_margin + screen->y_res +screen->vsync_len)*
+               (screen->left_margin + screen->right_margin + screen->x_res + screen->hsync_len)*
+               (dev_drv->pixclock);       // one frame time ,(pico seconds)
+       fps = div64_u64(1000000000000llu,ft);
+       return snprintf(buf, PAGE_SIZE,"xres:%d\nyres:%d\nfps:%d\n",
+               screen->x_res,screen->y_res,fps);
+}
+
+static ssize_t show_disp_info(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 layer_id = get_fb_layer_id(&fbi->fix);
+       if(dev_drv->get_disp_info)
+               dev_drv->get_disp_info(dev_drv,layer_id);
+}
+
+static ssize_t show_phys(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       struct fb_info *fbi = dev_get_drvdata(dev);
+       return snprintf(buf, PAGE_SIZE, "0x%lx-----0x%x\n",
+               fbi->fix.smem_start,fbi->fix.smem_len);
+}
+
+static ssize_t show_virt(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       struct fb_info *fbi = dev_get_drvdata(dev);
+
+       return snprintf(buf, PAGE_SIZE, "0x%p-----0x%x\n",
+               fbi->screen_base,fbi->fix.smem_len);
+}
+
+static struct device_attribute rkfb_attrs[] = {
+       __ATTR(phys_addr, S_IRUGO, show_phys, NULL),
+       __ATTR(virt_addr, S_IRUGO, show_virt, NULL),
+       __ATTR(disp_info, S_IRUGO, show_disp_info, NULL),
+       __ATTR(screen_info, S_IRUGO, show_screen_info, NULL),
+};
+
+int rkfb_create_sysfs(struct fb_info *fbi)
+{
+       int r;
+       int t;
+       for (t = 0; t < ARRAY_SIZE(rkfb_attrs); t++)
+       {
+               r = device_create_file(fbi->dev,&rkfb_attrs[t]);
+               if (r)
+               {
+                       dev_err(fbi->dev, "failed to create sysfs "
+                                       "file\n");
+                       return r;
+               }
+       }
+       
+
+       return 0;
+}
+
+void rkfb_remove_sysfs(struct rk_fb_inf *inf)
+{
+       int i, t;
+
+       for (i = 0; i < inf->num_fb; i++) {
+               for (t = 0; t < ARRAY_SIZE(rkfb_attrs); t++)
+                       device_remove_file(inf->fb[i]->dev,
+                                       &rkfb_attrs[t]);
+       }
+}
+
diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h
new file mode 100644 (file)
index 0000000..c3907d2
--- /dev/null
@@ -0,0 +1,212 @@
+/* drivers/video/rk30_fb.h
+ *
+ * Copyright (C) 2010 ROCKCHIP, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ARCH_ARM_MACH_RK30_FB_H
+#define __ARCH_ARM_MACH_RK30_FB_H
+
+#define RK30_MAX_LCDC_SUPPORT  4
+#define RK30_MAX_LAYER_SUPPORT 4
+#define RK_MAX_FB_SUPPORT     4
+
+
+
+#define FB0_IOCTL_STOP_TIMER_FLUSH             0x6001
+#define FB0_IOCTL_SET_PANEL                            0x6002
+
+#ifdef CONFIG_FB_WIMO
+#define FB_WIMO_FLAG
+#endif
+#ifdef FB_WIMO_FLAG
+#define FB0_IOCTL_SET_BUF                                      0x6017
+#define FB0_IOCTL_COPY_CURBUF                          0x6018
+#define FB0_IOCTL_CLOSE_BUF                            0x6019
+#endif
+
+#define FB1_IOCTL_GET_PANEL_SIZE               0x5001
+#define FB1_IOCTL_SET_YUV_ADDR                 0x5002
+//#define FB1_TOCTL_SET_MCU_DIR                        0x5003
+#define FB1_IOCTL_SET_ROTATE            0x5003
+#define FB1_IOCTL_SET_I2P_ODD_ADDR      0x5005
+#define FB1_IOCTL_SET_I2P_EVEN_ADDR     0x5006
+#define FB1_IOCTL_SET_WIN0_TOP          0x5018
+
+/********************************************************************
+**              display output interface supported by rk lcdc                       *
+********************************************************************/
+/* */
+#define OUT_P888            0
+#define OUT_P666            1    //
+#define OUT_P565            2    //
+#define OUT_S888x           4
+#define OUT_CCIR656         6
+#define OUT_S888            8
+#define OUT_S888DUMY        12
+#define OUT_P16BPP4         24  //
+#define OUT_D888_P666       0x21  //
+#define OUT_D888_P565       0x22  //
+
+
+/**
+ * pixel format definitions,this is copy from android/system/core/include/system/graphics.h
+ */
+
+enum {
+    HAL_PIXEL_FORMAT_RGBA_8888          = 1,
+    HAL_PIXEL_FORMAT_RGBX_8888          = 2,
+    HAL_PIXEL_FORMAT_RGB_888            = 3,
+    HAL_PIXEL_FORMAT_RGB_565            = 4,
+    HAL_PIXEL_FORMAT_BGRA_8888          = 5,
+    HAL_PIXEL_FORMAT_RGBA_5551          = 6,
+    HAL_PIXEL_FORMAT_RGBA_4444          = 7,
+
+    /* 0x8 - 0xFF range unavailable */
+
+    /*
+     * 0x100 - 0x1FF
+     *
+     * This range is reserved for pixel formats that are specific to the HAL
+     * implementation.  Implementations can use any value in this range to
+     * communicate video pixel formats between their HAL modules.  These formats
+     * must not have an alpha channel.  Additionally, an EGLimage created from a
+     * gralloc buffer of one of these formats must be supported for use with the
+     * GL_OES_EGL_image_external OpenGL ES extension.
+     */
+
+    /*
+     * Android YUV format:
+     *
+     * This format is exposed outside of the HAL to software decoders and
+     * applications.  EGLImageKHR must support it in conjunction with the
+     * OES_EGL_image_external extension.
+     *
+     * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
+     * by (W/2) x (H/2) Cr and Cb planes.
+     *
+     * This format assumes
+     * - an even width
+     * - an even height
+     * - a horizontal stride multiple of 16 pixels
+     * - a vertical stride equal to the height
+     *
+     *   y_size = stride * height
+     *   c_size = ALIGN(stride/2, 16) * height/2
+     *   size = y_size + c_size * 2
+     *   cr_offset = y_size
+     *   cb_offset = y_size + c_size
+     *
+     */
+    HAL_PIXEL_FORMAT_YV12   = 0x32315659, // YCrCb 4:2:0 Planar
+
+
+
+    /* Legacy formats (deprecated), used by ImageFormat.java */
+    HAL_PIXEL_FORMAT_YCbCr_422_SP       = 0x10, // NV16
+    HAL_PIXEL_FORMAT_YCrCb_420_SP       = 0x11, // NV21
+    HAL_PIXEL_FORMAT_YCbCr_422_I        = 0x14, // YUY2
+    HAL_PIXEL_FORMAT_YCrCb_NV12         = 0x20, // YUY2
+    HAL_PIXEL_FORMAT_YCrCb_NV12_VIDEO   = 0x21, // YUY2
+    HAL_PIXEL_FORMAT_YCrCb_444          = 0x22, //yuv444
+
+
+};
+
+
+//display data format
+enum data_format{
+       ARGB888 = 0,
+       RGB888,
+       RGB565,
+       YUV420 = 4,
+       YUV422,
+       YUV444,
+};
+
+struct rk_fb_rgb {
+       struct fb_bitfield      red;
+       struct fb_bitfield      green;
+       struct fb_bitfield      blue;
+       struct fb_bitfield      transp;
+};
+
+typedef enum _TRSP_MODE
+{
+    TRSP_CLOSE = 0,
+    TRSP_FMREG,
+    TRSP_FMREGEX,
+    TRSP_FMRAM,
+    TRSP_FMRAMEX,
+    TRSP_MASK,
+    TRSP_INVAL
+} TRSP_MODE;
+
+struct layer_par {
+    const char *name;
+    int id;
+    u32        pseudo_pal[16];
+    u32 y_offset;       //yuv/rgb offset  -->LCDC_WINx_YRGB_MSTx
+    u32 c_offset;     //cb cr offset--->LCDC_WINx_CBR_MSTx
+    u32 xpos;         //start point in panel  --->LCDC_WINx_DSP_ST
+    u32 ypos;
+    u16 xsize;        // display window width/height  -->LCDC_WINx_DSP_INFO
+    u16 ysize;          
+    u16 xact;        //origin display window size -->LCDC_WINx_ACT_INFO
+    u16 yact;
+    u16 xvir;       //virtual width/height     -->LCDC_WINx_VIR
+    u16 yvir;
+    unsigned long smem_start;
+    unsigned long cbr_start;  // Cbr memory start address
+    enum data_format format;
+       
+    bool support_3d;
+    
+};
+
+struct rk_lcdc_device_driver{
+       char name[6];
+       int id;
+       struct device  *dev;
+       
+       struct layer_par *layer_par;
+       int num_layer;
+       int fb_index_base;                     //the first fb index of the lcdc device
+       rk_screen *screen;
+       u32 pixclock;
+       int (*ioctl)(struct rk_lcdc_device_driver *dev_drv, unsigned int cmd,unsigned long arg,int layer_id);
+       int (*suspend)(struct layer_par *layer_par);
+       int (*resume)(struct layer_par *layer_par);
+       int (*blank)(struct rk_lcdc_device_driver *dev_drv,int layer_id,int blank_mode);
+       int (*set_par)(struct rk_lcdc_device_driver *dev_drv,int layer_id);
+       int (*pan_display)(struct rk_lcdc_device_driver *dev_drv,int layer_id);
+       int (*get_disp_info)(struct rk_lcdc_device_driver *dev_drv,int layer_id);
+       int (*load_screen)(struct rk_lcdc_device_driver *lcdc_dev, bool initscreen);
+       
+};
+
+struct rk_fb_inf {
+    struct fb_info *fb[RK_MAX_FB_SUPPORT];
+    int num_fb;
+    
+    struct rk_lcdc_device_driver *lcdc_dev_drv[RK30_MAX_LCDC_SUPPORT];
+    int num_lcdc;
+
+    int video_mode;  //when play video set it to 1
+};
+extern int rk_fb_register(struct rk_lcdc_device_driver *fb_device_driver);
+extern int rk_fb_unregister(struct rk_lcdc_device_driver *fb_device_driver);
+extern int init_lcdc_device_driver(struct rk_lcdc_device_driver *def_drv,
+       struct rk_lcdc_device_driver *dev_drv,int id);
+extern int get_fb_layer_id(struct fb_fix_screeninfo *fix);
+extern int rkfb_create_sysfs(struct fb_info *fbi);
+#endif