竟然忘了发……
复制s3c2410_ts.c到linux2.6.14/drivers/input/touchscreen 目录下
以及复制s3c2410_ts.h到linux2.6.14/include/asm-arm/arch-s3c2410目录下
-------------------修改Makefile------------------
修改 linux2.6.14/drivers/input/touchscreen 目录下的 makefile
在最后添加:obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
------------------修改Konfig--------------------
修改 linux2.6.14/ drivers/input/touchscreen/Kconfig
config TOUCHSCREEN_S3C2410
tristate "Samsung S3C2410 touchscreen input driver"
depends on ARCH_S3C2410 && 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
--------------配置内核---------------
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, 中增加如下内容:
#include <asm/arch-s3c2410/s3c2410_ts.h>
#include <asm/arch-s3c2410/regs-sdi.h>
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文件中添加如下几行:
/*for s3c2410 touchscreen*/
#include <asm/arch-s3c2410/s3c2410_ts.h>
/* 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);
------------------------------------------------------------------
修改include/asm-arm/arch-s3c2410/regs-adc.h
#define S3C2410_ADCTSC_XY_PST (0×3<<0)改为define S3C2410_ADCTSC_XY_PST(x) (((x)&0×3)<<0)
编译成功,但是现在好像有点问题,待测
if (ts.count != 0) {
ts.xp >>= ts.shift;
ts.yp >>= ts.shift;
//reset coordinate system add by lili
tmp = ts.xp;
ts.xp = ts.yp;
ts.yp = tmp;
//调试信息。
#ifdef CONFIG_TOUCHSCREEN_S3C2410_DEBUG
{
struct timeval tv;
do_gettimeofday(&tv);
printk(DEBUG_LVL "T: %06d, X: %03ld, Y: %03ld\n", (int)tv.tv_usec, ts.xp, ts.yp);
}
#endif
加上调试信息。
cat /dev/ts0 然后触摸屏幕,打印出来的是乱码。
改变printk 打印级别
echo 8 > /proc/sys/kernel/printk
打印所有内核信息,再触摸,有坐标显示了。
用户291441 2010-6-21 11:06
用户291441 2010-6-21 11:05