FL2440移植LINUX-3.4.2 (七)--驱动移植LCD(移植自己写的和移植内核自带的)

时间:2022-06-06 19:42:06

 移植;
1.编译
2.解决错误
    2.1头文件不对:去掉或更改
    2.2宏不对:改名,使用新宏
    2.3 函数没有了:改名使用新函数

(一):移植自己写的LCD驱动:

修改内核配置:

│   Location:                                                                                                                             │  
  │     -> Device Drivers                                                                                                                   │  
  │       -> Graphics support                                                                                                               │  
  │         -> Support for frame buffer devices (FB [=y])

 │                               <M>   S3C2410 LCD framebuffer support

一定选上这个:

  │     -> Device Drivers                                                                                                                   │  
  │       -> Graphics support                                                                                                               │  
  │         -> Console display driver support

         <*> Framebuffer Console support 

make zImage

make modules

 

 使用最新的根文件系统

cd linux-3.4.2/drivers/video

 

拷贝这三个模块到网络文件系统下:

cfbcopyarea.ko  cfbfillrect.ko  cfbimgblt.ko

启动新系统:

/ # insmod cfbcopyarea.ko                                                                                                                             
/ # insmod cfbimgblt.ko                                                         
/ # insmod cfbfillrect.ko                                                       
/ # insmod lcd.ko 

 

lcd移植成功。

 

(二)下面把内核自带的Lcd驱动编译到内核里面:

修改内核mach-smdk2440.c文件:

 

 1 /* LCD driver info */
 2 
 3 static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {  4 
 5     .lcdcon5    = S3C2410_LCDCON5_FRM565 |
 6               S3C2410_LCDCON5_INVVLINE |
 7               S3C2410_LCDCON5_INVVFRAME |
 8               S3C2410_LCDCON5_PWREN |
 9  S3C2410_LCDCON5_HWSWP, 10 
11     .type        = S3C2410_LCDCON1_TFT, 12 
13     .width        = 480,    /* by zhutao */
14     .height        = 272,    /* by zhutao */
15     
16  /*Set value from LCD datasheet, pixclock set refer to 17 *document linux-3.0/Documentation/fb/framebuffer.txt */
18 #if 0
19     .pixclock    = 166667, // HCLK 60 MHz, divisor 10
20     .xres        = 240, 21     .yres        = 320, 22     .bpp        = 16, 23     .left_margin    = 20, 24     .right_margin    = 8, 25     .hsync_len    = 4, 26     .upper_margin    = 8, 27     .lower_margin    = 7, 28     .vsync_len    = 4, 29 #endif
30     /* by zhutao */
31     .pixclock    = 111111, /* Dclk-Period =>1000000/Dclk=1000000/9*/
32     .xres        = 480,    /* Hsync Display Period =>Thd 480*/
33     .yres        = 272,    /* Vsync Display Period =>Tvd 272*/
34     .bpp        = 16,    /* 16 bpp*/
35     .left_margin    = 2,    /* Hsync Front-Porch =>Thf 2*/
36     .right_margin    = 2,    /* Hsync Back-Porch =>Thb 2*/
37     .hsync_len    = 40,        /* Hsync Pulse Width =>Thp 41*/
38     .upper_margin    = 2,    /* Vsync Front-Porch =>Tvf 2*/
39     .lower_margin    = 2,    /* Vsync Back-Porch =>Tvb 2*/
40     .vsync_len    = 10,        /* Vsync Pulse Width =>Tvp 10*/
41     /* by zhutao */
42 }; 43 
44 static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = { 45     .displays    = &smdk2440_lcd_cfg, 46     .num_displays    = 1, 47     .default_display = 0, 48 
49 #if 0
50     /* currently setup by downloader */
51     .gpccon        = 0xaa940659, 52     .gpccon_mask    = 0xffffffff, 53     .gpcup        = 0x0000ffff, 54     .gpcup_mask    = 0xffffffff, 55     .gpdcon        = 0xaa84aaa0, 56     .gpdcon_mask    = 0xffffffff, 57     .gpdup        = 0x0000faff, 58     .gpdup_mask    = 0xffffffff, 59 #endif
60 
61 // .lpcsel = ((0xCE6) & ~7) | 1<<4, /* by zhutao */
62     .lpcsel        = ((0xCE6) & ~7) | 1<<1,    /* by zhutao */

 

修改内核配置:

│   Location:                                                                                                                             │  
  │     -> Device Drivers                                                                                                                   │  
  │       -> Graphics support                                                                                                               │  
  │         -> Support for frame buffer devices (FB [=y])

 │                               <*>   S3C2410 LCD framebuffer support

 

 

 

如果选上这个将会在lcd上显示linux的LOGO:

   Location:                                                                                                                             │  
  │     -> Device Drivers                                                                                                                   │  
  │       -> Graphics support 

 │           [*] Bootup logo  --->

编译内核,启动,就有小企鹅了。