rk30 lcdc: support dump display info
authoryxj <yxj@rock-chips.com>
Tue, 11 Sep 2012 03:02:08 +0000 (11:02 +0800)
committeryxj <yxj@rock-chips.com>
Tue, 11 Sep 2012 03:05:58 +0000 (11:05 +0800)
drivers/video/rockchip/lcdc/rk30_lcdc.c
drivers/video/rockchip/rkfb_sysfs.c
include/linux/rk_fb.h

index 3c4bfb0975f6fd442b7d1f92f5f5f7f81ccc3562..7723c04f2b48ea77edcc32549bc6549b0fa237ee 100644 (file)
@@ -825,13 +825,173 @@ static int rk30_lcdc_ovl_mgr(struct rk_lcdc_device_driver *dev_drv,int swap,bool
 
        return ovl;
 }
-static int rk30_lcdc_get_disp_info(struct rk_lcdc_device_driver *dev_drv,int layer_id)
+
+static ssize_t dump_win0_disp_info(struct rk30_lcdc_device *lcdc_dev,char *buf)
 {
-       struct rk30_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk30_lcdc_device,driver);
-       return 0;
+        char format[9] = "NULL";
+        u32 fmt_id = LcdRdReg(lcdc_dev,SYS_CTRL1);
+        u32 xvir,act_info,dsp_info,dsp_st,factor;
+        u16 x_act,y_act,x_dsp,y_dsp,x_factor,y_factor;
+        u16 x_scale,y_scale;
+        switch((fmt_id&m_W0_FORMAT)>>4)
+        {
+                case 0:
+                        strcpy(format,"ARGB888");
+                        break;
+                case 1:
+                        strcpy(format,"RGB888");
+                        break;
+                case 2:
+                        strcpy(format,"RGB565");
+                        break;
+                case 4:
+                        strcpy(format,"YCbCr420");
+                        break;
+                case 5:
+                        strcpy(format,"YCbCr422");
+                        break;
+                case 6:
+                        strcpy(format,"YCbCr444");
+                        break;
+                default:
+                        strcpy(format,"inval\n");
+                        break;
+        }
+
+        xvir = LcdRdReg(lcdc_dev,WIN0_VIR)&0xffff;
+        act_info = LcdRdReg(lcdc_dev,WIN0_ACT_INFO);
+        dsp_info = LcdRdReg(lcdc_dev,WIN0_DSP_INFO);
+        dsp_st = LcdRdReg(lcdc_dev,WIN0_DSP_ST);
+        factor = LcdRdReg(lcdc_dev,WIN0_SCL_FACTOR_YRGB);
+        x_act =  (act_info&0xffff) + 1;
+        y_act = (act_info>>16) + 1;
+        x_dsp = (dsp_info&0xffff) + 1;
+        y_dsp = (dsp_info>>16) + 1;
+        x_factor = factor&0xffff;
+        y_factor = factor>>16;
+        x_scale = 4096*100/x_factor;
+        y_scale = 4096*100/y_factor;
+        return snprintf(buf,PAGE_SIZE,"xvir:%d\nxact:%d\nyact:%d\nxdsp:%d\nydsp:%d\nx_st:%d\ny_st:%d\nx_scale:%d.%d\ny_scale:%d.%d\nformat:%s\n",
+                xvir,x_act,y_act,x_dsp,y_dsp,dsp_st&0xffff,dsp_st>>16,x_scale/100,x_scale%100,y_scale/100,y_scale%100,format);
+
+}
+static ssize_t dump_win1_disp_info(struct rk30_lcdc_device *lcdc_dev,char *buf)
+{
+        char format[9] = "NULL";
+        u32 fmt_id = LcdRdReg(lcdc_dev,SYS_CTRL1);
+        u32 xvir,act_info,dsp_info,dsp_st,factor;
+        u16 x_act,y_act,x_dsp,y_dsp,x_factor,y_factor;
+        u16 x_scale,y_scale;
+        switch((fmt_id&m_W1_FORMAT)>>7)
+        {
+                case 0:
+                        strcpy(format,"ARGB888");
+                        break;
+                case 1:
+                        strcpy(format,"RGB888");
+                        break;
+                case 2:
+                        strcpy(format,"RGB565");
+                        break;
+                case 4:
+                        strcpy(format,"YCbCr420");
+                        break;
+                case 5:
+                        strcpy(format,"YCbCr422");
+                        break;
+                case 6:
+                        strcpy(format,"YCbCr444");
+                        break;
+                default:
+                        strcpy(format,"inval\n");
+                        break;
+        }
+
+        xvir = LcdRdReg(lcdc_dev,WIN1_VIR)&0xffff;
+        act_info = LcdRdReg(lcdc_dev,WIN1_ACT_INFO);
+        dsp_info = LcdRdReg(lcdc_dev,WIN1_DSP_INFO);
+        dsp_st = LcdRdReg(lcdc_dev,WIN1_DSP_ST);
+        factor = LcdRdReg(lcdc_dev,WIN1_SCL_FACTOR_YRGB);
+        x_act = (act_info&0xffff) + 1;
+        y_act = (act_info>>16) + 1;
+        x_dsp = (dsp_info&0xffff) + 1;
+        y_dsp = (dsp_info>>16) + 1;
+        x_factor = factor&0xffff;
+        y_factor = factor>>16;
+        x_scale = 4096*100/x_factor;
+        y_scale = 4096*100/y_factor;
+        return snprintf(buf,PAGE_SIZE,"xvir:%d\nxact:%d\nyact:%d\nxdsp:%d\nydsp:%d\nx_st:%d\ny_st:%d\nx_scale:%d.%d\ny_scale:%d.%d\nformat:%s\n",
+                xvir,x_act,y_act,x_dsp,y_dsp,dsp_st&0xffff,dsp_st>>16,x_scale/100,x_scale%100,y_scale/100,y_scale%100,format);
+
+}
+
+static ssize_t dump_win2_disp_info(struct rk30_lcdc_device *lcdc_dev,char *buf)
+{
+        char format[9] = "NULL";
+        u32 fmt_id = LcdRdReg(lcdc_dev,SYS_CTRL1);
+        u32 xvir,act_info,dsp_info,dsp_st,factor;
+        u16 x_act,y_act,x_dsp,y_dsp,x_factor,y_factor;
+        u16 x_scale,y_scale;
+        switch((fmt_id&m_W2_FORMAT)>>10)
+        {
+                case 0:
+                        strcpy(format,"ARGB888");
+                        break;
+                case 1:
+                        strcpy(format,"RGB888");
+                        break;
+                case 2:
+                        strcpy(format,"RGB565");
+                        break;
+                case 4:
+                        strcpy(format,"8bpp");
+                        break;
+                        case 5:
+                        strcpy(format,"4bpp");
+                        break;
+                case 6:
+                        strcpy(format,"2bpp");
+                        break;
+                case 7:
+                        strcpy(format,"1bpp");
+                        break;
+                default:
+                        strcpy(format,"inval\n");
+                        break;
+        }
+
+        xvir = LcdRdReg(lcdc_dev,WIN2_VIR)&0xffff;
+        dsp_info = LcdRdReg(lcdc_dev,WIN2_DSP_INFO);
+        dsp_st = LcdRdReg(lcdc_dev,WIN2_DSP_ST);
+
+        x_dsp = dsp_info&0xffff;
+        y_dsp = dsp_info>>16;
+
+        return snprintf(buf,PAGE_SIZE,"xvir:%d\nxdsp:%d\nydsp:%d\nx_st:%d\ny_st:%d\nformat:%s\n",
+                xvir,x_dsp,y_dsp,dsp_st&0xffff,dsp_st>>16,format);
+}
+
+static ssize_t  rk30_lcdc_get_disp_info(struct rk_lcdc_device_driver *dev_drv,char *buf,int layer_id)
+{
+        struct rk30_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk30_lcdc_device,driver);
+        if(layer_id == 0)
+        {
+                return dump_win0_disp_info(lcdc_dev,buf);
+        }
+        else if(layer_id == 1)
+        {
+                return dump_win1_disp_info(lcdc_dev,buf);
+        }
+        else if(layer_id == 2)
+        {
+                return dump_win2_disp_info(lcdc_dev,buf);
+        }
+
+        return 0;
 }
 
 
+
 /*******************************************
 lcdc fps manager,set or get lcdc fps
 set:0 get
index b6a273786033685bb9cbb72fdc32987b19fe8dd5..4e148fe90722a844314277737fa235bdf4ca9d8c 100644 (file)
@@ -58,7 +58,7 @@ static ssize_t show_disp_info(struct device *dev,
                (struct rk_lcdc_device_driver * )fbi->par;
        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);
+               return dev_drv->get_disp_info(dev_drv,buf,layer_id);
 
        return 0;
 }
index 6a646a24dd95d6f33a7ef20934cb4410c1e78a2f..efda1ac2943a6b708103d705392492e09f5e1a01 100644 (file)
@@ -227,7 +227,7 @@ struct rk_lcdc_device_driver{
        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);
+       ssize_t (*get_disp_info)(struct rk_lcdc_device_driver *dev_drv,char *buf,int layer_id);
        int (*load_screen)(struct rk_lcdc_device_driver *dev_drv, bool initscreen);
        int (*get_layer_state)(struct rk_lcdc_device_driver *dev_drv,int layer_id);
        int (*ovl_mgr)(struct rk_lcdc_device_driver *dev_drv,int swap,bool set);  //overlay manager