触摸屏驱动移植 2410+linux 2.6.13
时间:2009-04-08 来源:guliangzeng
|
在 linux2.6.14 中没有提供 s3c2410 的驱动,所以我们要新建驱动文件,我们在 linux2.6.14/drivers/input/touchscreen 目录下建立新的文件 hfrk_s3c2410_ts.c 文件,驱动文件我们可以参考类似的触摸屏驱动,具体的内容参看网站或者光盘提供的源代码。 首先:我们需要修改 linux2.6.14/drivers/input/touchscreen 目录下的 makefile 文件,在文件的最后 添加 : obj-$(CONFIG_TOUCHSCREEN_S3C2410) += hfrk_s3c2410_ts.o 第二:我们需要修改 linux2.6.14/ drivers/input/touchscreen/Kconfig 中添加: config TOUCHSCREEN_S
tristate "Samsung S3C2410 touchscreen input driver"
depends on ARCH_SMDK2410 && INPUT && INPUT_TOUCHSCREEN
select SERIO
help
Say Y here if you have the s3c2410 touchscreen.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called s3c2410_ts. config TOUCHSCREEN_S3C2410_DEBUG
boolean "Samsung S3C2410 touchscreen debug messages"
depends on TOUCHSCREEN_S3C2410
help
Select this if you want debug messages 修改完成以后,在我们配置内核的时候,就会增加关系s3c2410的触摸屏配置,我们选择上这些配置就可以把驱动增加进去了 Device drivers - à
Input device support à
Touchscreens à
<*>Samsung S3C2410 touchscreen input driver
[]Samsung s3c2410 touchscreen debug message 第三:在 /linux-2.6.14/arch/arm/mach-s3c2410/mach-smdk2410.c, 中增加如下内容: static struct s3c2410_ts_mach_info sbc2410_ts_cfg __initdata = {
.delay = 10000,
.presc = 49,
.oversampling_shift = 2,
}; 在smdk2410_devices结构中,添加:
&s3c_device_ts, 在smdk2410_map_io函数中添加:
set_s3c2410ts_info(&sbc2410_ts_cfg); 第四:在 /linux-2.6.14/ arch/arm/mach-s3c2410/devs.h 文件中添加: extern struct platform_device s3c_device_ts; 第五:在arch/arm/mach-s3c2410/devs.c文件中添加如下几行: /* Touchscreen */
static struct s3c2410_ts_mach_info s3c2410ts_info;
void __init set_s3c2410ts_info(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
{
memcpy(&s3c2410ts_info,hard_s3c2410ts_info,sizeof(struct s3c2410_ts_mach_info));
} EXPORT_SYMBOL(set_s3c2410ts_info);
struct platform_device s3c_device_ts = {
.name = "s3c2410-ts",
.id = -1,
.dev = {
.platform_data = &s3c2410ts_info,
}
}; EXPORT_SYMBOL(s3c_device_ts); 经过这些修改,我们的触摸屏驱动已经完成 , 我们编译就可以了。我们的 这个触摸屏驱动在内核注册为 /dev/input/mouse0
相关阅读 更多 +