rk3066b lcdc: add dump display info support
authoryxj <yxj@yxj-desktop.(none)>
Sun, 6 Jan 2013 12:27:32 +0000 (20:27 +0800)
committeryxj <yxj@yxj-desktop.(none)>
Sun, 6 Jan 2013 12:30:23 +0000 (20:30 +0800)
drivers/video/rockchip/lcdc/rk3066b_lcdc.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 1e5c15f..ca02922
@@ -696,11 +696,135 @@ static int rk3066b_lcdc_ovl_mgr(struct rk_lcdc_device_driver *dev_drv,int swap,b
        return ovl;
 }
 
+
+static ssize_t dump_win0_disp_info(struct rk3066b_lcdc_device *lcdc_dev,char *buf)
+{
+        char format[9] = "NULL";
+        u32 fmt_id = LcdRdReg(lcdc_dev,SYS_CFG);
+        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)>>3)
+        {
+                case 0:
+                        strcpy(format,"ARGB888");
+                        break;
+                case 1:
+                        strcpy(format,"RGB565");
+                        break;
+                case 2:
+                        strcpy(format,"YCbCr420");
+                        break;
+                case 3:
+                        strcpy(format,"YCbCr422");
+                        break;
+                case 5:
+                        strcpy(format,"YCbCr444");
+                        break;
+               case 6:
+                       strcpy(format,"AYCBCr");
+                        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);
+        y_act = (act_info>>16);
+        x_dsp = (dsp_info&0x7ff);
+        y_dsp = (dsp_info>>16);
+       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\n"
+               "xact:%d\n"
+               "yact:%d\n"
+               "xdsp:%d\n"
+               "ydsp:%d\n"
+               "x_st:%d\n"
+               "y_st:%d\n"
+               "x_scale:%d.%d\n"
+               "y_scale:%d.%d\n"
+               "format:%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 rk3066b_lcdc_device *lcdc_dev,char *buf)
+{
+        char format[9] = "NULL";
+        u32 fmt_id = LcdRdReg(lcdc_dev,SYS_CFG);
+        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)>>2)
+        {
+                case 0:
+                        strcpy(format,"ARGB888");
+                        break;
+                case 1:
+                        strcpy(format,"RGB565");
+                        break;
+                default:
+                        strcpy(format,"inval\n");
+                        break;
+        }
+
+        xvir = LcdRdReg(lcdc_dev,WIN1_VIR)&0xffff;
+        dsp_info = LcdRdReg(lcdc_dev,WIN1_DSP_INFO);
+        dsp_st = LcdRdReg(lcdc_dev,WIN1_DSP_ST);
+
+        x_dsp = dsp_info&0x7ff;
+        y_dsp = dsp_info>>16;
+
+        return snprintf(buf,PAGE_SIZE,
+               "xvir:%d\n"
+               "xdsp:%d\n"
+               "ydsp:%d\n"
+               "x_st:%d\n"
+               "y_st:%d\n"
+               "format:%s\n",
+                xvir,
+                x_dsp,
+                y_dsp,
+                dsp_st&0xffff,
+                dsp_st>>16,
+                format);
+}
+
 static ssize_t rk3066b_lcdc_get_disp_info(struct rk_lcdc_device_driver *dev_drv,char *buf,int layer_id)
 
 {
        struct rk3066b_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk3066b_lcdc_device,driver);
-       return 0;
+        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);
+        }
+        
+        return 0;
 }