您的位置:首页 > 运维架构 > Linux

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

2014-10-11 17:27 656 查看
移植;
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文件:

/* LCD driver info */

static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {

.lcdcon5    = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,

.type        = S3C2410_LCDCON1_TFT,

.width        = 480,    /* by zhutao */
.height        = 272,    /* by zhutao */

/*Set value from LCD datasheet, pixclock set refer to
*document linux-3.0/Documentation/fb/framebuffer.txt */
#if 0
.pixclock    = 166667, // HCLK 60 MHz, divisor 10
.xres        = 240,
.yres        = 320,
.bpp        = 16,
.left_margin    = 20,
.right_margin    = 8,
.hsync_len    = 4,
.upper_margin    = 8,
.lower_margin    = 7,
.vsync_len    = 4,
#endif
/* by zhutao */
.pixclock    = 111111, /* Dclk-Period          =>1000000/Dclk=1000000/9*/
.xres        = 480,    /* Hsync Display Period =>Thd  480*/
.yres        = 272,    /* Vsync Display Period =>Tvd  272*/
.bpp        = 16,    /* 16 bpp*/
.left_margin    = 2,    /* Hsync Front-Porch    =>Thf 2*/
.right_margin    = 2,    /* Hsync Back-Porch     =>Thb 2*/
.hsync_len    = 40,        /* Hsync Pulse Width    =>Thp 41*/
.upper_margin    = 2,    /* Vsync Front-Porch      =>Tvf 2*/
.lower_margin    = 2,    /* Vsync Back-Porch      =>Tvb 2*/
.vsync_len    = 10,        /* Vsync Pulse Width      =>Tvp 10*/
/* by zhutao */
};

static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
.displays    = &smdk2440_lcd_cfg,
.num_displays    = 1,
.default_display = 0,

#if 0
/* currently setup by downloader */
.gpccon        = 0xaa940659,
.gpccon_mask    = 0xffffffff,
.gpcup        = 0x0000ffff,
.gpcup_mask    = 0xffffffff,
.gpdcon        = 0xaa84aaa0,
.gpdcon_mask    = 0xffffffff,
.gpdup        = 0x0000faff,
.gpdup_mask    = 0xffffffff,
#endif

//    .lpcsel        = ((0xCE6) & ~7) | 1<<4,    /* by zhutao */
.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 --->

编译内核,启动,就有小企鹅了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: