From: zyw Date: Fri, 10 Dec 2010 08:31:04 +0000 (+0800) Subject: modify lcd freq X-Git-Tag: firefly_0821_release~10955 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3d128b1bc7fe7f2d8bb2ea98e0f9de75f5d7fbc3;p=firefly-linux-kernel-4.4.55.git modify lcd freq --- diff --git a/drivers/video/display/screen/lcd_a060se02.c b/drivers/video/display/screen/lcd_a060se02.c old mode 100644 new mode 100755 index 4cb18754d162..1cb426f43550 --- a/drivers/video/display/screen/lcd_a060se02.c +++ b/drivers/video/display/screen/lcd_a060se02.c @@ -9,6 +9,8 @@ #define OUT_TYPE SCREEN_MCU #define OUT_FACE OUT_P16BPP4 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ + /* Timing */ #define H_PW 1 #define H_BP 1 @@ -133,6 +135,7 @@ void set_lcd_info(struct rk29fb_screen *screen) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->left_margin = H_BP; screen->right_margin = H_FP; screen->hsync_len = H_PW; diff --git a/drivers/video/display/screen/lcd_hl070vm4.c b/drivers/video/display/screen/lcd_hl070vm4.c index 50edbfbb0f9e..68a00b9f6efe 100644 --- a/drivers/video/display/screen/lcd_hl070vm4.c +++ b/drivers/video/display/screen/lcd_hl070vm4.c @@ -9,7 +9,8 @@ /* Base */ #define OUT_TYPE SCREEN_RGB #define OUT_FACE OUT_P888 -#define OUT_CLK 27 +#define OUT_CLK 27000000 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 10 @@ -65,6 +66,7 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk2918lcd_info *lcd_info screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->pixclock = OUT_CLK; screen->left_margin = H_BP; screen->right_margin = H_FP; diff --git a/drivers/video/display/screen/lcd_hsd100pxn.c b/drivers/video/display/screen/lcd_hsd100pxn.c old mode 100755 new mode 100644 index 459261a0b683..bd56503abdf7 --- a/drivers/video/display/screen/lcd_hsd100pxn.c +++ b/drivers/video/display/screen/lcd_hsd100pxn.c @@ -9,9 +9,9 @@ /* Base */ #define OUT_TYPE SCREEN_RGB -#define OUT_FACE OUT_P888 -#define OUT_CLK 65 -#define LCDC_ACLK 150 //29 lcdc axi DMA ƵÂÊ +#define OUT_FACE OUT_D888_P666 +#define OUT_CLK 65000000 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 10 @@ -45,6 +45,7 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info ) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->pixclock = OUT_CLK; screen->left_margin = H_BP; screen->right_margin = H_FP; @@ -58,7 +59,6 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info ) screen->pin_vsync = 0; screen->pin_den = 0; screen->pin_dclk = DCLK_POL; - screen->lcdc_aclk = LCDC_ACLK; /* Swap rule */ screen->swap_rb = SWAP_RB; diff --git a/drivers/video/display/screen/lcd_hsd800x480.c b/drivers/video/display/screen/lcd_hsd800x480.c index 84f157e59818..56ea15fee984 100644 --- a/drivers/video/display/screen/lcd_hsd800x480.c +++ b/drivers/video/display/screen/lcd_hsd800x480.c @@ -11,7 +11,8 @@ /* Base */ #define OUT_TYPE SCREEN_RGB #define OUT_FACE OUT_P888 -#define OUT_CLK 28 +#define OUT_CLK 28000000 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 1 @@ -66,6 +67,7 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info ) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->pixclock = OUT_CLK; screen->left_margin = H_BP; screen->right_margin = H_FP; diff --git a/drivers/video/display/screen/lcd_hx8357.c b/drivers/video/display/screen/lcd_hx8357.c index 19e4efc719f2..463ae0b5552a 100644 --- a/drivers/video/display/screen/lcd_hx8357.c +++ b/drivers/video/display/screen/lcd_hx8357.c @@ -10,7 +10,8 @@ /* Base */ #define OUT_TYPE SCREEN_RGB #define OUT_FACE OUT_P666 /*OUT_P888*/ -#define OUT_CLK 10 //***27 +#define OUT_CLK 10000000 //***27 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 8 @@ -179,6 +180,7 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info ) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->pixclock = OUT_CLK; screen->left_margin = H_BP; /*>2*/ screen->right_margin = H_FP; /*>2*/ diff --git a/drivers/video/display/screen/lcd_nt35580.c b/drivers/video/display/screen/lcd_nt35580.c index 39fea0c4ef7e..8fb8b8350f36 100644 --- a/drivers/video/display/screen/lcd_nt35580.c +++ b/drivers/video/display/screen/lcd_nt35580.c @@ -10,7 +10,8 @@ /* Base */ #define OUT_TYPE SCREEN_RGB #define OUT_FACE OUT_P888 -#define OUT_CLK 24 +#define OUT_CLK 24000000 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 1 @@ -439,6 +440,7 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk2918lcd_info *lcd_info screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->pixclock = OUT_CLK; screen->left_margin = H_BP; screen->right_margin = H_FP; diff --git a/drivers/video/display/screen/lcd_nt35582.c b/drivers/video/display/screen/lcd_nt35582.c index 7ddf8646c2fe..8835a2187a65 100644 --- a/drivers/video/display/screen/lcd_nt35582.c +++ b/drivers/video/display/screen/lcd_nt35582.c @@ -23,6 +23,8 @@ #define LCD_WIDTH 480 //need modify #define LCD_HEIGHT 800 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ + #define P_WR 27 #define USE_FMARK 0 //2 //ÊÇ·ñʹÓÃFMK (0:²»Ö§³Ö 1:ºáÆÁÖ§³Ö 2:ºáÊúÆÁ¶¼Ö§³Ö) #define FRMRATE 60 //MCUÆÁµÄË¢ÐÂÂÊ (FMKÓÐЧʱÓÃ) @@ -395,6 +397,7 @@ void set_lcd_info(struct rk29fb_screen *screen) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->left_margin = H_BP; screen->right_margin = H_FP; screen->hsync_len = H_PW; diff --git a/drivers/video/display/screen/lcd_s1d13521.c b/drivers/video/display/screen/lcd_s1d13521.c index c2f7cdf958c5..06db84f22ae5 100644 --- a/drivers/video/display/screen/lcd_s1d13521.c +++ b/drivers/video/display/screen/lcd_s1d13521.c @@ -11,6 +11,7 @@ /* Base */ #define OUT_TYPE SCREEN_MCU #define OUT_FACE OUT_P16BPP4 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 1 @@ -321,6 +322,7 @@ void set_lcd_info(struct rk28fb_screen *screen) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->left_margin = H_BP; screen->right_margin = H_FP; screen->hsync_len = H_PW; diff --git a/drivers/video/display/screen/lcd_td043mgea1.c b/drivers/video/display/screen/lcd_td043mgea1.c index f67e344244fe..6301ac5d089b 100644 --- a/drivers/video/display/screen/lcd_td043mgea1.c +++ b/drivers/video/display/screen/lcd_td043mgea1.c @@ -10,7 +10,8 @@ /* Base */ #define OUT_TYPE SCREEN_RGB #define OUT_FACE OUT_P888 -#define OUT_CLK 27 +#define OUT_CLK 27000000 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 10 @@ -65,6 +66,7 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info ) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->pixclock = OUT_CLK; screen->left_margin = H_BP; screen->right_margin = H_FP; diff --git a/drivers/video/display/screen/lcd_tj048nc01ca.c b/drivers/video/display/screen/lcd_tj048nc01ca.c index ef298599ee10..1799321e0845 100644 --- a/drivers/video/display/screen/lcd_tj048nc01ca.c +++ b/drivers/video/display/screen/lcd_tj048nc01ca.c @@ -10,7 +10,8 @@ /* Base */ #define OUT_TYPE SCREEN_RGB #define OUT_FACE OUT_P888 -#define OUT_CLK 23 +#define OUT_CLK 23000000 +#define LCDC_ACLK 150000000 //29 lcdc axi DMA ƵÂÊ /* Timing */ #define H_PW 1 @@ -64,6 +65,7 @@ void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info ) screen->height = LCD_HEIGHT; /* Timing */ + screen->lcdc_aclk = LCDC_ACLK; screen->pixclock = OUT_CLK; screen->left_margin = H_BP; screen->right_margin = H_FP; diff --git a/drivers/video/rk29_fb.c b/drivers/video/rk29_fb.c index 18f529942a55..9835c861b98c 100755 --- a/drivers/video/rk29_fb.c +++ b/drivers/video/rk29_fb.c @@ -401,7 +401,6 @@ int init_lcdc(struct fb_info *info) LcdMskReg(inf, WIN0_COLOR_KEY_CTRL, m_COLORKEY_EN, v_COLORKEY_EN(0)); LcdMskReg(inf, WIN1_COLOR_KEY_CTRL, m_COLORKEY_EN, v_COLORKEY_EN(0)); - LcdWrReg(inf, DSP_CTRL0, 0); LcdWrReg(inf, DSP_CTRL1, 0); // initialize all interrupt @@ -422,15 +421,17 @@ void load_screen(struct fb_info *info, bool initscreen) int ret = -EINVAL; struct rk29fb_inf *inf = dev_get_drvdata(info->device); struct rk29fb_screen *screen = inf->cur_screen; - u16 face = screen->face; + u16 face; u16 mcu_total, mcu_rwstart, mcu_csstart, mcu_rwend, mcu_csend; u16 right_margin = screen->right_margin, lower_margin = screen->lower_margin; u16 x_res = screen->x_res, y_res = screen->y_res; u32 clk_rate = 0; - u32 dclk_rate = 0; u32 aclk_rate = 150000000; - if(!g_pdev) return -1; + if(!g_pdev){ + printk(">>>>>> %s : %s no g_pdev\n", __FILE__, __FUNCTION__); + return; + } fbprintk(">>>>>> %s : %s \n", __FILE__, __FUNCTION__); @@ -458,6 +459,33 @@ void load_screen(struct fb_info *info, bool initscreen) ); // set synchronous pin polarity and data pin swap rule + switch (screen->face) + { + case OUT_P565: + face = OUT_P565; + LcdMskReg(inf, DSP_CTRL0, m_DITHER_DOWN_EN | m_DITHER_DOWN_MODE, v_DITHER_DOWN_EN(1) | v_DITHER_DOWN_MODE(0)); + break; + case OUT_P666: + face = OUT_P666; + LcdMskReg(inf, DSP_CTRL0, m_DITHER_DOWN_EN | m_DITHER_DOWN_MODE, v_DITHER_DOWN_EN(1) | v_DITHER_DOWN_MODE(1)); + break; + case OUT_D888_P565: + face = OUT_P888; + LcdMskReg(inf, DSP_CTRL0, m_DITHER_DOWN_EN | m_DITHER_DOWN_MODE, v_DITHER_DOWN_EN(1) | v_DITHER_DOWN_MODE(0)); + break; + case OUT_D888_P666: + face = OUT_P888; + LcdMskReg(inf, DSP_CTRL0, m_DITHER_DOWN_EN | m_DITHER_DOWN_MODE, v_DITHER_DOWN_EN(1) | v_DITHER_DOWN_MODE(1)); + break; + case OUT_P888: + face = OUT_P888; + LcdMskReg(inf, DSP_CTRL0, m_DITHER_UP_EN, v_DITHER_UP_EN(1)); + break; + default: + face = screen->face; + break; + } + LcdMskReg(inf, DSP_CTRL0, m_DISPLAY_FORMAT | m_HSYNC_POLARITY | m_VSYNC_POLARITY | m_DEN_POLARITY | m_DCLK_POLARITY | m_COLOR_SPACE_CONVERSION, @@ -540,23 +568,22 @@ void load_screen(struct fb_info *info, bool initscreen) } // set lcdc clk - if(SCREEN_MCU==screen->type) screen->pixclock = 150; //mcu fix to 150 MHz + if(SCREEN_MCU==screen->type) screen->pixclock = 150000000; //mcu fix to 150 MHz clk_set_parent(inf->dclk_divider, inf->dclk_parent); clk_set_parent(inf->dclk, inf->dclk_divider); clk_set_parent(inf->aclk, inf->aclk_parent); - dclk_rate = screen->pixclock * 1000000; - fbprintk(">>>>>> set lcdc dclk need %d HZ, clk_parent = %d hz \n ", screen->pixclock, clk_rate); - ret = clk_set_rate(inf->dclk_divider, dclk_rate); + ret = clk_set_rate(inf->dclk_divider, screen->pixclock); if(ret) { printk(KERN_ERR ">>>>>> set lcdc dclk_divider faild \n "); } + if(screen->lcdc_aclk){ - aclk_rate = screen->lcdc_aclk * 1000000; + aclk_rate = screen->lcdc_aclk; } ret = clk_set_rate(inf->aclk, aclk_rate); if(ret){ @@ -1408,7 +1435,7 @@ static int win1fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *inf struct rk29fb_inf *inf = dev_get_drvdata(info->device); struct fb_var_screeninfo *var1 = &info->var; struct fb_fix_screeninfo *fix1 = &info->fix; - int i; + u32 offset = 0, addr = 0; //fbprintk(">>>>>> %s : %s \n", __FILE__, __FUNCTION__); @@ -1449,6 +1476,7 @@ static int win1fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *inf #endif #if 0 + int i; for(i=0;i<=(0xc0/4);i+=4) { fbprintk("0x%02X: 0x%08X 0x%08X 0x%08X 0x%08X \n", i*4, @@ -1687,7 +1715,7 @@ void resume(struct early_suspend *h) } msleep(100); set_lcd_pin(g_pdev, 1); - memcpy(inf->preg, &inf->regbak, 0xa4); //resume reg + memcpy((u8*)inf->preg, (u8*)&inf->regbak, 0xa4); //resume reg } struct suspend_info suspend_info = { diff --git a/drivers/video/rk29_fb.h b/drivers/video/rk29_fb.h index 74bd6baa0c61..a43cb8ddbcb9 100755 --- a/drivers/video/rk29_fb.h +++ b/drivers/video/rk29_fb.h @@ -21,14 +21,15 @@ ********************************************************************/ /* ÊäÍùÆÁµÄÊý¾Ý¸ñʽ */ #define OUT_P888 0 -#define OUT_P666 1 -#define OUT_P565 2 +#define OUT_P666 1 //666µÄÆÁ, ½ÓDATA0-17 +#define OUT_P565 2 //565µÄÆÁ, ½ÓDATA0-15 #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 //666µÄÆÁ, ½ÓDATA2-7, DATA10-15, DATA17-22 +#define OUT_D888_P565 0x22 //565µÄÆÁ, ½ÓDATA3-7, DATA10-15, DATA18-22 /* SYS_CONFIG */ #define m_W2_FORMAT (3<<0)