Chinaunix首页 | 论坛 | 博客
  • 博客访问: 120938
  • 博文数量: 31
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 296
  • 用 户 组: 普通用户
  • 注册时间: 2015-01-10 21:57
文章分类

全部博文(31)

文章存档

2016年(4)

2015年(27)

我的朋友

分类: LINUX

2015-03-05 16:17:39

开发板linux内核:linux-2.6.39
lcd型号:统宝 3.5 LCD

    参考《mini2440 linux移植开发实战指南.pdf》
    
        Linux-2.6.32.2 内核已经支持S3C2440 的LCD 控制器驱动,但在此我们先介绍一下关于2440 LCD控制器以及驱动相关的LCD 的一些基础知识。 
        注意:在此我们只讨论TFT LCD,也就是真彩屏。 
        LCD 驱动中最关键的就是时钟频率( Clock frequency) 的设置,时钟频率设置不对,LCD的显示就会闪,或者根本没有显示。一般LCD的Datasheet 上会写有一个推荐的频率,比如mini2440 所用的统宝3.5”LCD ,在它的数据手册第13页,有这样一个表格: 


2、在linux-2.6.39/arch/arm/mach-s3c2440/mach-my2440.c 中修改对lcd控制寄存器的配置

点击(此处)折叠或打开

  1. /* LCD driver info */
  2. #if defined(CONFIG_FB_S3C2410_N240320)

  3. #define LCD_WIDTH 240
  4. #define LCD_HEIGHT 320
  5. #define LCD_PIXCLOCK 100000

  6. #define LCD_RIGHT_MARGIN 36
  7. #define LCD_LEFT_MARGIN 19
  8. #define LCD_HSYNC_LEN 5

  9. #define LCD_UPPER_MARGIN 1
  10. #define LCD_LOWER_MARGIN 5
  11. #define LCD_VSYNC_LEN 1

  12. #elif defined(CONFIG_FB_S3C2410_W320240)
  13. #define LCD_WIDTH 320
  14. #define LCD_HEIGHT 240
  15. #define LCD_PIXCLOCK 170000

  16. #define LCD_RIGHT_MARGIN 0x44
  17. #define LCD_LEFT_MARGIN 0x04
  18. #define LCD_HSYNC_LEN 0x01

  19. #define LCD_UPPER_MARGIN 10
  20. #define LCD_LOWER_MARGIN 4
  21. #define LCD_VSYNC_LEN 1

  22. #define LCD_CON5 (S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_INVVFRAME | S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_HWSWP )

  23. #elif defined(CONFIG_FB_S3C2410_N480272)

  24. #define LCD_WIDTH 480
  25. #define LCD_HEIGHT 272
  26. #define LCD_PIXCLOCK 100000

  27. #define LCD_RIGHT_MARGIN 36
  28. #define LCD_LEFT_MARGIN 19
  29. #define LCD_HSYNC_LEN 5

  30. #define LCD_UPPER_MARGIN 1
  31. #define LCD_LOWER_MARGIN 5
  32. #define LCD_VSYNC_LEN 1

  33. #elif defined(CONFIG_FB_S3C2410_TFT640480)
  34. #define LCD_WIDTH 640
  35. #define LCD_HEIGHT 480
  36. #define LCD_PIXCLOCK 40000

  37. #define LCD_RIGHT_MARGIN 67
  38. #define LCD_LEFT_MARGIN 40
  39. #define LCD_HSYNC_LEN 31

  40. #define LCD_UPPER_MARGIN 5
  41. #define LCD_LOWER_MARGIN 25
  42. #define LCD_VSYNC_LEN 1

  43. #elif defined(CONFIG_FB_S3C2410_T240320)
  44. #define LCD_WIDTH 240
  45. #define LCD_HEIGHT 320
  46. #define LCD_PIXCLOCK 170000
  47. #define LCD_RIGHT_MARGIN 25
  48. #define LCD_LEFT_MARGIN 0
  49. #define LCD_HSYNC_LEN 4
  50. #define LCD_UPPER_MARGIN 1
  51. #define LCD_LOWER_MARGIN 4
  52. #define LCD_VSYNC_LEN 1
  53. #define LCD_CON5 (S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_INVVDEN | S3C2410_LCDCON5_INVVFRAME | S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVCLK | S3C2410_LCDCON5_HWSWP )

  54. #elif defined(CONFIG_FB_S3C2410_X240320)
  55. #define LCD_WIDTH 240
  56. #define LCD_HEIGHT 320
  57. #define LCD_PIXCLOCK 170000
  58. #define LCD_RIGHT_MARGIN 25
  59. #define LCD_LEFT_MARGIN 0
  60. #define LCD_HSYNC_LEN 4
  61. #define LCD_UPPER_MARGIN 0
  62. #define LCD_LOWER_MARGIN 4
  63. #define LCD_VSYNC_LEN 9
  64. #define LCD_CON5 (S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_INVVDEN | S3C2410_LCDCON5_INVVFRAME | S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVCLK | S3C2410_LCDCON5_HWSWP )

  65. #elif defined(CONFIG_FB_S3C2410_TFT800480)
  66. #define LCD_WIDTH 800
  67. #define LCD_HEIGHT 480
  68. #define LCD_PIXCLOCK 40000

  69. #define LCD_RIGHT_MARGIN 67
  70. #define LCD_LEFT_MARGIN 40
  71. #define LCD_HSYNC_LEN 31

  72. #define LCD_UPPER_MARGIN 25
  73. #define LCD_LOWER_MARGIN 5
  74. #define LCD_VSYNC_LEN 1

  75. #elif defined(CONFIG_FB_S3C2410_VGA1024768)
  76. #define LCD_WIDTH 1024
  77. #define LCD_HEIGHT 768
  78. #define LCD_PIXCLOCK 80000

  79. #define LCD_RIGHT_MARGIN 15
  80. #define LCD_LEFT_MARGIN 199
  81. #define LCD_HSYNC_LEN 15

  82. #define LCD_UPPER_MARGIN 1
  83. #define LCD_LOWER_MARGIN 1
  84. #define LCD_VSYNC_LEN 1
  85. #define LCD_CON5 (S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_HWSWP)

  86. #endif

  87. #if defined (LCD_WIDTH)

  88. static struct s3c2410fb_display my2440_lcd_cfg __initdata = {

  89. #if !defined (LCD_CON5)
  90.     .lcdcon5    = S3C2410_LCDCON5_FRM565 |
  91.              S3C2410_LCDCON5_INVVLINE |
  92.              S3C2410_LCDCON5_INVVFRAME |
  93.              S3C2410_LCDCON5_PWREN |
  94.              S3C2410_LCDCON5_HWSWP,
  95. #else
  96.     .lcdcon5    = LCD_CON5,
  97. #endif

  98.     .type        = S3C2410_LCDCON1_TFT,

  99.     .width        = LCD_WIDTH,
  100.     .height        = LCD_HEIGHT,

  101.     .pixclock    = LCD_PIXCLOCK,
  102.     .xres        = LCD_WIDTH,
  103.     .yres        = LCD_HEIGHT,
  104.     .bpp        = 16,
  105.     .left_margin    = LCD_LEFT_MARGIN + 1,
  106.     .right_margin    = LCD_RIGHT_MARGIN + 1,
  107.     .hsync_len    = LCD_HSYNC_LEN + 1,
  108.     .upper_margin    = LCD_UPPER_MARGIN + 1,
  109.     .lower_margin    = LCD_LOWER_MARGIN + 1,
  110.     .vsync_len    = LCD_VSYNC_LEN + 1,
  111. };


  112. static struct s3c2410fb_mach_info my2440_fb_info __initdata = {
  113.     .displays    = &my2440_lcd_cfg,
  114.     .num_displays    = 1,
  115.     .default_display = 0,

  116.     .gpccon = 0xaa955699,
  117.     .gpccon_mask = 0xffc003cc,
  118.     .gpcup = 0x0000ffff,
  119.     .gpcup_mask = 0xffffffff,

  120.     .gpdcon = 0xaa95aaa1,
  121.     .gpdcon_mask = 0xffc0fff0,
  122.     .gpdup = 0x0000faff,
  123.     .gpdup_mask = 0xffffffff,


  124.     .lpcsel        = 0xf82,
  125. };

  126. #endif
3、重新编译内核并下载到开发板上,上电系统启动后可以看到LCD亮起,并且出现小企鹅图标。

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