From: yxj Date: Sun, 6 Jan 2013 12:27:32 +0000 (+0800) Subject: rk3066b lcdc: add dump display info support X-Git-Tag: firefly_0821_release~7999 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0b9e8a2bf06aed123973f73c3694998d7cc9ea55;p=firefly-linux-kernel-4.4.55.git rk3066b lcdc: add dump display info support --- diff --git a/drivers/video/rockchip/lcdc/rk3066b_lcdc.c b/drivers/video/rockchip/lcdc/rk3066b_lcdc.c old mode 100644 new mode 100755 index 1e5c15fa2746..ca029224f13b --- a/drivers/video/rockchip/lcdc/rk3066b_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3066b_lcdc.c @@ -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; }