您的位置:首页 > 其它

2.6内核LCD驱动移植

2009-05-21 22:50 225 查看
2.6内核LCD驱动移植

http://blog.chinaunix.net/u/30949/showart.php?id=360200

文件:s3c2410fb_driver.rar
大小:7KB
下载:下载
开发板nano2410上带了一块三星的LTV350QV-F05触摸屏,之前已经把触摸屏的驱动移植上去了,并能在
MINICOM上显示调试信息,x,y的坐标。后来移植qtopia的时候才弄明白,触摸驱动和LCD驱动是两回事,都
需要移植。原来开发板上带的驱动是针对2.4内核,现在使用2.6内核,这款lcd的特点是驱动ic内置在lcd模
块上,所以不用外接lpc3600等驱动ic.它提供一个60 pin的软平线接口出来.这个接口和2410可以直接连
接.接口内包含一个spi口,用来给lcd模块写寄存器,初始化lcd模块.因此,2.6.14的驱动内需要加上一些代
码来完成这项工作.可能某些lcd是不需要这个初始化的,那样的话移植会更简单.
下面是需要修改的文件:
在/linux/arch/arm/mach-s3c2410/mach-smdk2410.c中添加如下内容。
static struct s3c2410fb_mach_info smdk2410_lcdcfg __initdata = {
.regs = {
.lcdcon1 = S3C2410_LCDCON1_TFT16BPP | /
S3C2410_LCDCON1_TFT | /
S3C2410_LCDCON1_CLKVAL(0x03),
.lcdcon2 = S3C2410_LCDCON2_VBPD(3) | /
S3C2410_LCDCON2_LINEVAL(239) | /
S3C2410_LCDCON2_VFPD(5) | /
S3C2410_LCDCON2_VSPW(15),
.lcdcon3 = S3C2410_LCDCON3_HBPD(5) | /
S3C2410_LCDCON3_HOZVAL(319) | /
S3C2410_LCDCON3_HFPD(15),
.lcdcon4 = S3C2410_LCDCON4_MVAL(13) | /
S3C2410_LCDCON4_HSPW(8),
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
},
.lpcsel = 0xf82,
.gpccon = 0xaa955699,
.gpccon_mask = 0xffc003cc,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaa95aaa1,
.gpdcon_mask = 0xffc0fff0,
.gpdup = 0x0000faff,
.gpdup_mask = 0xffffffff,
.fixed_syncs = 1,
.width = 320,
.height = 240,
.xres = {
.min = 320,
.max = 320,
.defval = 320,
},
.yres = {
.max = 240,
.min = 240,
.defval = 240,
},
.bpp = {
.min = 16,
.max = 16,
.defval = 16,
},
};
然后在static void __init smdk2410_map_io(void)中添加
set_s3c2410fb_info(&smdk2410_lcdcfg);
添加头文件
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-lcd.h>
#include <asm/arch/fb.h>
否则会出现variable has initializer but incomplete type之类的错误。
我现在记不太清楚到底该加哪些头文件了,我把我的头文件贴出来,大家差什么就自己加上去
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
/*add by tiplinky*/
#include <linux/device.h>
/*****************/
#include <asm/arch/s3c2410_ts.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
/*#include <asm/arch/s3c2410_ts.h>*/
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/arch/regs-serial.h>
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-lcd.h>
#include <asm/arch/regs-timer.h>
#include <asm/arch/fb.h>
//#include <asm/arch/udc.h>
//#include <asm/arch/ts.h>
//#include <asm/arch/lcd.h>
/*add by tiplinky*/
#include <asm/arch/smdk2410.h>
#include <asm/arch/regs-mem.h>
#include <asm/arch/nand.h>
#include <asm/arch/s3c2410_ts.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/partitions.h>
/*****************/
#include "devs.h"
#include "cpu.h"
/*add by tiplinky*/
#include <asm/arch/usb-control.h>
#include <asm/arch/regs-clock.h>
#include <linux/device.h>
#include <linux/delay.h>
把s3c2410fb.c和s3c2410fb.h两个文件都放在/linux/driver/video目录下面。按hhcn论坛里
seigpao大侠的做法,注释掉drivers/char/vt.c的blank_screen_t(unsigned long
dummy)的函数内容,否则,lcd会在10分钟左右关掉显示.

在编译内核的时候选择224 color,在graphics support中我把所有的选项都选了,除了vga console,选了以后老编译不过去也不知道有什么用。然后从新启动系统就可以看到企鹅tux了。

另外seasea提到在启动参数里若增加console=tty0,结果串口显示到 freeing init memory就没了.
而lcd上可以显示信息,但是不能滚屏,信息会覆盖,而且不能自动换行,某些行显示到屏幕右端就没了,有时间可以试试。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: