Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4471212
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: 嵌入式

2011-04-02 15:53:09

说明:本篇博客 参考tq linux 移植手册中的内容,只是自己学习过程中的记录。


1.简化LCD时钟计算方法

     修改 “drivers/video/s3c2410fb.c”
  1. static void s3c2410fb_activate_var(struct fb_info *info)
  2. {
  3.     struct s3c2410fb_info *fbi = info->par;
  4.     void __iomem *regs = fbi->io;

  5.     int type = fbi->regs.lcdcon1 & S3C2410_LCDCON1_TFT;
  6. 添加:
  7.     struct s3c2410fb_mach_info *mach_info = fbi->dev->platform_data;
  8.     struct s3c2410fb_display *default_display = mach_info->displays +
  9.                          mach_info->default_display;
  10. 结束
  11.     struct fb_var_screeninfo *var = &info->var;
  12.     int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2;

  13.     dprintk("%s: var->xres = %d\n", __func__, var->xres);
  14.     dprintk("%s: var->yres = %d\n", __func__, var->yres);
  15.     dprintk("%s: var->bpp = %d\n", __func__, var->bits_per_pixel);

  16.     if (type == S3C2410_LCDCON1_TFT) {
  17.         s3c2410fb_calculate_tft_lcd_regs(info, &fbi->regs);
  18.         --clkdiv;
  19.         if (clkdiv < 0)
  20.             clkdiv = 0;
  21.     } else {
  22.         s3c2410fb_calculate_stn_lcd_regs(info, &fbi->regs);
  23.         if (clkdiv < 2)
  24.             clkdiv = 2;
  25.     }

  26. //    fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(clkdiv);
  27. 修改为       fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(default_display->setclkval);


2.完成了这部分修改后,我们在时c2410fb_display 结构体中添加了一个 setclkval 变量,那么我们需要在该结构体的院校中添加上该变量,修改“arch/arm/mach-s3c2410/include/fb.h”

  1. struct s3c2410fb_display {
  2.     /* LCD type */
  3.     unsigned type;

  4.     /* Screen size */
  5.     unsigned short width;
  6.     unsigned short height;

  7.     /* Screen info */
  8.     unsigned short xres;
  9.     unsigned short yres;
  10.     unsigned short bpp;

  11.     unsigned pixclock;        /* pixclock in picoseconds */
  12. ##  /* 新加入的项,目的是减少计算pixclock的复杂度*/       
  13.     unsigned setclkval;        /* clkval */

  14.     unsigned short left_margin; /* value in pixels (TFT) or HCLKs (STN) */


3.修改LCD 各个参数,注意:添加上刚刚添加的那个变量 setclkval 的赋值
  修改 "arch/arm/mach-s3c2440/mach-smdk2440.c"

  1. /* LCD driver info */

  2. static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {

  3.     .lcdcon5    = S3C2410_LCDCON5_FRM565 |
  4.              S3C2410_LCDCON5_INVVLINE |
  5.              S3C2410_LCDCON5_INVVFRAME |
  6.              S3C2410_LCDCON5_PWREN |
  7.              S3C2410_LCDCON5_HWSWP,

  8.         .type        = S3C2410_LCDCON1_TFT,

  9. #if    defined(CONFIG_FB_S3C24X0_W320240)
  10.     .width        = 320,
  11.     .height        = 240,

  12.     .pixclock        = 80000, /* HCLK 100 MHz, divisor 3 */

  13. /* 新加入的项,目的是减少计算pixclock的复杂度*/
  14.     .setclkval        = 0x3,

  15.     .xres        = 320,
  16.     .yres        = 240,
  17.     .bpp        = 16,
  18.     .left_margin    = 28,    /* for HFPD*/
  19.     .right_margin    = 24,    /* for HBPD*/
  20.     .hsync_len    = 42,    /* for HSPW*/
  21.     .upper_margin    = 6,    /* for VFPD*/
  22.     .lower_margin    = 2,    /* for VBPD*/
  23.     .vsync_len    = 12,    /* for VSPW*/

  24. #endif
  25. };


4.修改 drivers/video/Kconfig
  1. config FB_S3C24X0   修改
  2.     tristate "S3C2410 LCD framebuffer support"

  3.    depends on FB && ARCH_S3C2410
  4.     select FB_CFB_FILLRECT
  5.     select FB_CFB_COPYAREA
  6.     select FB_CFB_IMAGEBLIT
  7.     ---help---
  8.      Frame buffer driver for the built-in LCD controller in the Samsung
  9.      S3C2410 processor.

  10.      This driver is also available as a module ( = code which can be
  11.      inserted and removed from the running kernel whenever you want). The
  12.      module will be called s3c2410fb. If you want to compile it as a module,
  13.      say M here and read <file:Documentation/kbuild/modules.txt>.

  14.      If unsure, say N.

  15. choice            添加
  16.     prompt "LCD select"
  17.     depends on FB_S3C24X0
  18.     help
  19.      S3C24x0 LCD size select

  20. config FB_S3C24X0_W320240
  21.     boolean "3.5 inch 320x240 WanXin LCD"
  22.     depends on FB_S3C24X0
  23.     help
  24.      3.5 inch 320x240 WanXin LCD

  25. endchoice    

  26. config FB_S3C2410_DEBUG
  27.     bool "S3C2410 lcd debug messages"
  28.     depends on FB_S3C24X0   #修改
  29.     help
  30.      Turn on debugging messages. Note that you can set/unset at run time
  31.      through sysfs



4.修改 drivers/video/Makefile
  1. obj-$(CONFIG_FB_IMX) += imxfb.o

  2. obj-$(CONFIG_FB_S3C)         += s3c-fb.o

  3. obj-$(CONFIG_FB_S3C24X0)     += s3c2410fb.o   #因为Kconifg 修改为 CONFIG_FB_S3C24X0,所以这里修改

  4. obj-$(CONFIG_FB_FSL_DIU)     += fsl-diu-fb.o

5.制作 linux 的开机 logo
  有几点需要注意:1.使用320*240 像素的 bmp 图片,
                  2.我用别的像素制作的图片,当下载到板子后,出现,黑、白、红、绿交替闪烁,
                    没有出现预期的图片           
   上传自己制作好的图片.ppm   logo_linux_tft320240_clut224.ppm   


6.支持LCD设置
   复制 logo_linux_tft320240_clut224.ppm 到 drivers/video/logo

   修改drivers/video/logo/Kconfig

  1. config LOGO_LINUX_CLUT224
  2.     bool "Standard 224-color Linux logo"
  3.     default y

  4. 添加
  5. config LOGO_LINUX_TFT320240_CLUT224
  6.     bool "Standard 224-color Linux logo for 320X240"
  7.     depends on LOGO && FB_S3C24X0_S320240 || FB_S3C24X0_W320240
  8.     default y
结束
   修改drives/video/logo/Makefile
  1. obj-$(CONFIG_LOGO_LINUX_CLUT224)     += logo_linux_clut224.o

  2. 添加
  3. obj-$(CONFIG_LOGO_LINUX_TFT320240_CLUT224)        += logo_linux_tft320240_clut224.o

   修改 drivers/video/logo/logo.c
  1. extern const struct linux_logo logo_linux_clut224;

  2. extern const struct linux_logo logo_linux_tft320240_clut224;

  1. #ifdef CONFIG_LOGO_LINUX_CLUT224
  2.         /* Generic Linux logo */
  3.         logo = &logo_linux_clut224;
  4. #endif


  5. #ifdef CONFIG_LOGO_LINUX_TFT320240_CLUT224
  6.         /* Generic Linux logo */
  7.         logo = &logo_linux_tft320240_clut224;
  8. #endif



7.配置内核

  1. Device Drivers -->
  2.     Graphics support  __>
  3.        <*>Support for frame buffer devices ->
  4.               [*] Enable firmware EDID
  5.               [*] Enable Video mode handling dhelpers
  6.                          ****frame buffer hardware dirvers***

  7.               <*> S3C24X0 LCD framebufer support   注意这个就是在 Kconfig中 drivers/video/
  8.                         LCD select 3.5 inch 320*240
  9.               <*> Frambuffer console support
  10.        [*]bootup logo ->               注意:drivers/video/logo/Kconfig
  11.                [*]  standard 224-color linux logo for 320*240  


8.ok 了







阅读(1156) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~